Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Open File from Explorer

Hi
I'm having problems to open a file for my program from the windows explorer. I already registered the file extension in the REGEDIT with the following values:

HKEY_CLASSES_ROOTApplicationsMyProgram.exeshellopencommand
Default (String) = "C:MyProgramPathMyProgram.EXE" "%1"

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.ext
Application (String) = "MyProgram.exe"

Also, I made the program load the file parameter (if any) from the command line using the ParamStr function on the OnFormCreate event handler, so it could load the file when the program starts. It all worked just fine when i opened the file from the DOS command prompt (CMD) like this:

C:MyProgramPath> MyProgram MyFile.ext

However, when i tried to do it from the windows explorer doble clicking the file, it didn't work, it is just not passing any parameters to the program. How can i solve this? I've read all the messageboards from this web page, but i still can't do it. Help!!!

Comments

  • MasterijnMasterijn Posts: 188Member
    [b][red]This message was edited by Masterijn at 2005-1-29 4:43:14[/red][/b][hr]
    : Hi
    : I'm having problems to open a file for my program from the windows explorer. I already registered the file extension in the REGEDIT with the following values:
    :
    : HKEY_CLASSES_ROOTApplicationsMyProgram.exeshellopencommand
    : Default (String) = "C:MyProgramPathMyProgram.EXE" "%1"
    :
    : HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerFileExts.ext
    : Application (String) = "MyProgram.exe"
    :
    : Also, I made the program load the file parameter (if any) from the command line using the ParamStr function on the OnFormCreate event handler, so it could load the file when the program starts. It all worked just fine when i opened the file from the DOS command prompt (CMD) like this:
    :
    : C:MyProgramPath> MyProgram MyFile.ext
    :
    : However, when i tried to do it from the windows explorer doble clicking the file, it didn't work, it is just not passing any parameters to the program. How can i solve this? I've read all the messageboards from this web page, but i still can't do it. Help!!!
    :
    Try:
    C:MyProgramPath> MyProgram FullPathFilename.ext
    if that doesn't work the problem is also in your app
    It's better to use the associate function in explorer to make sure it's done right. The above reg settings are a bit mixed up.
    I should be something like this in the registry
    [code]
    [HKEY_CLASSES_ROOT.txt]
    @="txtfile"
    "PerceivedType"="text"
    "Content Type"="text/plain"
    [/code][code]
    [HKEY_CLASSES_ROOT xtfile]
    @="Tekstdocument"
    [HKEY_CLASSES_ROOT xtfileDefaultIcon]
    @=%SystemRoot%system32shell32.dll,-152

    [HKEY_CLASSES_ROOT xtfileshell]

    [HKEY_CLASSES_ROOT xtfileshellopen]

    [HKEY_CLASSES_ROOT xtfileshellopencommand]
    @=%SystemRoot%system32NOTEPAD.EXE %1
    [/code]






Sign In or Register to comment.