The code you posted works fine, when I test it and open a word document. (I
AliR.
Hello,
A portion of the code is below. Nothing that I am doing is all that
fancy. Also, nothing really depends on when Word exits, it is just that
Word should be able to exit cleanly regardless if it is opened with
ShellExecuteEx or by a user double clicking on the word icon.
/********************************************************************/
/* CHECK TO SEE IF FILENAME BEGINS WITH __. */
/* IF IT DOES, THEN OPEN BLANK APP FOR THAT EXT */
/********************************************************************/
if(strstr(chAppData,EMPTY_FILE) != NULL)
{
strcpy(compFileName,BLANK_FILE_DIR);
strcat(compFileName,chAppData);
newFileHandle = CreateFile( compFileName,
0,
FILE_SHARE_READ,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_READONLY,
NULL);
CloseHandle(newFileHandle);
ShExecStruct.lpFile = compFileName;
}
else
ShExecStruct.lpFile = chAppData;
ShExecStruct.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecStruct.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
ShExecStruct.hwnd = NULL;
ShExecStruct.lpVerb = "open";
ShExecStruct.lpParameters = NULL;
ShExecStruct.lpDirectory = NULL;
ShExecStruct.nShow = SW_MAXIMIZE;
retVal = ShellExecuteEx(&ShExecStruct);
AliR wrote:
It would help if you could post the code you are using to open the file,