Click to See Complete Forum and Search --> : ShellExecute


Bernd
March 31st, 1999, 04:44 AM
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);

Null Bock
December 15th, 2000, 02:29 AM
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