Using Win32 functions in Visual FoxPro Image Gallery
Hook
..msdn
SetWindowsHookEx
UnhookWindowsHookEx
Code examples:
SetWindowsHookEx
..msdn    Add comment     W32 Constants      Translate this page
Installs an application-defined hook procedure into a hook chain.
Code examples:
Declaration:
HHOOK SetWindowsHookEx(
    int idHook,
    HOOKPROC lpfn,
    HINSTANCE hMod,
    DWORD dwThreadId
);
FoxPro declaration:
DECLARE INTEGER SetWindowsHookEx IN user32;
    INTEGER idHook,;
    INTEGER lpfn,;
    INTEGER hMod,;
    LONG dwThreadId
Parameters:
idHook
[in] Specifies the type of hook procedure to be installed.

lpfn
[in] Pointer to the hook procedure.

hMod
[in] Handle to the DLL containing the hook procedure pointed to by the lpfn parameter.

dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated.
Return value:
If the function succeeds, the return value is the handle to the hook procedure.
Usage:
LRESULT CALLBACK OnWinCreated(int nCode, WPARAM wParam, LPARAM lParam)
{
//...
}

idHook = SetWindowsHookEx(WH_CBT, &OnWinCreated,
    NULL, GetCurrentThreadId());
My comment:
See also: UnhookWindowsHookEx, MessageBox

It is highly unlikely someone would call this function from pure VFP code. This page might easily contain no VFP declaration for that reason.

Though when called from FLL or DLL library, the SetWindowsHookEx can enable VFP application with valuable and unique functionality.

For example, provided a certain windows hook set, each following MESSAGEBOX() dialog within current VFP session would appear not centered but instead would automatically position itself at the specified screen location.

* * *
Highly recommended reading: Craig Boyd`s SPS blog entry BindEvent on Steroids.
Word Index links for the SetWindowsHookEx :
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
Created: 2009-10-19 13:05:20
Modified: 2010-11-21 19:41:28
Visited in last 7 days: 5
User Contributed Notes:
There are no notes on this subject.


Copyright 2001-2017 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.6.37), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (54.81.79.128)
5 sec.Function: 'JetEndSession'
10 sec.Function: 'WNetAddConnection'
14 sec.Function: 'HeapUnlock'
19 sec.Function: 'CeWriteFile'
24 sec.Function: 'DeviceIoControl'
29 sec.Function: 'NetUserAdd'
34 sec.
Function group: 'Data Decompression Library'
38 sec.Function: 'SetupOpenInfFile'
43 sec.Function: 'WTSUnRegisterSessionNotification'
48 sec.Function: 'JetGotoBookmark'
Google
Advertise here!