Re: CreateProcessA Lib "kernel32" problem
From: vbVeryBeginner (anonymous_at_anonymous.com)
Date: 07/08/04
- Next message: Tom Esh: "Re: CreateProcessA Lib "kernel32" problem"
- Previous message: Mike D Sutton: "Re: Stretch Icons"
- In reply to: vbVeryBeginner: "CreateProcessA Lib "kernel32" problem"
- Next in thread: J French: "Re: CreateProcessA Lib "kernel32" problem"
- Reply: J French: "Re: CreateProcessA Lib "kernel32" problem"
- Reply: vbVeryBeginner: "Re: CreateProcessA Lib "kernel32" problem"
- Reply: Randy Birch: "Re: CreateProcessA Lib "kernel32" problem"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 8 Jul 2004 10:01:01 +0800
thanks first, zoury and gale green
now, this is funny.
i figure out how to did it but i don't really understand what going on.
let say i am going to use the WIN32 API CreateProcess, the first step i will
do is to search for that function using the VB provided API Viewer.
it ask me to declare using the following statement
01> Private Declare Function CreateProcess Lib "kernel32" Alias
"CreateProcessA" ( _
02> ByVal lpApplicationName As String, _
03> ByVal lpCommandLine As String, _
04> lpProcessAttributes As SECURITY_ATTRIBUTES, _
05> lpThreadAttributes As SECURITY_ATTRIBUTES, _
06> ByVal bInheritHandles As Long, _
07> ByVal dwCreationFlags As Long, _
08> lpEnvironment As Any, _
09> ByVal lpCurrentDriectory As String, _
10> lpStartupInfo As STARTUPINFO, _
11> lpProcessInformation As PROCESS_INFORMATION) As Long
and after much desperate tries to figure out what went wrong, i try
downloading some other example code and to my astonishment, they use a
DIFFERENT declaration!
01> Private Declare Function CreateProcessA Lib "kernel32" ( _
02> ByVal lpApplicationName As Long, _
03> ByVal lpCommandLine As String, _
04> ByVal lpProcessAttributes As Long, _
05> ByVal lpThreadAttributes As Long, _
06> ByVal bInheritHandles As Long, _
07> ByVal dwCreationFlags As Long, _
08> ByVal lpEnvironment As Long, _
09> ByVal lpCurrentDirectory As Long, _
10> lpStartupInfo As STARTUPINFO, _
11> lpProcessInformation As PROCESS_INFORMATION) As Long
the differences are
#2
ByVal lpApplicationName As String (VB API Declaration)
ByVal lpApplicationName As Long (Their Declaration)
#4
lpProcessAttributes As SECURITY_ATTRIBUTES (VB)
ByVal lpProcessAttributes As Long (Their)
#5
lpThreadAttributes As SECURITY_ATTRIBUTES (VB)
ByVal lpThreadAttributes As Long (Their)
#8
lpEnvironment As Any (VB)
ByVal lpEnvironment As Long (Their)
#9
ByVal lpCurrentDriectory As String (VB)
ByVal lpCurrentDirectory As Long (Their)
i have NO LUCK using the VB provided API Viewer but able to start the
notepad.exe using THEIR declaration. now, why the VB declaration can't run!
because i thought the VB API Viewer should be the official resource of API
declaration. Should i trust the VB API Viewer anymore?
i also have an PSDK august 2001 edition.
BOOL CreateProcess(
LPCTSTR lpApplicationName, // name of executable module
LPTSTR lpCommandLine, // command line string
LPSECURITY_ATTRIBUTES lpProcessAttributes, // SD
LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
BOOL bInheritHandles, // handle inheritance option
DWORD dwCreationFlags, // creation flags
LPVOID lpEnvironment, // new environment block
LPCTSTR lpCurrentDirectory, // current directory name
LPSTARTUPINFO lpStartupInfo, // startup information
LPPROCESS_INFORMATION lpProcessInformation // process information
);
according to this API, the declaration provided by the VB API Viewer SHOULD
be correct, but WHY it can't runs ???
as a vbVeryBeginner, i hope this won't discourage me...:)
sincerely hope somebody here in NG would love to explain to me...WHY...
thanks
- Next message: Tom Esh: "Re: CreateProcessA Lib "kernel32" problem"
- Previous message: Mike D Sutton: "Re: Stretch Icons"
- In reply to: vbVeryBeginner: "CreateProcessA Lib "kernel32" problem"
- Next in thread: J French: "Re: CreateProcessA Lib "kernel32" problem"
- Reply: J French: "Re: CreateProcessA Lib "kernel32" problem"
- Reply: vbVeryBeginner: "Re: CreateProcessA Lib "kernel32" problem"
- Reply: Randy Birch: "Re: CreateProcessA Lib "kernel32" problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|