I have created an Appwizzard MFC application for Windows CE and I wanted
to associate a custom file extension (.vck) with it. My goal was for the
File Explorer to open my application when the user tapped the file icon
(or the same thing to happen when I receive the file through Obex).
The application's name is "appwizzard.exe". Following the examples on
the net, I have added the following keys to the registry, using
RegCreateKeyEx and RegSetValueEx calls:
HKEY_CLASSES_ROOT\.vck\default = dddfile
# borrowed word's icon for now
HKEY_CLASSES_ROOT\dddfile\DefaultIcon\default = \Windows\pword.exe,-106
HKEY_CLASSES_ROOT\dddfile\Shell\Open\Command\\Windows\appwizzard.exe %1
If I create a file by the name "nnn.vck", I see it listed with an
"unknown file type"-kind of icon. The first time I tap the icon, it
becomes a "pocket word document" icon, and my application opens correctly.
However if I close my application and tap the file icon again, the following
message pops up:
"There is no application associated with 'nnn'. Run the application
first, then open this file from within the application"
In the PocketPC 2002 upgrade on Ipaq, I created the same entries, but
the above described dialog box pops up all the time, and my application
never launches.
In I also tried adding
HKEY_CLASSES_ROOT\dddfile\Shell\OpenDoc\Command\\Windows\appwizzard.exe -opendoc %1
just like the entry for the "docfile" in the registry, but this didn't
help.
Does anyone know:
- how can I make the correct file extension association in the registry
for PocketPC2002 ?
- why does the association work only one time in PocketPC2000 ?
Thanks,
Victor
Also, one thing I saw once was someone had a "space" character at the end of
the file extension (or mapped name) and that caused the same type of
behavior you are seeing.
Does PIE work? (i.e. file://\nnn.vck -- where this file is in the
filesystem?)
- Jay
"Victor Salamon" <sal...@brule.cs.ualberta.ca> wrote in message
news:a64k3u$ahg$1...@pulp.srv.ualberta.ca...
> Also, one thing I saw once was someone had a "space" character at the
> end of the file extension (or mapped name) and that caused the same type of
> behavior you are seeing.
I checked both through the code and through the Remote Registry Editor,
none of the entries seem to have extra spaces in them. Are there any
other special characters I should be avoiding ?
> Does PIE work? (i.e. file://\nnn.vck -- where this file is in the
> filesystem?)
PIE opens it like it were a regular text file (I can see its text contents)
I also tried renaming the type to vvvfile, with the associated .vvv
extension, but that didn't change anything.
In case it helps, I include the code that creates the registry entries:
/* -------------- extension --------------- */
res = RegCreateKeyEx(HKEY_CLASSES_ROOT, // HKEY hKey,
TEXT(".vvv"), // LPCWSTR lpSubKey,
0, // DWORD Reserved,
NULL, // LPWSTR lpClass,
0, // DWORD dwOptions,
0, // REGSAM samDesired,
NULL, // LPSECURITY_ATTRIBUTES lpSecurityAttributes,
&hk, // PHKEY phkResult,
&status // LPDWORD lpdwDisposition
);
if(ERROR_SUCCESS != res) {
debugRegistryResult(res); return;
}
res = RegSetValueEx(hk, // HKEY hKey,
TEXT(""), // LPCWSTR lpValueName,
0, // DWORD Reserved,
REG_SZ, // DWORD dwType,
(BYTE*)(TEXT("vvvfile")), // const BYTE *lpData,
strlen(REGFILETYPE) * sizeof(TCHAR));
if(ERROR_SUCCESS != res) {
debug("RegSetValueEx returned %d", res); return;
}
RegCloseKey(hk);
/* ------------ open command ------------ */
res = RegCreateKeyEx(HKEY_CLASSES_ROOT, // HKEY hKey,
TEXT("vvvfile\\Shell\\Open\\Command"), // LPCWSTR lpSubKey,
0, // DWORD Reserved,
NULL, // LPWSTR lpClass,
0, // DWORD dwOptions,
0, // REGSAM samDesired,
NULL, // LPSECURITY_ATTRIBUTES lpSecurityAttributes,
&hk, // PHKEY phkResult,
&status // LPDWORD lpdwDisposition
);
if(ERROR_SUCCESS != res) {
debugRegistryResult(res); return;
}
res = RegSetValueEx(hk, // HKEY hKey,
TEXT(""), // LPCWSTR lpValueName,
0, // DWORD Reserved,
REG_SZ, // DWORD dwType,
(BYTE*)(TEXT("\\Windows\\appwizzard.exe %1")),
strlen(REGAPPPATH) * sizeof(TCHAR));
if(ERROR_SUCCESS != res) {
debug("RegSetValueEx returned %d", res); return;
}
RegCloseKey(hk);
/* ------------ default icon ------------------- */
res = RegCreateKeyEx(HKEY_CLASSES_ROOT, // HKEY hKey,
TEXT("vvvfile\\DefaultIcon"), // LPCWSTR lpSubKey,
0, // DWORD Reserved,
NULL, // LPWSTR lpClass,
0, // DWORD dwOptions,
0, // REGSAM samDesired,
NULL, // LPSECURITY_ATTRIBUTES lpSecurityAttributes,
&hk, // PHKEY phkResult,
&status // LPDWORD lpdwDisposition
);
if(ERROR_SUCCESS != res) {
debugRegistryResult(res); return;
}
res = RegSetValueEx(hk, // HKEY hKey,
TEXT(""), // LPCWSTR lpValueName,
0, // DWORD Reserved,
REG_SZ, // DWORD dwType,
(BYTE*)(TEXT(\\Windows\\appwizzard.exe,-128)),
strlen(REGDEFAULTICONKEY) * sizeof(TCHAR));
if(ERROR_SUCCESS != res) {
debug("RegSetValueEx returned %d", res); return;
}
RegCloseKey(hk);
Thanks,
Victor