CeCreateProcess 
Author Message
 CeCreateProcess

Hi,

I'm currently using CeCreateProcess to create a new process from my VB
app. For example,

    a = CeCreateProcess("\windows\player.exe", _
        "\My Documents\Music.mp3", 0, 0, 0, _
        0, 0, 0, 0, sPROCESS_INFORMATION)

The problem with this is that this process then appears on the screen
and I have to manually get back control using a call to
SetForegroundWindow. This causes a {*filter*} flicker. Can I create this
new process 'in the background'. I tried using the CREATE_NO_WINDOW
flag, thus:

    a = CeCreateProcess("\windows\player.exe", _
        "\My Documents\Music.mp3", 0, 0, 0, _
        CREATE_NO_WINDOW, _
        0, 0, 0, sPROCESS_INFORMATION)

But the process doesn't start now. Can anyone help?

Alternatively, if anyone knows of a control that I can use, it would
be greatly appreciated.

Thanks in advance, Lincoln



Wed, 21 Apr 2004 11:23:19 GMT  
 CeCreateProcess
Hey Lincoln,

The  CREATE_NO_WINDOW flag is only for console applications on the desktop.
 This isn't going to work in CE.  Also, I believe that on the desktop, the
ability to launch a process without a window being visible would normally
be done with the psiStartInfo parameter of CreateProcess.  This paramter
also isn't supported in CE.

If I understand the whole hierarchy correctly, on the desktop
LPSTARTUPINFOW is a pointer to the STARTUPINFO structure.  The STARTUPINFO
structure has a parameter called dwFlags which, if set to
STARTF_USESHOWWINDOW, will then look to the wShowWindow parameter.  (if
STARTF_USESHOWWINDOW is not set, wShowWindow is ignored).  wShowWindow will
cause ShowWindow to be called the first time a window is to be displayed.  
The second parameter of ShowWindow is nCmdShow, which can be set to SW_HIDE.

Of course, this is all irrelevant since:
1. psiStartInfo is not supported in CE
2. Even if it was supported, these structures would be a nightmare to code
in eVB.

If you were calling another eVB application, you could always make it
Windowless, but it looks like you want to cal the MediaPlayer.  
Unfortunately, I can't think of a way to handle this.

-mike

This posting is provided AS IS with no warranties, and confers no rights.



Tue, 27 Apr 2004 04:17:22 GMT  
 CeCreateProcess

Quote:

> Hi,

> I'm currently using CeCreateProcess to create a new process from my VB
> app. For example,

>     a = CeCreateProcess("\windows\player.exe", _
>         "\My Documents\Music.mp3", 0, 0, 0, _
>         0, 0, 0, 0, sPROCESS_INFORMATION)

> The problem with this is that this process then appears on the screen
> and I have to manually get back control using a call to
> SetForegroundWindow. This causes a {*filter*} flicker. Can I create this
> new process 'in the background'. I tried using the CREATE_NO_WINDOW
> flag, thus:

>     a = CeCreateProcess("\windows\player.exe", _
>         "\My Documents\Music.mp3", 0, 0, 0, _
>         CREATE_NO_WINDOW, _
>         0, 0, 0, sPROCESS_INFORMATION)

> But the process doesn't start now. Can anyone help?

> Alternatively, if anyone knows of a control that I can use, it would
> be greatly appreciated.

> Thanks in advance, Lincoln

For anyone that's interested, I ended up not using the Media Player
(because of the awful flicker and the problems associated with
terminating it when I wanted to stop the music) and am now using the
PlaySound API, thus:

Public Declare Function PlaySound Lib "Coredll" _
               Alias "PlaySoundW" (ByVal lpszName As String, _
                                   ByVal hModule As Long, _
                                   ByVal dwFlags As Long) As Long
Const SND_ASYNC = &H1

To start:
PlaySound("\file.wav", &O0, SND_ASYNC)

To stop:
PlaySound(&0O, &O0, SND_ASYNC)

The only problem I had was that the stop sound worked on the emulator,
but not on the actual device, so I generated a blank wav file and used
that to stop the music.

Cheers, Lincoln.



Tue, 27 Apr 2004 09:41:49 GMT  
 CeCreateProcess


Fri, 19 Jun 1992 00:00:00 GMT  
 CeCreateProcess

Quote:
> Hey Lincoln,

> The  CREATE_NO_WINDOW flag is only for console applications on the desktop.
>  This isn't going to work in CE.  Also, I believe that on the desktop, the
> ability to launch a process without a window being visible would normally
> be done with the psiStartInfo parameter of CreateProcess.  This paramter
> also isn't supported in CE.

> If I understand the whole hierarchy correctly, on the desktop
> LPSTARTUPINFOW is a pointer to the STARTUPINFO structure.  The STARTUPINFO
> structure has a parameter called dwFlags which, if set to
> STARTF_USESHOWWINDOW, will then look to the wShowWindow parameter.  (if
> STARTF_USESHOWWINDOW is not set, wShowWindow is ignored).  wShowWindow will
> cause ShowWindow to be called the first time a window is to be displayed.  
> The second parameter of ShowWindow is nCmdShow, which can be set to SW_HIDE.

> Of course, this is all irrelevant since:
> 1. psiStartInfo is not supported in CE
> 2. Even if it was supported, these structures would be a nightmare to code
> in eVB.

> If you were calling another eVB application, you could always make it
> Windowless, but it looks like you want to cal the MediaPlayer.  
> Unfortunately, I can't think of a way to handle this.

> -mike

> This posting is provided AS IS with no warranties, and confers no rights.

..


Sat, 01 May 2004 07:02:37 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CeCreateProcess sample code

2. Help with launch a program from desktop to device (RAPI, cecreateprocess)

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

 

 
Powered by phpBB® Forum Software