Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
An alternative way of setting Form.Closable to False
Comparing file times
Creating hash values for the list of names
GDI+: converting image file to another graphics format
How to save registry key including its subkeys and values to a file
Obtaining the bounding rectangle for the specified device context
Retrieving the rectangle area where the mouse cursor is confined
Returning some basic information for the specified INF file
Closing Windows
Current directory of the application
Enumerating MIDI output devices
Retrieving the name of the primary domain controller (PDC) and join status information (NT/2000/XP)
Simple MAPI: how to pick an email recipient from Outlook Express address book
Using LoadLibrary
Winsock: retrieving information from a host database for a given host name
CryptoAPI: retrieving list of providers
Enumerating Processes -- Win9*
How to generate UUID values
Obtaining MAC address through Address Resolution Protocol (ARP) request
Running a regular FoxPro form while main VFP window is minimized
Saving available locale records into a cursor
Using an Event Object. Part A: running an application that creates an Event object
List of addresses in the AutoDial mapping database
Using the CopyFile
How to intercept window messages sent to VFP form

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:
Before testing this code download WinProcXT.dll to a local directory and register it:

        regsvr32 c:\temp\WinProcXT.dll

Change "c:\temp" to the name of a directory where you copied the DLL file.

This is an ActiveX DLL. The VB code is available here.

The DLL reassignes the WindowProc address of the VFP form to its own function and sends system messages to a text file. Change in the following program code the "c:\temp\log.txt" to any appropriate file name.

Every system message has three parameters to be saved: message identifier, first message parameter, second message parameter.

Run the following code. Right after you close the form a list of system messages saved during its execution appears. Usually this list ends with message identifiers 2 (WM_DESTROY) and 130 (WM_NCDESTROY).

List of some message identifiers is available here.

* * *
For VFP9 use BINDEVENT() to trap Windows messages.
 
PUBLIC objForm
objForm = CreateObject("TForm")
objForm.Visible = .T.
 
DEFINE CLASS TForm As Form
    Width=460
    Height=300
    AutoCenter=.T.
    Caption=" Recording Window Messages"
    KeyPreview=.T.
    recorder=.F.
    hWindow=0
 
PROCEDURE Activate
    IF THIS.hWindow = 0
        DECLARE INTEGER GetFocus IN user32
        THIS.hWindow = GetFocus()
 
        THIS.recorder = CreateObject("TRecorder",;
            THIS.hWindow, "c:\temp\log.txt")
    ENDIF
 
PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
    IF nKeyCode = 27
        ThisForm.Release
    ENDIF
 
ENDDEFINE
 
DEFINE CLASS TRecorder As Custom
    hWindow=0
    LogFile=""
    ole=.F.
 
PROCEDURE Init (hWnd, lcFileName)
    THIS.LogFile = lcFileName
    THIS.hWindow = hWnd
 
    ON ERROR ?? Chr(7)
    THIS.ole = CreateObject("WinProcXT.WinProc")
    ON ERROR
 
    IF TYPE("THIS.ole") <> "O"
        RETURN .F.
    ENDIF
 
    WITH THIS.ole
        .StartService (THIS.hWindow, THIS.LogFile)
        IF Not .IsRunning
            RETURN .F.
        ENDIF
    ENDWITH
 
PROCEDURE Destroy
    THIS.ole.StopService
    IF FILE (THIS.LogFile)
        CREATE CURSOR csMessages (msg N(16), wParam N(16), lParam N(16))
        APPEND FROM (THIS.LogFile) TYPE DELIMITED WITH TAB
        GO TOP
        BROWSE NORMAL NOWAIT
    ENDIF
ENDDEFINE
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1207 bytes  
Created: 2002-04-21 18:35:15  
Modified: 2005-10-10 11:22:17  
Visits in 7 days: 81  
Listed functions:
GetFocus
Printer friendly API declarations
My comment:
The WindowProc function is an application-defined function that processes messages sent to a window.
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.242.188.217)
3.22 hrs.Function: 'SetPrinter'
 Function: 'ReplaceFile'
Function group: 'File Management'
6.05 hrs.Example: 'Enumerating global and local group accounts on a server (WinNT/XP/2K)'
7.2 hrs.Example: 'Placing On-screen Alert on top of all windows'
 Example: 'Using FillMemory'
7.54 hrs.Function: 'SHParseDisplayName'
 Example: 'Using InternetSetFilePointer when resuming interrupted download from the Internet'
7.76 hrs.Example: 'Displaying OS Memory Status'
 Example: 'Who is the first in viewing the Clipboard'
9.42 hrs.Function: 'GdipCreateFromHWND'
Google
Advertise here!