Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Window's User Events, Callbacks etc.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Window's User Events, Callbacks etc.
Divers
Thread ID:
00460314
Message ID:
00460314
Vues:
55
We are currently trying to build an interface to a dll that works via window's events. The dll reads financial data and broadcasts it to various apps:

For example in a VB app; part of the code looks like this:

'declaring WIN32API functions
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
(ByVal lpPrevWndFunc As Long, _
ByVal hWnd As Long, _
ByVal msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Global Const GWL_WNDWROC = -4

Global Const WM_USER = &H400
Global Const PM_GET_MSG = WM_USER
Global Const PM_CONN_OK = WM_USER + 1
Global Const PM_NO_CONN = WM_USER + 2
Global Const PM_RECONNECTED = WM_USER + 3
Global Const FINISH_INIT = WM_USER + 4
Global Const PM_TRADE_MSG = WM_USER + 5
Global hooked As Boolean

Global lpPrevWndProc As Long


Public Sub HookAgent(ByVal hWindow As Long)

' setting window proc to be the new window proc
If Not hooked Then
lpPrevWndProc = SetWindowLong(hWindow, GWL_WNDWROC, AddressOf NewWindowProc)
hooked = True
End If

End Sub

Public Sub UnHookAgent(ByVal hWindow As Long)
Dim rc As Long

' returning window proc to be the original one
If hooked Then
rc = SetWindowLong(hWindow, GWL_WNDWROC, lpPrevWndProc)
hooked = False
End If
End Sub

Function NewWindowProc(ByVal hWin As Long, _
ByVal uMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Dim rc As Boolean

If ((uMsg = PM_CONN_OK) Or (uMsg = PM_NO_CONN) Or _
(uMsg = PM_GET_MSG) Or (uMsg = PM_RECONNECTED)) Or _
(uMsg = FINISH_INIT) Or (uMsg = PM_TRADE_MSG) Then
rc = getMessages(uMsg, wParam, lParam)
Else
NewWindowProc = CallWindowProc(lpPrevWndProc, hWin, uMsg, _
wParam, lParam)
End If

End Function

(getmessages in registered in a dll)


etc.


However, we can not figure out how to get VFP to read the WM's , or to perform the callback performed in VB.



Any help would be greatly appreciated.
TIA

Eylon
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform