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
Winsock: sending email messages (SMTP, port 25)
System Image List Viewer
Creating the Save dialog box to specify the drive, directory, and name of a file to save
Using Video Capture: displaying on FoxPro form frames and previewing video obtained from a digital camera
Custom HttpRequest class (WinHTTP)
Printing Image File, programmatically set print page orientation to landscape
The window and its ancestors
How to convert a bitmap file to monochrome format (1 bpp)
Mapping and disconnecting network drives
Using EnumPrinters function to enumerate locally installed printers
How to download a file from the FTP server using FtpGetFile
Custom FTP Class for Visual FoxPro application
Displaying the associated icons and descriptions for files and folders
Displaying icons in the system tray (VFP9)
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 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: 49  
    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 (67.202.9.192)
    1.47 hrs.Function: 'DragAcceptFiles'
    Function group: 'Shell Functions'
     Function: 'SetFileTime'
     Example: 'Saving HKEY_LOCAL_MACHINE\\Software\\ODBC Registry Entries to an XML file'
    1.69 hrs.
     Example: 'Opening the Page Setup dialog box to specify the attributes of a printed page'
     Function: 'CryptGenRandom'
    Function group: 'Cryptography Reference'
    2.47 hrs.Example: 'Finding out if the current user is the Guest account'
     Function: 'Escape'
    3.5 hrs.Example: 'Drawing Windows frame controls using the DrawFrameControl function'
     Function: 'GetWindowDC'
    Function group: 'Painting and Drawing'
    Google
    Advertise here!