Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Enumerating data formats currently available on the clipboard
Winsock: sending email messages (SMTP, port 25)
Custom FTP Class for Visual FoxPro application
How to download a file from the FTP server using FtpGetFile
Detecting changes in connections to removable drives (VFP9)
Splash Screen for the VFP application
Mapping and disconnecting network drives
Custom HttpRequest class (WinINet)
How to activate Windows Calculator
Establishing connection using the SQLDriverConnect
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
Custom HttpRequest class (WinHTTP)
How to convert a bitmap file to monochrome format (1 bpp)
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
Using Font and Text functions
Displaying bitmap using the AlphaBlend function
Using EnumPrinters function to enumerate locally installed printers
Using WM_COPYDATA for interprocess communication (VFP9)
Extensible Storage Engine class library
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: 92  
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 (107.22.156.205)
2.24 hrs.Example: 'How to print FoxPro form'
5.48 hrs.Example: 'Dial the Net Automatically'
 Example: 'How to print FoxPro form -- II'
6.75 hrs.Example: 'How to retrieve version information for the specified file'
 Example: 'Using GetNearestColor'
8.49 hrs.Function: 'CeDeleteFile'
9.88 hrs.Example: 'Loading a string resource from an executable file'
 Example: 'Class library providing access to the System Registry'
10.8 hrs.Function: 'ShowHTMLDialog'
 Function: 'CountClipboardFormats'
Function group: 'Clipboard'
Google
Advertise here!