CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    43

    I want to antomaticly start my program when the user double clicked the file

    The file is specific to my program,how should i do ?

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940
    If you're doing a document/view structured program you can associate the file to the program.

    Firstly, you'll need to change the resource for the document specifying file type etc :

    This is in the string tables e.g. if the extension is .map

    Code:
    IDR_MAINFRAME
    
    My Application\n\nMAP\nMy Application files (*.map)\n.map\nMyApplication.Document\nMy Application Document
    Then insert the following two lines into the InitInstance of your application class after AddDocTemplate :

    Code:
    EnableShellOpen();
    RegisterShellFileTypes(TRUE);
    That should do the trick. This will associate whatever extension with your application and your application will fire up and open a file when it is double clicked.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Mar 2004
    Posts
    43
    Thank you ,but my program is dialog based,how should i do?

  4. #4
    Join Date
    Jan 2004
    Location
    Bangalore
    Posts
    53
    You can do the same for your dialogbased application .
    Use the following

    void CYourApp::RegisterShellFileTypes(BOOL bCompat)
    {
    CWinApp::EnableShellOpen();
    CWinApp::RegisterShellFileTypes(bCompat);//TRUE

    }

    Regards
    Mjvalan

  5. #5
    Join Date
    Mar 2004
    Posts
    43
    i'll try it ,thank all of you

  6. #6
    Join Date
    Apr 2005
    Posts
    4

    Re: I want to antomaticly start my program when the user double clicked the file

    hello,I am doing a media player in pocket pc with EVC,and I wonder if it is the same as you said that I can double click the file and then automatically transfer to my mediap player? my application is developped in win32,not MFC, THANKS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured