Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Enumerating data formats currently available on the clipboard
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Winsock: sending email messages (SMTP, port 25)
Custom FTP Class for Visual FoxPro application
Detecting changes in connections to removable drives (VFP9)
How to download a file from the FTP server using FtpGetFile
Splash Screen for the VFP application
How to activate Windows Calculator
Custom HttpRequest class (WinINet)
Mapping and disconnecting network drives
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
Using Font and Text functions
Establishing connection using the SQLDriverConnect
Custom HttpRequest class (WinHTTP)
How to convert a bitmap file to monochrome format (1 bpp)
Displaying bitmap using the AlphaBlend function
Using WM_COPYDATA for interprocess communication (VFP9)
Using EnumPrinters function to enumerate locally installed printers
How to play AVI file on the _screen
Vertical Label control
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: 72  
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 (72.44.48.122)
1.48 hrs.Function: 'GdipFillPieI'
Function group: 'GDI+ Graphics'
4.76 hrs.Function: 'OpenDesktop'
Function group: 'Window Station and Desktop'
 Example: 'Using GetFileSize'
5.68 hrs.Example: 'Obtaining list of tables stored in an ODBC Data Source'
8.48 hrs.Example: 'How to test file attributes (key method for FileExists and DirectoryExists routines)'
 Function: 'GetEnhMetaFileHeader'
12.42 hrs.Example: 'Displaying hypertext links with the SysLink control (VFP9, Comctl32.dll)'
15.76 hrs.Example: 'How to download this reference`s archive through WinInet functions using InternetOpenUrl'
16.59 hrs.Function: 'Sleep'
Function group: 'Process and Thread'
19.59 hrs.Function: 'DeleteDC'
Function group: 'Device Context'
Google
Advertise here!