Help with launch a program from desktop to device (RAPI, cecreateprocess) 
Author Message
 Help with launch a program from desktop to device (RAPI, cecreateprocess)

Hi everyone,

I need some help to figure how to launch .vb program from the desktop.  I am
currently using RAPI to connect and copy some files from the desktop to the
device.  I am trying to launch a vb. I am currently using VB6 and
cecreateprocess but it doesn't work.  It always return 0 and no process was
launch on the device.

Declare Function CeCreateProcess Lib "rapi.dll" _
(ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As Long, lpProcessInfo As Long) As Long

Iit doesn't do nothing.

Public Declare Function CeCreateProcess Lib "coredll" Alias "CreateProcessW"
_
(ByVal lpApplicationName As String, _
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, _
ByVal lpStartupInfo As Long, _
ByVal lpProcessInformation As Long) As Long

If I use the code above it complains about "file not found coredll"

setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

First, can it it be done? is this the right API?  Thanks for any help



Sat, 16 Apr 2005 22:54:38 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
Do you get an error code?  What error code?

Your second declaration is clearly wrong, since CreateProcessW would try to
launch the program on the PC side, where there is, of course, no coredll.

Paul T.


Quote:

> Hi everyone,

> I need some help to figure how to launch .vb program from the desktop.  I
am
> currently using RAPI to connect and copy some files from the desktop to
the
> device.  I am trying to launch a vb. I am currently using VB6 and
> cecreateprocess but it doesn't work.  It always return 0 and no process
was
> launch on the device.

> Declare Function CeCreateProcess Lib "rapi.dll" _
> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> lpStartupInfo As Long, lpProcessInfo As Long) As Long

> Iit doesn't do nothing.

> Public Declare Function CeCreateProcess Lib "coredll" Alias
"CreateProcessW"
> _
> (ByVal lpApplicationName As String, _
> 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, _
> ByVal lpStartupInfo As Long, _
> ByVal lpProcessInformation As Long) As Long

> If I use the code above it complains about "file not found coredll"

> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

> First, can it it be done? is this the right API?  Thanks for any help



Sat, 16 Apr 2005 23:03:10 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
Thanks for replying...

I guess I need to add the getlasterror API to my program to see what
it returns.  Is  rapi.dll is for PC to Device where coredll.dll is for
PC to emulator, correct?

On Tue, 29 Oct 2002 08:03:10 -0700, "Paul G. Tobey [eMVP]"

Quote:

>Do you get an error code?  What error code?

>Your second declaration is clearly wrong, since CreateProcessW would try to
>launch the program on the PC side, where there is, of course, no coredll.

>Paul T.



>> Hi everyone,

>> I need some help to figure how to launch .vb program from the desktop.  I
>am
>> currently using RAPI to connect and copy some files from the desktop to
>the
>> device.  I am trying to launch a vb. I am currently using VB6 and
>> cecreateprocess but it doesn't work.  It always return 0 and no process
>was
>> launch on the device.

>> Declare Function CeCreateProcess Lib "rapi.dll" _
>> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
>> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
>> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
>> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
>> lpStartupInfo As Long, lpProcessInfo As Long) As Long

>> Iit doesn't do nothing.

>> Public Declare Function CeCreateProcess Lib "coredll" Alias
>"CreateProcessW"
>> _
>> (ByVal lpApplicationName As String, _
>> 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, _
>> ByVal lpStartupInfo As Long, _
>> ByVal lpProcessInformation As Long) As Long

>> If I use the code above it complains about "file not found coredll"

>> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

>> First, can it it be done? is this the right API?  Thanks for any help



Sun, 17 Apr 2005 09:05:41 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
rapi.dll is a DLL which resides on the PC side.  That's the only one you can
talk to from your PC-side program.  We don't build RAPI support into our
devices, so there may actually be a rapi.dll on the device, also; I can't be
sure about that.

coredll.dll is one of many DLLs on the device.  It contains much of the
Win32 API implementation for Windows CE.

Paul T.


Quote:
> Thanks for replying...

> I guess I need to add the getlasterror API to my program to see what
> it returns.  Is  rapi.dll is for PC to Device where coredll.dll is for
> PC to emulator, correct?

> On Tue, 29 Oct 2002 08:03:10 -0700, "Paul G. Tobey [eMVP]"

> >Do you get an error code?  What error code?

> >Your second declaration is clearly wrong, since CreateProcessW would try
to
> >launch the program on the PC side, where there is, of course, no coredll.

> >Paul T.



> >> Hi everyone,

> >> I need some help to figure how to launch .vb program from the desktop.
I
> >am
> >> currently using RAPI to connect and copy some files from the desktop to
> >the
> >> device.  I am trying to launch a vb. I am currently using VB6 and
> >> cecreateprocess but it doesn't work.  It always return 0 and no process
> >was
> >> launch on the device.

> >> Declare Function CeCreateProcess Lib "rapi.dll" _
> >> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> >> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> >> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> >> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> >> lpStartupInfo As Long, lpProcessInfo As Long) As Long

> >> Iit doesn't do nothing.

> >> Public Declare Function CeCreateProcess Lib "coredll" Alias
> >"CreateProcessW"
> >> _
> >> (ByVal lpApplicationName As String, _
> >> 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, _
> >> ByVal lpStartupInfo As Long, _
> >> ByVal lpProcessInformation As Long) As Long

> >> If I use the code above it complains about "file not found coredll"

> >> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

> >> First, can it it be done? is this the right API?  Thanks for any help



Mon, 18 Apr 2005 02:35:45 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
Rapi.dll is builtin to ActiveSync.  I am using rapi.dll currently to
copy files from desktop to device and vice versa.  I am just having
problem launch a process.  I am getting error 87 from GetLastError.  I
am building the lpProcessInfo variable according to MSDN/technet,
Call
cecreateprocess("\windows\pvbload.exe","\windows\SetClockTime.vb",...)

I know the both files are there.  Something about invalid parameter
found on deja.com.

must be something wrong with my code.

Thanks for the help -

On Wed, 30 Oct 2002 11:35:45 -0700, "Paul G. Tobey [eMVP]"

Quote:

>rapi.dll is a DLL which resides on the PC side.  That's the only one you can
>talk to from your PC-side program.  We don't build RAPI support into our
>devices, so there may actually be a rapi.dll on the device, also; I can't be
>sure about that.

>coredll.dll is one of many DLLs on the device.  It contains much of the
>Win32 API implementation for Windows CE.

>Paul T.



>> Thanks for replying...

>> I guess I need to add the getlasterror API to my program to see what
>> it returns.  Is  rapi.dll is for PC to Device where coredll.dll is for
>> PC to emulator, correct?

>> On Tue, 29 Oct 2002 08:03:10 -0700, "Paul G. Tobey [eMVP]"

>> >Do you get an error code?  What error code?

>> >Your second declaration is clearly wrong, since CreateProcessW would try
>to
>> >launch the program on the PC side, where there is, of course, no coredll.

>> >Paul T.



>> >> Hi everyone,

>> >> I need some help to figure how to launch .vb program from the desktop.
>I
>> >am
>> >> currently using RAPI to connect and copy some files from the desktop to
>> >the
>> >> device.  I am trying to launch a vb. I am currently using VB6 and
>> >> cecreateprocess but it doesn't work.  It always return 0 and no process
>> >was
>> >> launch on the device.

>> >> Declare Function CeCreateProcess Lib "rapi.dll" _
>> >> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
>> >> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
>> >> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
>> >> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
>> >> lpStartupInfo As Long, lpProcessInfo As Long) As Long

>> >> Iit doesn't do nothing.

>> >> Public Declare Function CeCreateProcess Lib "coredll" Alias
>> >"CreateProcessW"
>> >> _
>> >> (ByVal lpApplicationName As String, _
>> >> 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, _
>> >> ByVal lpStartupInfo As Long, _
>> >> ByVal lpProcessInformation As Long) As Long

>> >> If I use the code above it complains about "file not found coredll"

>> >> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

>> >> First, can it it be done? is this the right API?  Thanks for any help



Mon, 18 Apr 2005 08:39:42 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
  I am just having problem launch a process.  I am getting error 87
from GetLastError.  I am building the lpProcessInfo variable according
to MSDN/technet but still no luck.

Quote:
>16 bytes, so thats how big your byte array should be. you may want to close
>the returned handles from this structure when you are done.

What do you mean by this?

Thanks for the help -

On Wed, 30 Oct 2002 10:49:13 -0800, "P Trevizo"

Quote:

>Your declaration:

>Declare Function CeCreateProcess Lib "rapi.dll" _
>(ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
>ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
>ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
>lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
>lpStartupInfo As Long, lpProcessInfo As Long) As Long

>This looks ok. If you want to launch a .vb app, you must not use the
>path+file of the .vb file to launch it, but use pvbload.exe. You pass your
>.vb as the arguments.

>CeCreateProcess( "\windows\pvbload.exe", "\Program Files\MyApp\MyApp.vb",
>NULL, NULL, FALSE, NULL, NULL, NULL, NULL, arrProcInfo)

>The arrProcInfo is a structure that is filled with data that you will need
>to create. Since you are using VB, you will need a kind of byte array and a
>pointer to it to pass to the function.  The PROCESS_INFORMATION looks to be
>16 bytes, so thats how big your byte array should be. you may want to close
>the returned handles from this structure when you are done.

>-P



>> Hi everyone,

>> I need some help to figure how to launch .vb program from the desktop.  I
>am
>> currently using RAPI to connect and copy some files from the desktop to
>the
>> device.  I am trying to launch a vb. I am currently using VB6 and
>> cecreateprocess but it doesn't work.  It always return 0 and no process
>was
>> launch on the device.

>> Declare Function CeCreateProcess Lib "rapi.dll" _
>> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
>> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
>> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
>> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
>> lpStartupInfo As Long, lpProcessInfo As Long) As Long

>> Iit doesn't do nothing.

>> Public Declare Function CeCreateProcess Lib "coredll" Alias
>"CreateProcessW"
>> _
>> (ByVal lpApplicationName As String, _
>> 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, _
>> ByVal lpStartupInfo As Long, _
>> ByVal lpProcessInformation As Long) As Long

>> If I use the code above it complains about "file not found coredll"

>> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

>> First, can it it be done? is this the right API?  Thanks for any help



Mon, 18 Apr 2005 08:39:44 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
Your declaration:

Declare Function CeCreateProcess Lib "rapi.dll" _
(ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
lpStartupInfo As Long, lpProcessInfo As Long) As Long

This looks ok. If you want to launch a .vb app, you must not use the
path+file of the .vb file to launch it, but use pvbload.exe. You pass your
.vb as the arguments.

CeCreateProcess( "\windows\pvbload.exe", "\Program Files\MyApp\MyApp.vb",
NULL, NULL, FALSE, NULL, NULL, NULL, NULL, arrProcInfo)

The arrProcInfo is a structure that is filled with data that you will need
to create. Since you are using VB, you will need a kind of byte array and a
pointer to it to pass to the function.  The PROCESS_INFORMATION looks to be
16 bytes, so thats how big your byte array should be. you may want to close
the returned handles from this structure when you are done.

-P


Quote:

> Hi everyone,

> I need some help to figure how to launch .vb program from the desktop.  I
am
> currently using RAPI to connect and copy some files from the desktop to
the
> device.  I am trying to launch a vb. I am currently using VB6 and
> cecreateprocess but it doesn't work.  It always return 0 and no process
was
> launch on the device.

> Declare Function CeCreateProcess Lib "rapi.dll" _
> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> lpStartupInfo As Long, lpProcessInfo As Long) As Long

> Iit doesn't do nothing.

> Public Declare Function CeCreateProcess Lib "coredll" Alias
"CreateProcessW"
> _
> (ByVal lpApplicationName As String, _
> 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, _
> ByVal lpStartupInfo As Long, _
> ByVal lpProcessInformation As Long) As Long

> If I use the code above it complains about "file not found coredll"

> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

> First, can it it be done? is this the right API?  Thanks for any help



Mon, 18 Apr 2005 02:49:13 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
In C/C++, you would call CeCreateProcess with a valid structure as the last
paramater (lpProcesInfo as Long). What are you putting in this last
parameter? If you are passing NULL, I don't think it will work.  In C/C++,
this is the prototype:

BOOL CeCreateProcess(
LPCWSTR lpApplicationName,
LPCWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPWSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation );

the PROCESS_INFORMATION structucture is defined as :

typedef struct _PROCESS_INFORMATION

HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;

Quote:
} PROCESS_INFORMATION;

If you are not familiar with C, then that probably doesn't make much sense.
But that structure is just a linear array of data in memory. I believe
DWORDs and HANDLEs are 4 bytes each, so thats where the 16 bytes comes from.
The function needs a valid pointer to memory of exactly this size to be
passed as the last paramater( LPPROCESS_INFORMATION lpProcessInformation, )
How do you do this? I'm not too familiar with VB, but I recall somewhere
that you can dynamically allocate an array of bytes, take a pointer to the
start of the array, and pass it into your function call.  I think there is
even some help-code somewhere that would show you how to do this, I can't
remember where it is offhand though (I rarely program in VB). Perhaps
someone else here has some experience in creating structures for API calls
in VB.

-P


Quote:
>   I am just having problem launch a process.  I am getting error 87
> from GetLastError.  I am building the lpProcessInfo variable according
> to MSDN/technet but still no luck.

> >16 bytes, so thats how big your byte array should be. you may want to
close
> >the returned handles from this structure when you are done.
> What do you mean by this?

> Thanks for the help -

> On Wed, 30 Oct 2002 10:49:13 -0800, "P Trevizo"

> >Your declaration:

> >Declare Function CeCreateProcess Lib "rapi.dll" _
> >(ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> >ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> >ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> >lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> >lpStartupInfo As Long, lpProcessInfo As Long) As Long

> >This looks ok. If you want to launch a .vb app, you must not use the
> >path+file of the .vb file to launch it, but use pvbload.exe. You pass
your
> >.vb as the arguments.

> >CeCreateProcess( "\windows\pvbload.exe", "\Program Files\MyApp\MyApp.vb",
> >NULL, NULL, FALSE, NULL, NULL, NULL, NULL, arrProcInfo)

> >The arrProcInfo is a structure that is filled with data that you will
need
> >to create. Since you are using VB, you will need a kind of byte array and
a
> >pointer to it to pass to the function.  The PROCESS_INFORMATION looks to
be
> >16 bytes, so thats how big your byte array should be. you may want to
close
> >the returned handles from this structure when you are done.

> >-P



> >> Hi everyone,

> >> I need some help to figure how to launch .vb program from the desktop.
I
> >am
> >> currently using RAPI to connect and copy some files from the desktop to
> >the
> >> device.  I am trying to launch a vb. I am currently using VB6 and
> >> cecreateprocess but it doesn't work.  It always return 0 and no process
> >was
> >> launch on the device.

> >> Declare Function CeCreateProcess Lib "rapi.dll" _
> >> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> >> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> >> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> >> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> >> lpStartupInfo As Long, lpProcessInfo As Long) As Long

> >> Iit doesn't do nothing.

> >> Public Declare Function CeCreateProcess Lib "coredll" Alias
> >"CreateProcessW"
> >> _
> >> (ByVal lpApplicationName As String, _
> >> 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, _
> >> ByVal lpStartupInfo As Long, _
> >> ByVal lpProcessInformation As Long) As Long

> >> If I use the code above it complains about "file not found coredll"

> >> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

> >> First, can it it be done? is this the right API?  Thanks for any help



Mon, 18 Apr 2005 09:57:22 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
Since NULL is actually 0, and the last parameter is unsupported in CE, it
shouldn't be a problem.  Error 87 almost always means that the API
declaration is incorrect, often the something is being passes ByVal when it
should be ByRef or vice-versa.

I've not got working code in front of me for validation, but I'd look at 2
things.

First, your process and thread attributes are being passed byval, while the
API requests a pointer to a struct. Though they're unsupported, you should
be passing zero (NULL) to them, but possibly it should be byref, not byval.

If that doesn't work, try changing all of your strings to ByRef.

--
Chris Tacke, eMVP
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


Quote:
> In C/C++, you would call CeCreateProcess with a valid structure as the
last
> paramater (lpProcesInfo as Long). What are you putting in this last
> parameter? If you are passing NULL, I don't think it will work.  In C/C++,
> this is the prototype:

> BOOL CeCreateProcess(
> LPCWSTR lpApplicationName,
> LPCWSTR lpCommandLine,
> LPSECURITY_ATTRIBUTES lpProcessAttributes,
> LPSECURITY_ATTRIBUTES lpThreadAttributes,
> BOOL bInheritHandles,
> DWORD dwCreationFlags,
> LPVOID lpEnvironment,
> LPWSTR lpCurrentDirectory,
> LPSTARTUPINFO lpStartupInfo,
> LPPROCESS_INFORMATION lpProcessInformation );

> the PROCESS_INFORMATION structucture is defined as :

> typedef struct _PROCESS_INFORMATION

> HANDLE hProcess;
> HANDLE hThread;
> DWORD dwProcessId;
> DWORD dwThreadId;
> } PROCESS_INFORMATION;

> If you are not familiar with C, then that probably doesn't make much
sense.
> But that structure is just a linear array of data in memory. I believe
> DWORDs and HANDLEs are 4 bytes each, so thats where the 16 bytes comes
from.
> The function needs a valid pointer to memory of exactly this size to be
> passed as the last paramater( LPPROCESS_INFORMATION

lpProcessInformation, )

- Show quoted text -

Quote:
> How do you do this? I'm not too familiar with VB, but I recall somewhere
> that you can dynamically allocate an array of bytes, take a pointer to the
> start of the array, and pass it into your function call.  I think there is
> even some help-code somewhere that would show you how to do this, I can't
> remember where it is offhand though (I rarely program in VB). Perhaps
> someone else here has some experience in creating structures for API calls
> in VB.

> -P



> >   I am just having problem launch a process.  I am getting error 87
> > from GetLastError.  I am building the lpProcessInfo variable according
> > to MSDN/technet but still no luck.

> > >16 bytes, so thats how big your byte array should be. you may want to
> close
> > >the returned handles from this structure when you are done.
> > What do you mean by this?

> > Thanks for the help -

> > On Wed, 30 Oct 2002 10:49:13 -0800, "P Trevizo"

> > >Your declaration:

> > >Declare Function CeCreateProcess Lib "rapi.dll" _
> > >(ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> > >ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> > >ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> > >lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> > >lpStartupInfo As Long, lpProcessInfo As Long) As Long

> > >This looks ok. If you want to launch a .vb app, you must not use the
> > >path+file of the .vb file to launch it, but use pvbload.exe. You pass
> your
> > >.vb as the arguments.

> > >CeCreateProcess( "\windows\pvbload.exe", "\Program

Files\MyApp\MyApp.vb",

- Show quoted text -

Quote:
> > >NULL, NULL, FALSE, NULL, NULL, NULL, NULL, arrProcInfo)

> > >The arrProcInfo is a structure that is filled with data that you will
> need
> > >to create. Since you are using VB, you will need a kind of byte array
and
> a
> > >pointer to it to pass to the function.  The PROCESS_INFORMATION looks
to
> be
> > >16 bytes, so thats how big your byte array should be. you may want to
> close
> > >the returned handles from this structure when you are done.

> > >-P



> > >> Hi everyone,

> > >> I need some help to figure how to launch .vb program from the
desktop.
> I
> > >am
> > >> currently using RAPI to connect and copy some files from the desktop
to
> > >the
> > >> device.  I am trying to launch a vb. I am currently using VB6 and
> > >> cecreateprocess but it doesn't work.  It always return 0 and no
process
> > >was
> > >> launch on the device.

> > >> Declare Function CeCreateProcess Lib "rapi.dll" _
> > >> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> > >> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long,
_
> > >> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> > >> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> > >> lpStartupInfo As Long, lpProcessInfo As Long) As Long

> > >> Iit doesn't do nothing.

> > >> Public Declare Function CeCreateProcess Lib "coredll" Alias
> > >"CreateProcessW"
> > >> _
> > >> (ByVal lpApplicationName As String, _
> > >> 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, _
> > >> ByVal lpStartupInfo As Long, _
> > >> ByVal lpProcessInformation As Long) As Long

> > >> If I use the code above it complains about "file not found coredll"

> > >> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

> > >> First, can it it be done? is this the right API?  Thanks for any help



Mon, 18 Apr 2005 22:37:12 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
According to the help file that came with the SDK, the last parameter
is needed but I  will try it out with null.

Thanks for the info

On Thu, 31 Oct 2002 09:37:12 -0500, "Chris Tacke, eMVP"

Quote:

>Since NULL is actually 0, and the last parameter is unsupported in CE, it
>shouldn't be a problem.  Error 87 almost always means that the API
>declaration is incorrect, often the something is being passes ByVal when it
>should be ByRef or vice-versa.

>I've not got working code in front of me for validation, but I'd look at 2
>things.

>First, your process and thread attributes are being passed byval, while the
>API requests a pointer to a struct. Though they're unsupported, you should
>be passing zero (NULL) to them, but possibly it should be byref, not byval.

>If that doesn't work, try changing all of your strings to ByRef.



Wed, 20 Apr 2005 10:08:41 GMT  
 Help with launch a program from desktop to device (RAPI, cecreateprocess)
Thanks for everyone's help.  I got it working finally.

the key is vbUnicode, and null for the last parameter.

Declare Function CeCreateProcess Lib "rapi.dll" _
(ByVal lpApplicationName As String, _
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, _
ByVal lpStartupInfo As Long, _
ByVal lpProcessInfo As Long) As Long

AppName="\Windows\calc.exe"
Lret = CeCreateProcess(StrConv(AppName, vbUnicode), "", 0, 0, 0, 0, 0, 0, 0,
0)
MsgBox "Error " & CeGetLastError & " during launching remote process"


Quote:

> Hi everyone,

> I need some help to figure how to launch .vb program from the desktop.  I
am
> currently using RAPI to connect and copy some files from the desktop to
the
> device.  I am trying to launch a vb. I am currently using VB6 and
> cecreateprocess but it doesn't work.  It always return 0 and no process
was
> launch on the device.

> Declare Function CeCreateProcess Lib "rapi.dll" _
> (ByVal lpApplicationName As String, ByVal lpCommandLine As String, _
> ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
> ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
> lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
> lpStartupInfo As Long, lpProcessInfo As Long) As Long

> Iit doesn't do nothing.

> Public Declare Function CeCreateProcess Lib "coredll" Alias
"CreateProcessW"
> _
> (ByVal lpApplicationName As String, _
> 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, _
> ByVal lpStartupInfo As Long, _
> ByVal lpProcessInformation As Long) As Long

> If I use the code above it complains about "file not found coredll"

> setup: VB6, SDK pocket PC2002, activesync 3.5, iPAq, newbie at this.

> First, can it it be done? is this the right API?  Thanks for any help



Thu, 21 Apr 2005 02:31:22 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Launch PPC2002 program from Desktop machine

2. How to use RAPI (rapi.dll) ?

3. Starting paint program with specific image using CeCreateProcess(..)

4. Copy file from Desktop to CE device using VB? RAPI?

5. Copy cdb from device to desktop and remain cdb

6. uninstall from the device left the folder on desktop m/c undeleted

7. Transfer of string from device to desktop

8. How to code a copy of files from Device to Desktop

9. transfering files from device to desktop

10. copy text file from desktop to device?

11. File Copy: Desktop to Device

12. !!!!!!!!!!!HELP - Launching External Programs - URGENT!!!!!!!!!!

 

 
Powered by phpBB® Forum Software