CreateProcess won't work 
Author Message
 CreateProcess won't work

Can anyone tell me what's wrong with this? When I supply the fully-qualified
filespecs  for both MS word and a doc file, Word just doesn't recognise the
filename and starts a new document. WordPro acts up as well :(

siStartLastDoc.cb = Len(siStartLastDoc) 'initialise STARTUPINFO structure
Result = CreateProcess(vbNullString, ExeFileSpec & " " & DocFileSpec, ByVal
0, ByVal 0, 1, NORMAL_PRIORITY_CLASS, ByVal 0, vbNullString,
 siStartLastDoc, piProcLastDoc)



Sun, 09 Nov 2003 20:43:02 GMT  
 CreateProcess won't work
Ian,

I'm guessing here that the arguments to CreateProcess()
are fairly close to the ShellExecute() that I use, so

. . . _
ExeFileSpec & " " & DocFileSpec _
, ByVal 0 _
, ByVal 0 _
. . .

(executable path, arguments and 'Start In' Path)
probably ought be

. . . _
ExeFileSpec _
, DocFileSpec _
, ByVal 0 _
. . .

Also, if you were to use ShellExecute() instead, you
wouldn't (strictly) need the Word path at all.  If you
specify the first argument as "open" and replace
"ExeFileSpec" with "DocFileSpec", ShellExecute() will
open the Word document with the default application
for that type of document (hopefully MS Word).

HTH,
    Phill  W.


Quote:
> Can anyone tell me what's wrong with this? When I supply the
fully-qualified
> filespecs  for both MS word and a doc file, Word just doesn't recognise
the
> filename and starts a new document. WordPro acts up as well :(

> siStartLastDoc.cb = Len(siStartLastDoc) 'initialise STARTUPINFO structure
> Result = CreateProcess(vbNullString, ExeFileSpec & " " & DocFileSpec,
ByVal
> 0, ByVal 0, 1, NORMAL_PRIORITY_CLASS, ByVal 0, vbNullString,
>  siStartLastDoc, piProcLastDoc)



Sun, 09 Nov 2003 20:52:26 GMT  
 CreateProcess won't work
It's not obvious that this is the source of your problem, but
it's
worth mentioning:

Does the path in DocFileSpec contain any spaces?  Enclose long
file
names in quotes to handle this.


Quote:
> Can anyone tell me what's wrong with this? When I supply the
fully-qualified
> filespecs  for both MS word and a doc file, Word just doesn't
recognise the
> filename and starts a new document. WordPro acts up as well :(

> siStartLastDoc.cb = Len(siStartLastDoc) 'initialise

STARTUPINFO structure
Quote:
> Result = CreateProcess(vbNullString, ExeFileSpec & " " &
DocFileSpec, ByVal
> 0, ByVal 0, 1, NORMAL_PRIORITY_CLASS, ByVal 0, vbNullString,
>  siStartLastDoc, piProcLastDoc)



Sun, 09 Nov 2003 23:54:16 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CreateProcess won't work

2. simple ftp app developed on win98 won't work on win nt

3. Can't get CreateProcess() to work!

4. CreateProcess function doesn't work properly.

5. CreateProcess function doesn't work properly.

6. Shortcut keys won't work in VB Dev't Environment

7. Two Q's [Closing a file][why won't work]

8. My Listbox Won't Ignore Me (WM_SETREDRAW doesn't work)

9. My expressions won't work (simple left or between functions)

10. Why won't this work?

11. Win 2000 Offline files doesn't work with mdb

12. StrConv won't work

 

 
Powered by phpBB® Forum Software