Welcome, Guest
Please Login or Register.    Lost Password?
Go to bottomPage: 1
TOPIC: Create file association?
#79
Create file association? 3 Years, 2 Months ago Karma: 2
Hi, a bit of information and a request... Just worked out how to use PocketPC Installation Creator to create file associations. You need to set 4 registry entries, for example (modified from www.devbuzz.com/content/zinc_evb_icon_assoc_pg2.asp):

Code:


[RegEntrys]
HKCR,.mrb,,,mrbfile
HKCR,mrbfile,,,MyFileDescription
HKCR,mrbfile\DefaultIcon,,,"%InstallDir%\MyEVBLauncher.exe,0"
HKCR,mrbfile\Shell\Open\Command,,,""""%InstallDir%\MyEVBLauncher.exe"" %%1"


To get this into your project in PPIC use the Registry and Shortcuts part of the PocketPC Side section. Hit 'Edit Registry Sections' (Nick - typo in your button name here!) and select 'Add', then give the section a name (in this case 'RegEntrys'). Then fill out the key details dialog box as follows:

Code:


Entry 1:
Registry Root Key: HKEY_CLASSES_ROOT
Subkey: .mbr
Value Name: (leave blank)
Value: mbrfile



Hit OK, and then 'Add' to create the next section

Code:


Entry 2:
Registry Root Key: HKEY_CLASSES_ROOT
Subkey: mbrfile
Value Name: (leave blank)
Value: MyFileDescription



Hit OK, and then 'Add' to create the next section

Code:


Entry 3:
Registry Root Key: HKEY_CLASSES_ROOT
Subkey: mrbfile\DefaultIcon
Value Name: (leave blank)
Value: "%InstallDir%\MyEVBLauncher.exe,0"



Hit OK, and then 'Add' to create the next section

Code:


Entry 4:
Registry Root Key: HKEY_CLASSES_ROOT
Subkey: mrbfile\Shell\Open\Command
Value Name: (leave blank)
Value: """"%InstallDir%\MyEVBLauncher.exe"" %%1"



Then go back to the main screen and add the section to the installation details for you platform(s).

Hope this is of use to someone out there! Also Nick feel free to use this in your documentation.

Finally a request - could a function to do this automatically be created so the registry entries don't have to be entered manually?

(Edit 2007-05-11 to fix missing backslash chars)
(Edit 2007-05-16 to change HKLM to HKCR in example!)
Antzzz
Junior Boarder
Posts: 24
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#83
Re:Create file association? 3 Years, 2 Months ago Karma: 6
Thanks for the guide
And, yes it is a very good idea for a feature ...
In the next version it will be added ...

Regards,
Nick Protopapas
nick_tg
Moderator
Posts: 220
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#95
Re:Create file association? 3 Years, 2 Months ago Karma: 6
All done
Added the automatic file association feature.
See here for more info:
www.aperitto.com/component/option,com_ku...ew/catid,9/id,92/#92

Regards,
Nick Protopapas
nick_tg
Moderator
Posts: 220
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#97
Re:Create file association? 3 Years, 2 Months ago Karma: 2
Hi Nick, have tested the new features and it all looks pretty good! The file association thing did turn up something interesting in my code though to do with quote marks and the CFile::Open operation.

Originally the open registry entry in HKCR I had was

Code:

"exe path\exe name.exe" %1


With your new built-in function it ends up as:

Code:

"exe path\exe name.exe" "%1"


And my code worked with the first reg entry but not the second - basically it grabs the command line and passes it to the MFC CFile::Open command.

The extra quote marks result in the command line being passed to the open function surrounded in quote marks:

Code:

"\My Documents\file name.ext"


Rather than:

Code:

\My Documents\file name.ext


On the PC platform it works the same way as your function - it passes the command line with the quote marks and the CFile::Open command works fine. However it seems to fail on the PocketPC platform.

Easy fix, I just modified my application to strip quote marks if present from the command line before passing it to the CFile::Open function on the PocketPC platform only.

Looking at other entries in the HKCR part of the registry it seems the quote marks are not normally used.

So something to be aware of - but not sure if there is actually anything wrong with the way you have implemented this!
Antzzz
Junior Boarder
Posts: 24
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#98
Re:Create file association? 3 Years, 2 Months ago Karma: 6
yes, this is the point of the quote marks.
The
Code:

\My Documents\file name.ext

is parsed as three different parameters:
Code:


1. \My
2. Documents\file
3. name.ext


So if you enclose the file parameter into quote marks, then is parsed as only one parameter, but you must strip the marks into your program.
I think that is standard for windows, the quote marks. But if one doesn't want them, simply can edit the generated registry entries.
With this version I think it is more human understable the registry edit
Regards,
Nick Protopapas
nick_tg
Moderator
Posts: 220
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#99
Re:Create file association? 3 Years, 2 Months ago Karma: 2
Ahh, I've worked out why this is causing a problem for me. I process the command line directly, and don't break it up using spaces as a seperator for the CE build of my app.

So you are right, using the quote marks is the 'proper' way of doing things.

Oh and definitely like the new registry editing dialogs!
Antzzz
Junior Boarder
Posts: 24
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: nick_tg