CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: ShellExecute

  1. #1
    Join Date
    Mar 1999
    Posts
    1

    ShellExecute



    i want to start winword with a doc-file based on a dot-file

    the following line works :

    HINSTANCE hinst = ShellExecute (NULL,"open","C:\\xxx.dot",NULL,NULL,SW_SHOW);


    but not the next two lines :

    HINSTANCE hinst = ShellExecute (NULL,"open","C:\\xxx.dot","/t",NULL,SW_SHOW);

    HINSTANCE hinst = ShellExecute (NULL,"open","C:\\xxx.dot /t",NULL,NULL,SW_SHOW);



  2. #2
    Join Date
    Jan 2000
    Location
    Freiburg, Germany
    Posts
    145

    Re: ShellExecute

    Well first off, what does "doesn't work" mean? Returns an error code? Locks up your computer? Sends nasty messages to the Chinese Prime Minister? (And a corollary to that would be what does it mean that the first call "works?" If so, why do you need to seek further?)

    I assume, however, that the first call opens winword okay with the document, but you want to add the functionality of a command line parameter. Since you're calling ShellExecute with the name of a document, you may not use a parameter (as indicated in the MSDN). An option might be rather to call winword directly, say :

    ShellExecute(NULL, "open", "winword", "c:\xxx\document.dot /t", NULL, SW_SHOW);



    If this doesn't satisfy your needs, post more info so I know better what's going on.

    Walter Gildersleeve
    Freiburg, Germany


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