Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving list of Global Atom names
Terminating VFP application using the FatalAppExit
Using GetSysColor
WAV file recorder
Changing pitch and speed of a wave file
Enumerating connections made to a shared resource for the local computer (WinNT only)
Pocket PC: enumerating mounted database volumes and databases in the Object Store
Retrieving the command line for the VFP session
Retrieving the name of the network resource associated with a local device
The SQLGetProp() creates a bridge between Visual FoxPro and the ODBC API
How to drag a Form not using its Titlebar or Caption
Pocket PC: retrieving data from the Contacts Database
Retrieving System Error message strings
String representation for disk or memory capacity
Using Multimedia Command Strings to play MIDI files
Basic Volume information
Memory usage info for current VFP session (WinNT only)
Retrieving information about all users currently logged on to the workstation (WinNT only)
How to retrieve information about a cache entry (Internet Explorer)
How to test file attributes (key method for FileExists and DirectoryExists routines)
Retrieving configuration information for the specified server (Win2000/XP)
Retrieving various system metrics
Another way to go online (it is not about choosing an ISP)
Enhanced GetFont dialog
Obtaining a handle to the desktop associated with the calling thread

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
 
#DEFINE UOI_FLAGS    1
#DEFINE UOI_NAME     2
#DEFINE UOI_TYPE     3
#DEFINE UOI_USER_SID 4
 
DO declare
 
LOCAL lnThreadId, hDesktop, lcSid
lnThreadId = GetCurrentThreadId()
hDesktop = GetThreadDesktop(lnThreadId)
 
? "Object type:", GetObjString(hDesktop, UOI_TYPE)
? "Object name:", GetObjString(hDesktop, UOI_NAME)
 
* obtain the SID (security identifier) structure 
* that identifies the user currently associated 
* with the desktop
 
lcSid = GetObjData(hDesktop, UOI_USER_SID)
? "SID length:", GetLengthSid(lcSid)
? "SID is valid:", Iif(IsValidSid(lcSid)=0, "No","Yes")
 
FUNCTION GetObjString(hDesktop, lnIndex)
    LOCAL lcBuffer, lnBufsize
    lnBufsize = 1024
    lcBuffer = Repli(Chr(0), lnBufsize)
    IF GetUserObjectInformation(hDesktop, lnIndex,;
        @lcBuffer, lnBufsize, @lnBufsize) <> 0
        RETURN LEFT(lcBuffer, lnBufsize-1)
    ENDIF
RETURN ""
 
FUNCTION GetObjData(hDesktop, lnIndex)
    LOCAL lcBuffer, lnBufsize
    lnBufsize = 1024
    lcBuffer = Repli(Chr(0), lnBufsize)
    IF GetUserObjectInformation(hDesktop, lnIndex,;
        @lcBuffer, lnBufsize, @lnBufsize) <> 0
        RETURN LEFT(lcBuffer, lnBufsize)
    ENDIF
RETURN ""
 
PROCEDURE declare
    DECLARE INTEGER GetThreadDesktop IN user32 INTEGER dwThreadId
    DECLARE INTEGER GetCurrentThreadId IN kernel32
    DECLARE INTEGER IsValidSid IN advapi32 STRING pSid
    DECLARE INTEGER GetLengthSid IN advapi32 STRING pSid
 
    DECLARE INTEGER GetUserObjectInformation IN user32;
        INTEGER hObj, INTEGER nIndex, STRING @pvInfo,;
        INTEGER nLength, INTEGER @lpnLengthNeeded
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1536 bytes  
Created: 2002-01-02 18:44:43  
Modified: 2008-01-05 11:27:14  
Visits in 7 days: 137  
Listed functions:
GetCurrentThreadId
GetLengthSid
GetThreadDesktop
GetUserObjectInformation
IsValidSid
Printer friendly API declarations
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 (67.202.9.192)
2.4 hrs.Example: 'Using GetNearestColor'
 Function: 'GetWindowsDirectory'
 Function: 'NetServerEnum'
4.23 hrs.Example: 'CryptoAPI: Collection of Providers class'
 Function: 'WTSRegisterSessionNotification'
Function group: 'Terminal Services'
4.34 hrs.Example: 'Winsock: how to retrieve the protocol information corresponding to a protocol name'
 Function: 'CeGlobalMemoryStatus'
Function group: 'Remote Application Programming (RAPI)'
5.47 hrs.Example: 'Retrieving Printer Device Context using PrintDlg function'
5.48 hrs.Function: 'GdipBitmapSetPixel'
 Function: 'RegCreateKeyEx'
Google
Advertise here!