Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Custom GDI+ class
Capturing keyboard activity of another application with the Raw Input API (VFP9)
How to print a bitmap file
How to display Windows On-Screen Keyboard
Using the LoadImage function to have a bitmap file loaded and displayed on VFP main window
System Image List Viewer
Winsock: sending email messages (SMTP, port 25)
Creating the Save dialog box to specify the drive, directory, and name of a file to save
Printing Image File, programmatically set print page orientation to landscape
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
The window and its ancestors
Custom HttpRequest class (WinHTTP)
How to convert a bitmap file to monochrome format (1 bpp)
Using EnumPrinters function to enumerate locally installed printers
Mapping and disconnecting network drives
Custom FTP Class for Visual FoxPro application
How to download a file from the FTP server using FtpGetFile
Displaying icons in the system tray (VFP9)
Displaying the associated icons and descriptions for files and folders
How to activate Windows Calculator
Drawing Windows predefined bitmaps using the LoadBitmap functions
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Confining Windows calculator inside the VFP main window
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: 135  
    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 (107.22.25.119)
    1.6 hrs.Function: 'ResetEvent'
    Function group: 'Synchronization'
     Example: 'How to display picture stored in enhanced-format metafile (*.emf)'
     Function: 'CopyImage'
    1.7 hrs.Function: 'GetModuleBaseName'
    Function group: 'Performance Monitoring'
    3.56 hrs.Example: 'GDI+: Color Transparency'
     Example: 'Enumerating forms supported by a specified printer'
    3.67 hrs.Function: 'GetThreadDesktop'
     Example: 'Drawing standard Windows icons'
    3.68 hrs.Function: 'GetFileTime'
    3.78 hrs.Example: 'How to upload a local file to FTP server using FtpPutFile'
    Google
    Advertise here!