I'm trying to call down into the CreateProcess Windows API from eVB but I
can't make a valid declaration:

Option Explicit
Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type

Declare Function CreateProcessA Lib "kernel32" _
(ByVal lpApplicationName As Long, _
ByVal lpCommandLine As String, _
ByVal lpProcessAttributes As Long, _
ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, _
ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, _
ByVal lpCurrentDirectory As Long, _
ByRef si As Long, _
ByRef pi As PROCESS_INFORMATION) As Long

I get an error at compile time saying you can't have User-defined types (ie
the PROCESS_INFORMATION argument) inside an API declaration. So how do you
do this in eVB? This works fine in VB.Net, with PROCESS_INFORMATION defined
as a class.

--
Tim

Re: Can't call some WinAPIs from eVB? by The

The
Wed Feb 04 18:25:06 CST 2004

> I'm trying to call down into the CreateProcess Windows API from eVB but I
> can't make a valid declaration:
>
> Option Explicit
> Type PROCESS_INFORMATION
> hProcess As Long
> hThread As Long
> dwProcessID As Long
> dwThreadID As Long
> End Type
>
> Declare Function CreateProcessA Lib "kernel32" _
> (ByVal lpApplicationName As Long, _
> ByVal lpCommandLine As String, _
> ByVal lpProcessAttributes As Long, _
> ByVal lpThreadAttributes As Long, _
> ByVal bInheritHandles As Long, _
> ByVal dwCreationFlags As Long, _
> ByVal lpEnvironment As Long, _
> ByVal lpCurrentDirectory As Long, _
> ByRef si As Long, _
> ByRef pi As PROCESS_INFORMATION) As Long
>
> I get an error at compile time saying you can't have User-defined types
(ie
> the PROCESS_INFORMATION argument) inside an API declaration.

You cannot use types at all.

> So how do you do this in eVB?

You have to use a string instead. Not pretty (or easy) but it works.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.574 / Virus Database: 364 - Release Date: 30/01/04



Re: Can't call some WinAPIs from eVB? by Roy

Roy
Thu Feb 05 10:17:57 CST 2004

Microsoft also has two KB articles that clarify the limitations of calling
APIs from eVb programs and how to work around them. Check out Q209014 Howo
call Windows CE APIs form VBCE or eVb, and Q265793 How to use the
CreateProcess API from eMbedded Visual Basic.

"Tim Johnson" <tjohnson@high-point.com> wrote in message
news:eUEx8n36DHA.3804@tk2msftngp13.phx.gbl...
> I'm trying to call down into the CreateProcess Windows API from eVB but I
> can't make a valid declaration:
>
> Option Explicit
> Type PROCESS_INFORMATION
> hProcess As Long
> hThread As Long
> dwProcessID As Long
> dwThreadID As Long
> End Type
>
> Declare Function CreateProcessA Lib "kernel32" _
> (ByVal lpApplicationName As Long, _
> ByVal lpCommandLine As String, _
> ByVal lpProcessAttributes As Long, _
> ByVal lpThreadAttributes As Long, _
> ByVal bInheritHandles As Long, _
> ByVal dwCreationFlags As Long, _
> ByVal lpEnvironment As Long, _
> ByVal lpCurrentDirectory As Long, _
> ByRef si As Long, _
> ByRef pi As PROCESS_INFORMATION) As Long
>
> I get an error at compile time saying you can't have User-defined types
(ie
> the PROCESS_INFORMATION argument) inside an API declaration. So how do
you
> do this in eVB? This works fine in VB.Net, with PROCESS_INFORMATION
defined
> as a class.
>
> --
> Tim
>
>



Re: Can't call some WinAPIs from eVB? by Tim

Tim
Thu Feb 05 14:01:24 CST 2004

That's exactly the info I needed - and as the previous response said, it's
ugly! Thanks.

--
Tim Johnson
High Point Software
www.high-point.com
(503) 312-8625
"Roy Soltoff" <royUNDO@CLEANmedicomp.com> wrote in message
news:exzX8MA7DHA.2560@TK2MSFTNGP09.phx.gbl...
> Microsoft also has two KB articles that clarify the limitations of calling
> APIs from eVb programs and how to work around them. Check out Q209014 Howo
> call Windows CE APIs form VBCE or eVb, and Q265793 How to use the
> CreateProcess API from eMbedded Visual Basic.
>
> "Tim Johnson" <tjohnson@high-point.com> wrote in message
> news:eUEx8n36DHA.3804@tk2msftngp13.phx.gbl...
> > I'm trying to call down into the CreateProcess Windows API from eVB but
I
> > can't make a valid declaration:
> >
> > Option Explicit
> > Type PROCESS_INFORMATION
> > hProcess As Long
> > hThread As Long
> > dwProcessID As Long
> > dwThreadID As Long
> > End Type
> >
> > Declare Function CreateProcessA Lib "kernel32" _
> > (ByVal lpApplicationName As Long, _
> > ByVal lpCommandLine As String, _
> > ByVal lpProcessAttributes As Long, _
> > ByVal lpThreadAttributes As Long, _
> > ByVal bInheritHandles As Long, _
> > ByVal dwCreationFlags As Long, _
> > ByVal lpEnvironment As Long, _
> > ByVal lpCurrentDirectory As Long, _
> > ByRef si As Long, _
> > ByRef pi As PROCESS_INFORMATION) As Long
> >
> > I get an error at compile time saying you can't have User-defined types
> (ie
> > the PROCESS_INFORMATION argument) inside an API declaration. So how do
> you
> > do this in eVB? This works fine in VB.Net, with PROCESS_INFORMATION
> defined
> > as a class.
> >
> > --
> > Tim
> >
> >
>
>