Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Enumerating data formats currently available on the clipboard
Custom GDI+ class
Mapping and disconnecting network drives
Winsock: sending email messages (SMTP, port 25)
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Converting Unicode data from the Clipboard to a character string using a given code page
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
Disk in drive A:
How to display the Properties dialog box for a file (ShellExecuteEx)
Enumerating network resources
Detecting changes in connections to removable drives (VFP9)
How to download a file from the FTP server using FtpGetFile
Using EnumPrinters function to enumerate locally installed printers
Using Font and Text functions
Splash Screen for the VFP application
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
How to play AVI file on the _screen
Retrieving the name of the network resource associated with a local device
Vertical Label control
Subclassing CommandButton control to create BackColor property
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
Creating a console window for Visual FoxPro application
Pocket PC: creating backup for the System Registry

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:
This code creates cursors csKeys and csValues and populates them with data retrieved from the System Registry of Pocket PC connected to your computer.

Start ActiveSync and establish connection with your Pocket PC before the testing.

The code is based on custom RAPI class. Download the class module first and save it in clsRapiReg.prg file.
 
SET PROCEDURE TO clsRapiReg ADDITIVE
#DEFINE HKEY_CLASSES_ROOT   0x80000000
#DEFINE HKEY_CURRENT_USER   0x80000001
#DEFINE HKEY_LOCAL_MACHINE  0x80000002
#DEFINE HKEY_USERS          0x80000003
 
LOCAL oRapi
oRapi = CREATEOBJECT("TrapiReg")
 
IF Not oRapi.Connected
    = MESSAGEBOX("Mobile device is unavailable.     ", 48, "Error")
ELSE
    oRapi.AddKey(HKEY_CLASSES_ROOT, 0, "MyDevice", "HKEY_CLASSES_ROOT")
    oRapi.AddKey(HKEY_CURRENT_USER, 0, "MyDevice", "HKEY_CURRENT_USER")
    oRapi.AddKey(HKEY_LOCAL_MACHINE, 0, "MyDevice", "HKEY_LOCAL_MACHINE")
    oRapi.AddKey(HKEY_USERS, 0, "MyDevice", "HKEY_USERS")
ENDIF
* end of main
 
DEFINE CLASS TRapiReg As Trapi
#DEFINE REG_SZ       1
#DEFINE REG_DWORD    4
#DEFINE REG_MULTI_SZ 7
 
PROCEDURE Init
    DODEFAULT()
    IF THIS.Connected
        CREATE CURSOR csKeys (keyid I AUTOINC, parentid I,;
            keyname C(100), keypath M)
        CREATE CURSOR csValues (keyid I, valuename C(100),;
            valuetype I, valuelen I,;
            valueint I, valuestr M, rawdata M)
    ENDIF
 
PROCEDURE AddKey(hRootKey, nParentId, cFullPath, cKeyName)
    LOCAL nKeyId, cPath, oKey, oSubkeys, oSubkey, oValue, vValue
 
    cPath = cFullPath + "\" + cKeyName
    ? cPath
    INSERT INTO csKeys (parentid, keyname, keypath);
    VALUES (nParentId, cKeyName, cPath)
    nKeyId = csKeys.keyid
 
    oKey = CREATEOBJECT("Tkey", hRootKey,;
        SUBSTR(cPath+"\", AT("\",cPath+"\",2)+1))
 
    IF oKey.OpenKey()
        * retrieve values for this key
        oKey.GetValues
        oKey.keyvalues.KeySort=2
        FOR EACH oValue IN oKey.keyvalues
            DO CASE
            CASE oValue.valuetype=REG_SZ OR oValue.valuetype=REG_MULTI_SZ
                vValue = STRCONV(oValue.valuerawdata,6)
                INSERT INTO csValues (keyid, valuename, valuetype,;
                    valuelen, valuestr, rawdata);
                    VALUES (nKeyId, oValue.valuename, oValue.valuetype,;
                    LEN(oValue.valuerawdata), vValue, oValue.valuerawdata)
 
            CASE oValue.valuetype=REG_DWORD
                vValue = buf2dword(oValue.valuerawdata)
                INSERT INTO csValues (keyid, valuename, valuetype,;
                    valuelen, valueint, rawdata);
                    VALUES (nKeyId, oValue.valuename, oValue.valuetype,;
                    LEN(oValue.valuerawdata), vValue, oValue.valuerawdata)
 
            OTHER
                INSERT INTO csValues (keyid, valuename, valuetype,;
                    valuelen, rawdata);
                    VALUES (nKeyId, oValue.valuename, oValue.valuetype,;
                    LEN(oValue.valuerawdata), oValue.valuerawdata)
            ENDCASE
        ENDFOR
 
        * retrieve subkeys for this keys - recursive call
        oSubkeys = CREATEOBJECT("Tkeys", oKey.hkey)
        oSubkeys.KeySort=2
        FOR EACH oSubkey IN oSubkeys
            THIS.AddKey(hRootKey, nKeyId, cPath, oSubkey.keyname)
        ENDFOR
    ENDIF
    RELEASE oKey
ENDDEFINE
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
2649 bytes  
Created: 2004-06-27 15:31:05  
Modified: 2009-02-15 19:28:47  
Visits in 7 days: 50  
Listed functions:
Printer friendly API declarations
My comment:
API functions used in the base class:
CeRapiInitEx
CeRapiUninit
CeRegCloseKey
CeRegCreateKeyEx
CeRegDeleteKey
CeRegDeleteValue
CeRegEnumKeyEx
CeRegEnumValue
CeRegOpenKeyEx
CeRegQueryInfoKey
CeRegSetValueEx
WaitForSingleObject

#kwd: sln_pocketpc.
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:
There are no notes on this subject.


Copyright © 2001-2013 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.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.234.231.49)
2.3 hrs.Links
Page 6
3.84 hrs.Example: 'Using the SetErrorMode for determining if a floppy drive is ready'
 Function: 'GdipCreateFromHWND'
Function group: 'GDI+ Graphics'
9.58 hrs.Function: 'CertFreeCertificateContext'
 Function: 'GetAsyncKeyState'
Function group: 'Keyboard Input'
 Example: 'How to display the Print property sheet'
12.39 hrs.Example: 'Retrieving configuration information for the specified server (Win2000/XP)'
 Example: 'How to retrieve version information for the specified file'
 Example: 'Creating a clipping region from the path selected into the device context of a form'
12.49 hrs.Example: 'Enumerating sessions established on a server'
Google
Advertise here!