CeateProcess
-
Friends, I want to programatically launch MS-Word document say like
c:\\MyFolder\\MyFile.doc
. I am tryingCreateProcess()
but it is not working for me. I think i am doing something wrong while giving first and second parameters of this function. On client machine the word document can be present at any location of the drive and MS Word can be installed in any location. Plese tell me how to launch MS Word document when we know its fully qualified name. I dont want to use Automation Imtiaz -
Friends, I want to programatically launch MS-Word document say like
c:\\MyFolder\\MyFile.doc
. I am tryingCreateProcess()
but it is not working for me. I think i am doing something wrong while giving first and second parameters of this function. On client machine the word document can be present at any location of the drive and MS Word can be installed in any location. Plese tell me how to launch MS Word document when we know its fully qualified name. I dont want to use Automation ImtiazI use this: { SHELLEXECUTEINFO ShExecInfo; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = NULL; ShExecInfo.hwnd = NULL; ShExecInfo.lpVerb = 0; ShExecInfo.lpFile = DocName; ShExecInfo.lpParameters = NULL; ShExecInfo.lpDirectory = NULL; ShExecInfo.nShow = SW_MAXIMIZE; ShExecInfo.hInstApp = NULL; ShellExecuteEx(&ShExecInfo); } Just put your document's name in DocName and the system will find the program that handles the document. I have used it with a .rtf document and it loads MSWord on systems that have MSWord or it loads WordPad on the systems that don't have MSWord.