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

[in] Pointer to the hook procedure.

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

[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.
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 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: 22
User Contributed Notes:
There are no notes on this subject.

Copyright 2001-2018 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.39), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (
2 sec.Function: 'CopyFile'
5 sec.Function: 'StrFromTimeInterval'
7 sec.Function: 'GetRawInputData'
9 sec.Function: 'MessageBeep'
11 sec.Function: 'GetOpenClipboardWindow'
15 sec.Function: 'SetConsoleCursorPosition'
17 sec.Function: 'GdipCreateFontFamilyFromName'
19 sec.Example: 'Using InternetSetFilePointer when resuming interrupted download from the Internet'
21 sec.Function: 'WSASend'
23 sec.Function: 'ReadFile'
Function group: 'File Management'
Advertise here!