Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using GetNearestColor
Using the Semaphore object to allow only one instance of VFP application running
Winsock: reading and setting socket options
Converting an integer value to a hexadecimal string
Displaying printer-properties Property Sheet for the specified printer
Extracting the name and extension parts of a path string
GDI+: printing vertical text on VFP reports via generated images (VFP8)
How to browse and connect to printers on a network (WinNT)
How to retrieve network parameters for the local computer (including Host name, Domain name, and DNS Server)
Setting properties of the window: caption and user-defined value
Simple Window Viewer
Starting a dialog box for connecting to network resources and passing input parameters
Starting external program from VFP and waiting for its termination
Using mailslots to send messages on the network
Winsock: connecting to a news server (NNTP, port 119)
Creating a clipping region from the path selected into the device context of a form
Drawing a window caption using the DrawCaption routine
Enumerating connections made to a shared resource for the local computer (WinNT only)
Enumerating network interfaces on the local computer
How to extract frames from AVI files
Obtaining names and positions for shortcuts located on the Windows Desktop
Retrieving long values associated with the class of the VFP window
Switching between keyboard layouts
The original LoadPicture() function in VFP returns valid handles to bitmaps, icons, cursors, and metafiles
PocketPC: custom RAPI class for executing routines on remote Windows CE device

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
The class calls CeCreateProcess RAPI function to create new process on PocketPC device. The new process executes the specified executable file.


Use the following code to test
TRapiExec class:

LOCAL rapi As TRapiExec
rapi = CREATEOBJECT("TRapiExec")
IF NOT rapi.Connected
        = MESSAGEBOX("Could not detect connection " +;
                "to Windows CE device. ", 48, "Not connected")
        RETURN
ENDIF
IF NOT rapi.RunApp("\Windows\Notes.exe",;
                "\My Documents\Personal\test.txt")
        = MESSAGEBOX("Error code: " + TRANSFORM(rapi.errorcode) +;
                " (" + TRANSFORM(rapi.errorcode, "@0") +;
                ") ", 48, "Error")
ENDIF

 
  Members area. Log in to view this example.
 
  User name:
  Password:
 
 
  Forgot your password?
 
  Sign up for
the Membership
 
 


User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2570 bytes  
Created: 2004-08-13 09:26:22  
Modified: 2011-12-10 09:20:22  
Visits in 7 days: 57  
Listed functions:
CeCloseHandle
CeCreateProcess
CeGetLastError
CeRapiGetError
CeRapiInitEx
CeRapiInvoke
CeRapiUninit
WaitForSingleObject
Printer friendly API declarations
My comment:
RunApp method of the class accepts two parameters: AppName and CommandLine.

Try the code calling various executables located inside \Windows directory on your PocketPC: Notes.exe, pxl.exe, sndplay.exe, tasks.exe, iexplore.exe, pword.exe etc.

* * *
At this point I am not aware how to terminate a remote process. There might be a way, I think, by using the CeRapiInvoke.

* * *
CeRapiInvoke function, I am still struggling with, can be used to remotely execute routines in DLLs stored on Window CE device. This function accepts DLL and function names as parameters, as well as buffer with input parameters for the remote call and buffer for output parameters.

So far I was successful only in calling functions, which do not require input parameters, like Random and GetProcessHeap (both located in Coredll.dll) and similar to them. Hopefully I will be able to add this functionality to the class some time later.

* * *
This is how to create new email message on your Pocket PC:
cApp="\Windows\tmail.exe"
cCmd=[-TO "info@yourcompany.com" -SUBJECT "Test message" ] +;
        [-BODY "Wake up!"]
rapi.RunApp(cApp, cCmd)

Note that the message will be stored in Drafts folder, not sent. Use other command line options: -CC, -BCC, -ATTACHMENT.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
dallgood@iservtexas.com | 2006-08-11 15:10:16
Would there be a way to have RunApp wait until the launched application was finished and closed. I played with trying to use WaitForSingleObject, but could not make it work. Thanks!

Copyright 2001-2014 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.68), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.196.119.93)
1 day(s)Function: 'GdipGetDpiX'
Function group: 'GDI+ Graphics'
4 day(s)Function: 'CreateWindow'
Function group: 'Window'
 
Function group: 'Windows Sockets 2 (Winsock)'
 Example: 'Reading keys in the specified section of the Win.ini file'
 Example: 'GDI+: how to make VFP controls visually shake and shudder'
 Function: 'NetShareAdd'
Function group: 'Network Management'
 Function: 'PlaySound'
Function group: 'Windows Multimedia'
 Function: 'NetUserGetLocalGroups'
Function group: 'Network Management'
 Example: 'Pocket PC: base class'
Google
Advertise here!