Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to read email messages using Simple MAPI
How to register custom Event Log source
How to retrieve information about a cache entry (Internet Explorer)
Browsing Windows Known Folders (Special Folders)
Converting characters in a URL into corresponding escape sequences and backwards
Enumerating ports that are available for printing on a specified server
Opening the Page Setup dialog box to specify the attributes of a printed page
Smart Card Database Query Functions
Using MessageBeep
Converting image file to .ICO file
Enumerating global and local group accounts on a server (WinNT/XP/2K)
GDI+: Drawing a Pie Chart
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Using InternetSetFilePointer when resuming interrupted download from the Internet
Adding and deleting User Accounts
Initiating Inet connection using a modem
Using vendor-neutral SQL constructs
Writing to INI file
Changing file attributes
Displaying dimmed window behind VFP top-level form
Drawing Windows predefined bitmaps using the LoadBitmap functions
How to display advanced Task Dialog (Vista)
How to enumerate sessions and processes on a specified terminal server
HOWTO: Use the Win32 API to Access File Dates and Times
Reading and setting the priority class values for the current process and 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
Versions:
click to open
Before you begin:
The priority of each thread is determined by the following criteria:
  • The priority class of its process
  • The priority level of the thread within the priority class of its process

    The priority class and priority level are combined to form the base priority of a thread. The priority levels range from zero (lowest priority) to 31 (highest priority).
  •  
    #DEFINE PROCESS_QUERY_INFORMATION  1024
    #DEFINE PROCESS_VM_READ            4
    #DEFINE NORMAL_PRIORITY_CLASS      32
    #DEFINE IDLE_PRIORITY_CLASS        64
    #DEFINE HIGH_PRIORITY_CLASS        128
    #DEFINE REALTIME_PRIORITY_CLASS    256
    #DEFINE THREAD_BASE_PRIORITY_MAX   2
     
    DO declare
     
    LOCAL hProcess, hThread
     
    * retrieve a handle to the current process
    hProcess = OpenProcess(;
        BITOR(PROCESS_QUERY_INFORMATION,PROCESS_VM_READ),;
        0, GetCurrentProcessId())
     
    * retrieve a handle (pseudo) to the current thread
    * no need to release this handle through the CloseHandle function
    hThread = GetCurrentThread()
     
    IF hProcess <> 0
        ? "Current process priority:", GetPriorityClass (hProcess)
        ? "Current thread priority:", GetThreadPriority(hThread)
     
        ? "Attempting to change the priority class for the current process:",;
            SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)
     
        ? "Attempting to change the priority class for the current thread:",;
            SetThreadPriority(hThread, THREAD_BASE_PRIORITY_MAX)
     
        ? "Changed process priority:", GetPriorityClass (hProcess)
        ? "Changed thread priority:", GetThreadPriority(hThread)
     
        = CloseHandle(hProcess)
    ENDIF
     
    PROCEDURE declare
        DECLARE INTEGER GetCurrentThread IN kernel32
        DECLARE INTEGER GetCurrentProcessId IN kernel32
        DECLARE INTEGER CloseHandle IN kernel32 INTEGER hObject
        DECLARE INTEGER GetThreadPriority IN kernel32 INTEGER hThread
        DECLARE INTEGER GetPriorityClass IN kernel32 INTEGER hProcess
     
        DECLARE INTEGER SetThreadPriority IN kernel32;
            INTEGER hThread, INTEGER nPriority
     
        DECLARE INTEGER OpenProcess IN kernel32;
            INTEGER dwDesiredAccess,;
            INTEGER bInheritHandle, INTEGER dwProcId
     
        DECLARE INTEGER SetPriorityClass IN kernel32;
            INTEGER hProcess, INTEGER dwPriorityClass
     
     
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1781 bytes  
    Created: 2001-12-17 23:11:54  
    Modified: 2008-04-24 11:07:05  
    Visits in 7 days: 83  
    Listed functions:
    CloseHandle
    GetCurrentProcessId
    GetCurrentThread
    GetPriorityClass
    GetThreadPriority
    OpenProcess
    SetPriorityClass
    SetThreadPriority
    Printer friendly API declarations
    My comment:
    A handle to the current process is retrieved through the OpenProcess function.

    Another option available is using the GetCurrentProcess function. This function returns not exactly a handle, but rather a pseudo-handle. Which can be used same way as the real one, saving the CloseHandle call.
    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.180.187)
    11.1 hrs.Function: 'GlobalLock'
    Function group: 'Memory Management'
     Function: 'GdipCreateBitmapFromHBITMAP'
    12.84 hrs.Function: 'GetStartupInfo'
    Function group: 'Process and Thread'
    12.85 hrs.Example: 'How to copy the image of a form to the Clipboard using Bitmap API functions'
    14.22 hrs.Example: 'How to create MD-5 and SHA-1 hash values from a string'
    Language: 'C++'
     Function: 'GdipCreateFontFamilyFromName'
    23.48 hrs.
    Function group: 'Windows Multimedia'
     Function: 'SetSearchPathMode'
    Function group: 'File Management'
    1 day(s)Example: 'Retrieving information about the main VFP window'
     Example: 'How to download a file from the FTP server using FtpGetFile'
    Google
    Advertise here!