Using Win32 functions in Visual FoxPro Image Gallery
Process and Thread
..msdn
AssignProcessToJobObject
CommandLineToArgvW
CreateJobObject
CreateProcess
CreateProcessAsUser
CreateProcessWithLogonW
ExitProcess
FreeEnvironmentStrings
GetCommandLine
GetCurrentProcess
GetCurrentProcessId
GetCurrentThread
GetCurrentThreadId
GetEnvironmentStrings
GetEnvironmentVariable
GetPriorityClass
GetProcessIoCounters
GetProcessTimes
GetProcessVersion
GetStartupInfo
GetThreadPriority
IsWow64Process
OpenProcess
RegisterServiceProcess
SetEnvironmentVariable
SetPriorityClass
SetThreadPriority
Sleep
TerminateJobObject
TerminateProcess
WinExec
Code examples:
Reading STARTUPINFO structure for the current VFP session
Reading STARTUPINFO structure for the current VFP session

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
Before you begin:
See also:
  • Running MSDOS Shell as a child process
  • How to prevent users from accessing the Windows Desktop

  •  
    DO declare
     
    *| typedef struct _STARTUPINFO { 
    *|   DWORD   cb;                4
    *|   LPTSTR  lpReserved;        4
    *|   LPTSTR  lpDesktop;         4
    *|   LPTSTR  lpTitle;           4
    *|   DWORD   dwX;               4
    *|   DWORD   dwY;               4
    *|   DWORD   dwXSize;           4
    *|   DWORD   dwYSize;           4
    *|   DWORD   dwXCountChars;     4
    *|   DWORD   dwYCountChars;     4
    *|   DWORD   dwFillAttribute;   4
    *|   DWORD   dwFlags;           4
    *|   WORD    wShowWindow;       2
    *|   WORD    cbReserved2;       2
    *|   LPBYTE  lpReserved2;       4
    *|   HANDLE  hStdInput;         4
    *|   HANDLE  hStdOutput;        4
    *|   HANDLE  hStdError;         4
    *| } STARTUPINFO, *LPSTARTUPINFO; total: 68 bytes
     
    LOCAL lcStartupInfo, lnAddr
     
    * do not use SPACE(250) instead; there must be strict zeroes
    lcStartupInfo = Repli(Chr(0), 250)
     
    = GetStartupInfo(@lcStartupInfo)
     
    ? "Byte size:", buf2dword(SUBSTR(lcStartupInfo, 1,4))
    ? "lpReserved:", buf2dword(SUBSTR(lcStartupInfo, 5,4))
     
    * WinNT/XP/@K returns a string value; WinMe -- empty string
    ? "lpDesktop string:", getStr(buf2dword(SUBSTR(lcStartupInfo, 9,4)))
     
    * WinNT/XP/2K: possibly the shortcut to your VFP application
    * or a full path to the executable if started directly
    * WinMe = empty string
    ? "lpTitle string:", getStr(buf2dword(SUBSTR(lcStartupInfo, 13,4)))
     
    ? "dwX:", buf2dword(SUBSTR(lcStartupInfo, 17,4))
    ? "dwY:", buf2dword(SUBSTR(lcStartupInfo, 21,4))
    ? "dwXSize:", buf2dword(SUBSTR(lcStartupInfo, 25,4))
    ? "dwYSize:", buf2dword(SUBSTR(lcStartupInfo, 29,4))
    ? "dwXCountChars:", buf2dword(SUBSTR(lcStartupInfo, 33,4))
    ? "dwYCountChars:", buf2dword(SUBSTR(lcStartupInfo, 37,4))
    ? "dwFillAttribute:", buf2dword(SUBSTR(lcStartupInfo, 41,4))
    ? "dwFlags:", buf2dword(SUBSTR(lcStartupInfo, 45,4))
    ? "wShowWindow:", buf2word(SUBSTR(lcStartupInfo, 49,2))
    ? "cbReserved2:", buf2word(SUBSTR(lcStartupInfo, 51,2))
    ? "lpReserved2:", buf2dword(SUBSTR(lcStartupInfo, 53,4))
    ? "hStdInput:", buf2dword(SUBSTR(lcStartupInfo, 57,4))
    ? "hStdOutput:", buf2dword(SUBSTR(lcStartupInfo, 61,4))
    ? "hStdError:", buf2dword(SUBSTR(lcStartupInfo, 65,4))
     
    FUNCTION num2dword(lnValue)
    #DEFINE m0 0x0000100
    #DEFINE m1 0x0010000
    #DEFINE m2 0x1000000
        IF lnValue < 0
            lnValue = 0x100000000 + lnValue
        ENDIF
        LOCAL b0, b1, b2, b3
        b3 = Int(lnValue/m2)
        b2 = Int((lnValue - b3*m2)/m1)
        b1 = Int((lnValue - b3*m2 - b2*m1)/m0)
        b0 = Mod(lnValue, m0)
    RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3)
     
    FUNCTION buf2dword(lcBuffer)
    RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
        Asc(SUBSTR(lcBuffer, 2,1)) * 256 +;
        Asc(SUBSTR(lcBuffer, 3,1)) * 65536 +;
        Asc(SUBSTR(lcBuffer, 4,1)) * 16777216
     
    FUNCTION buf2word(lcBuffer)
    RETURN Asc(SUBSTR(lcBuffer, 1,1)) + ;
        Asc(SUBSTR(lcBuffer, 2,1)) * 256
     
    FUNCTION getStr(lnAddr)
        LOCAL lcBuffer
        lcBuffer = Repli(Chr(0), 128)
        = CopyMemory(@lcBuffer, lnAddr, Len(lcBuffer))
     
        IF AT(Chr(0), lcBuffer) <> 0
            lcBuffer = SUBSTR(lcBuffer, 1, AT(Chr(0), lcBuffer)-1)  
        ENDIF
    RETURN  lcBuffer 
     
    PROCEDURE declare
        DECLARE GetStartupInfo IN kernel32 STRING @lpStartupInfo
     
        DECLARE RtlMoveMemory IN kernel32 As CopyMemory;
            STRING @Destination, INTEGER Source, INTEGER nLength
     
     
     

    User rating: 0/10 (0 votes)
    Rate this code sample:
    • ~
    3214 bytes  
    Created: 2001-09-18 12:00:00  
    Modified: 2006-03-17 12:03:07  
    Visits in 7 days: 85  
    Listed functions:
    GetStartupInfo
    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-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)
    3 sec.Function: 'WideCharToMultiByte'
    27.73 min.Function: 'CopyImage'
    Function group: 'Resource'
    27.8 min.Example: 'Basic Volume information'
    1.03 hrs.Example: 'How to read email messages using Simple MAPI'
     Gallery
    Page 4
     Function: 'InternetGetConnectedStateEx'
    Function group: 'Internet Functions (WinInet)'
    1.5 hrs.Example: 'Monitoring changes occurring within a directory'
     Example: 'How to print FoxPro form'
    4.94 hrs.Example: 'How to retrieve configuration data for a specified printer stored in the registry (PrinterDriverData key)'
     Function: 'GdipGetDpiX'
    Google
    Advertise here!