• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 135
  • Last Modified:

Registry? Want to add my Prog to Win95!

I have written an encryption/decryption program (hasn't everyone?).

I want to add it to Win95 so that when the User clicks on a file of a certain type it will bring up MY program!
It should call my Program with a command line statement saying what file the User has clicked.
 Kinda like clicking on a zip and WinZip pops up!  How do I do this?
Using VB5 Enterprise Edition
0
jgore
Asked:
jgore
  • 3
1 Solution
 
yowkeeCommented:
jgore,

  Basically to associate a extension(file type) with your application, you must have appropriate information in the Registry. For
example, your application name test.exe and stay in folder C:\temp, the extension to associate is .aaa. Then, in your
registry, these key must existed:
(HKCR = HKEY_CLASSES_ROOT)

----
[HKCR\.aaa]
@Defaule="aaafile"
[HKCR\aaafile\shell\open\command]
@Default="C:\temp\test.exe %1"
' And the default icon for the file with .aaa
[HKCR\aaafile\DefaultIcon]
@Default="C:\temp\test.exe,1"   (this mean first icon contain
                                 in test.exe)
Use regedit.exe to open the registry and looking for HKCR\.htm, HKCR\htmlfiles and you will feel about it.

And then, you must handle the command line arguments in your application startup code. For example,

Sub Main()

   Dim sFileToOpen As String

   sFileToOpen = Trim$(Command)
   :
   :  ' Code to handle the file..
End Sub

----

Regards.

0
 
yowkeeCommented:
MS has an KB article(Q185453) about this:

http://support.microsoft.com/support/kb/articles/q185/4/53.asp
0
 
jgoreAuthor Commented:
OK, I checked it out and it looks good.

One question though:
I can edit my own Registry and make those changes,but I
can't ask the Users of my program to do that.
I have some VB code to edit the registry, but I hate using it.

Do you think it would work if I just copied that part of my registry and saved it
as  "test.reg" and then have user click on it? Perhaps I could even shell to it!
I've seen something like that before. Would Win95 then absorb it?
It would save a lot of code!

0
 
yowkeeCommented:
jgore,

  The link that I mentioned in my comment contained the code example to do this. Please let me know if you don't get it.

  By the way, if you really want to export the registry setting and save to a .reg file(eg. test.reg). You could use
  Shell("Regedit.exe test.reg",1) to import the registry file. The traditional way is using registry api to insert those registry setting and the code example existed in MS kb that I mention.

  Regards.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now