Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Setting properties of the window: caption and user-defined value
String representation for disk or memory capacity
Winsock: changing the byte ordering
Adding printer to the list of supported printers for the specified server
Finding the path to the VFP executable running
How to hot-track menu item selection in top-level form (requires VFP9)
Retrieving top-child window for the VFP form
Converting path to original case
Enumerating files opened on the network
GetFocus returns a HWND value
How to get Special Folders paths
Storing the environment strings in cursor
Comparing file times
Get the power status of your laptop computer
Obtaining a handle to the desktop associated with the calling thread
Obtaining addresses for the adapters on the local computer (Win XP/2003/Vista)
Reading and setting the priority class values for the current process and thread
Retrieving list of Global Atom names
Uploading file to the FTP server using InternetWriteFile
Using the CreateFile
Winsock: retrieving information about available transport protocols
Changing system colors
GDI+: printing image file
Number of clipboard formats available
Setting properties of the window: caption and user-defined value

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
 
DO decl
 
#DEFINE SW_SHOWNORMAL        1
#DEFINE GWL_USERDATA       -21
#DEFINE ccCustomTitle      "Calc-U-lator"
 
LOCAL hCalc, lnCounter
 
* retrieve window hanlde to Windows Calculator
hCalc = GetCalcWinHandle()
 
* change the text of the title bar
= SetWindowText (hCalc, ccCustomTitle)
 
* retrieve the user data associated with the window
lnCounter = GetWindowLong (hCalc, GWL_USERDATA)
 
* increment value
lnCounter = lnCounter + 1
? "User-data value:", lnCounter
 
* set it back
? SetWindowLong (hCalc, GWL_USERDATA, lnCounter)  && optional value
 
FUNCTION  GetCalcWinHandle
    LOCAL hwnd
    hwnd = FindWindow (.NULL., ccCustomTitle)
    IF hwnd = 0
    * start the calculator if not found
        = WinExec ("calc.exe", SW_SHOWNORMAL)
        hwnd = FindWindow (.NULL., "Calculator")
    ENDIF
RETURN hwnd
 
PROCEDURE  decl
    DECLARE INTEGER SetWindowLong IN user32;
        INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong
 
    DECLARE INTEGER FindWindow IN user32;
        STRING lpClassName, STRING lpWindowName
 
    DECLARE INTEGER GetWindowLong IN user32;
        INTEGER hWnd, INTEGER nIndex
 
    DECLARE INTEGER WinExec IN kernel32;
        STRING  lpCmdLine, INTEGER nCmdShow
 
    DECLARE INTEGER SetWindowText IN user32;
        INTEGER hWnd, STRING lpString
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1252 bytes  
Created: 2001-11-01 19:40:13  
Modified: 2006-03-12 14:16:42  
Visits in 7 days: 90  
Listed functions:
FindWindow
GetWindowLong
SetWindowLong
SetWindowText
WinExec
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 (184.73.74.47)
7.23 hrs.Function: 'inet_ntoa'
Function group: 'Windows Sockets 2 (Winsock)'
 Function: 'waveOutReset'
Function group: 'Windows Multimedia'
10.24 hrs.Function: 'GetPrivateProfileSectionNames'
11.88 hrs.Example: 'Getting a bit more than the _CLIPTEXT offers'
 Function: 'InternalGetWindowText'
15.89 hrs.Function: 'OpenWaitableTimer'
16.12 hrs.Example: 'How to change the name and the size of the font in the MessageBox dialog'
18.83 hrs.Function: 'GdipInvertMatrix'
Function group: 'GDI+ Matrix'
 Function: 'CloseDesktop'
19.64 hrs.Function: 'SQLConfigDataSource'
Function group: 'ODBC API'
Google
Advertise here!