VBCE.com - The Premier Website For Visual Basic/CE Developers

 

*Dev Corner

Sample Code
Controls
Workarounds
Tips & Tricks
Q & A
Forums

*Goodies
Downloads
Software
Bookstore


*General
Home
What's New
General Info
Misc. Info


*News Worthy
News
Articles
Editorials
KB Articles
Reviews
Awards

*Miscellaneous
Web Links
Partners
Search
Feedback
Advertising

Sponsors


More...


API Example - Create Process

Download Code!With VBCE 6.0, you can now access the CE API!   Here is a simple example which shows how to shell to another application.   This is the same function which is used in the VBCEMisc Control.

api.gif (2046 bytes)

Place the following code in a MODULE:

Public Declare Function CreateProcess Lib "coredll.DLL" 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 String, _
     ByVal lpStartupInfo As Long, ByVal lpProcessInformation As Long) As Long

Const SUCCESS = 1

 

Now, add 2 text boxes, and one command button with the following click event code to a form:

Dim lRet As Long

'-- Shell off new process
lRet = CreateProcess(CStr(txtProcess.Text), _
CStr(txtCommandLine.Text), _
0, 0, False, 0, 0, "", 0, 0)

If lRet = SUCCESS Then
Me.Caption = "Success"
Else
Me.Caption = "Failure"
End If

 

VBCE.com is DevX Winner!

Unless otherwise noted, all information on VBCE.com is Copyright 1998 - 2002
Windows, Windows CE, and Visual Basic are trademarks of the Microsoft Corporation.
VBCE.com is not responsible for content on external sites.
Send all feedback to webmaster@vbce.com
Webmasters - feel free to link to
VBCE.com - Premier Website for Visual Basic/CE Development

Buy Books!