Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to enable the SE_SHUTDOWN_NAME privilege for the application
How to load a user profile
Reading and setting system access privileges for the current process
..msdn    Add comment     W32 Constants      Translate this page
Opens the access token associated with a process.
Code examples:
How to load a user profile
How to enable the SE_SHUTDOWN_NAME privilege for the application
Reading and setting system access privileges for the current process
BOOL WINAPI OpenProcessToken(
  __in   HANDLE ProcessHandle,
  __in   DWORD DesiredAccess,
  __out  PHANDLE TokenHandle
FoxPro declaration:
DECLARE INTEGER OpenProcessToken IN advapi32;
    INTEGER ProcessHandle,;
    LONG DesiredAccess,;
    INTEGER @TokenHandle
ProcessHandle [in]
A handle to the process whose access token is opened.

DesiredAccess [in]
Specifies an access mask that specifies the requested types of access to the access token.

TokenHandle [out]
A pointer to a handle that identifies the newly opened access token when the function returns.
Return value:
If the function succeeds, the return value is nonzero.
LOCAL hProcess, hToken, nResult


nResult = OpenProcessToken(hProcess,;
    nAccessFlags, @hToken)

IF nResult = 0
    ? "OpenProcessToken call failed:", GetLastError()
My comment:
The process must have the PROCESS_QUERY_INFORMATION access permission.

Close the access token handle returned through the TokenHandle parameter by calling CloseHandle.
Word Index links for the OpenProcessToken :
Translate this page:
  Spanish    Portuguese    German    French    Italian offers instant, free translations of text or web pages.
Created: 2009-02-02 11:24:00
Modified: 2009-02-02 13:19:59
Visited in last 7 days: 59
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2017 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.38), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
16 sec.Function: 'SetTextColor'
32 sec.Function: 'GdipCreateHICONFromBitmap'
48 sec.Function: 'mmioCreateChunk'
1.12 min.Function: 'SHFormatDrive'
1.38 min.Function: 'GetRegionData'
1.65 min.Function: 'CreateWaitableTimer'
1.87 min.
Function group: 'Window'
2.17 min.Function: 'mmioRead'
2.42 min.Function: 'mixerGetControlDetails'
2.7 min.Function: 'PathFindFileName'
Advertise here!