Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Enumerating data formats currently available on the clipboard
Custom GDI+ class
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Mapping and disconnecting network drives
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Winsock: sending email messages (SMTP, port 25)
How to display the Properties dialog box for a file (ShellExecuteEx)
Disk in drive A:
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to download a file from the FTP server using FtpGetFile
Using Font and Text functions
Detecting changes in connections to removable drives (VFP9)
How to play AVI file on the _screen
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
Using EnumPrinters function to enumerate locally installed printers
Running MSDOS Shell as a child process with redirected input and output (smarter RUN command)
Splash Screen for the VFP application
Creating irregularly shaped FoxPro form using transparency color key
Converting Unicode data from the Clipboard to a character string using a given code page
Subclassing CommandButton control to create BackColor property
Enumerating network resources
Vertical Label control
Custom HttpRequest class (WinHTTP)
Enumerating Processes -- WinNT

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:
This code sample enumerates running processes on Windows XP and Vista computers.



See also:
  • Obtaining memory performance information for the system
  • Memory usage info for current VFP session
  • Terminating all running applications from a VFP program
  • Enumerating Processes -- Win9*

  •  
    LOCAL oService, oProcesses, oProcess
     
    oService = GETOBJECT("winmgmts:\\.\root\cimv2")
     
    oProcesses = oService.ExecQuery([SELECT * FROM Win32_Process ] +;
        [WHERE caption LIKE "%apiviewer%"])
     
    *!*    oProcesses = oService.ExecQuery("SELECT * FROM Win32_Process")
     
    CREATE CURSOR cs (caption C(50), commandline C(100),;
        creationdate C(20), csname C(32),;
        executablepath C(250), sessionid I, processid I,;
        owner C(32), domain C(32))
     
    FOR EACH oProcess IN oProcesses
     
        WITH oProcess
            STORE REPLICATE(CHR(0),100) TO cUser, cDomain
            .GetOwner(@cUser, @cDomain)
     
            INSERT INTO cs VALUES (;
                NVL(.caption, ""),;
                NVL(.commandline, ""),;
                TRANSFORM(NVL(.creationdate, "")),;
                NVL(.csname, ""),;
                NVL(.executablepath, ""),;
                NVL(.sessionid, 0),;
                .processid,;
                m.cUser, m.cDomain;
            )
     
            DOEVENTS
     
    *!*            * terminate with exit code 0
    *!*            .Terminate(0)
     
        ENDWITH
    NEXT
     
    SELECT cs
    IF RECCOUNT() = 0
        = MESSAGEBOX("Process or processes not found.     ")
    ELSE
        GO TOP
        BROWSE NORMAL NOWAIT
    ENDIF
     
     
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    1050 bytes  
    Created: 2001-10-09 21:44:10  
    Modified: 2011-12-10 09:20:22  
    Visits in 7 days: 86  
    Listed functions:
    CloseHandle
    EnumProcesses
    EnumProcessModules
    GetLastError
    GetModuleBaseName
    GetModuleFileNameEx
    OpenProcess
    Printer friendly API declarations
    My comment:
    Microsoft Knowledge Base: HOWTO: Enumerate Applications in Win32
    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 (23.20.196.179)
    9.15 hrs.Example: 'Attaching menu to a top-level form'
     Example: 'Using the NetMessageBufferSend to send messages on the network'
    9.16 hrs.Example: 'Using FrameRgn for displaying system colors'
    9.73 hrs.Example: 'System Image List Viewer'
     Example: 'Printing Image File, programmatically set print page orientation to landscape'
    10.2 hrs.Example: 'Comparing file times'
     Function: 'GetDC'
    Function group: 'Device Context'
     Example: 'Creating an Open dialog box to specify the drive, directory, and name of a file to open (Shell32 version)'
    13.78 hrs.Example: 'Reading metrics for the currently selected font'
     Example: 'Retrieving a universal form for the drive-based path for a network resource'
    Google
    Advertise here!