Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Obtaining a handle to the desktop associated with the calling thread
A class that encrypts and decrypts files using Cryptography API Functions
A client for testing non-blocking Winsock server
Confining Windows calculator inside the VFP main window
How to display a dialog box with which the user can add a data source (DSN)
Reading security permissions for NTFS files and folders
Retrieving the name of the default printer for the current user on the local computer (Win NT/XP)
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
An alternative way of setting Form.Closable to False
Enumerating data formats currently available on the clipboard
How to download this reference`s archive through WinInet functions using InternetOpenUrl
How to draw custom Window Caption on FoxPro form
How to view system icons for the classes installed on the local machine
Changing pitch and speed of a wave file
Creating a unique filename based on existing filename
Enumerating printer drivers installed
GDI+: sending image of FoxPro form to printer
How to block the ALT+TAB shortcut (WinXP)
How to enumerate sessions and processes on a specified terminal server
Enumerating network resources
How to make the caption of a VFP application flashing in the Windows task bar
How to ping a remote site using ICMP API calls
Pocket PC: custom RAPI class for operating with the System Registry
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: 84  
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-2018 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.6.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.227.17.101)
23 sec.Function: 'socket'
Function group: 'Windows Sockets 2 (Winsock)'
44 sec.Links
1.1 min.Function: 'CeWriteFile'
1.35 min.
1.77 min.Example: 'Using NetWkstaTransportEnum to obtain MAC Address of remote server'
2.12 min.Gallery
2.45 min.Function: 'FreeEnvironmentStrings'
Function group: 'Process and Thread'
2.77 min.
Function group: 'Event Logging'
3.1 min.Function: 'CeRegCreateKeyEx'
Function group: 'Remote Application Programming (RAPI)'
3.42 min.Function: 'SHFileOperation'
Function group: 'Shell Functions'
Google
Advertise here!