Osvaldo Ramirez

Hello guys
#include "ot4xb.ch"
#include "Appevent.ch"
// ---------------------------------------------------------------------------
#define WM_NCHITTEST 0x0084
#define WM_MOVING 0x0216
#define WM_DESTROY 0x0002
// ---------------------------------------------------------------------------
proc main()
local nEvent,oSle,mp1 := NIL,mp2 := NIL, oXbp := NIL
SETCOLOR( "N/W" )
CLS
?? "Try to Drag & drop the GET"
oSle:= DragableGet():new()
oSle:tabStop := .T.
oSle:create( , , {230,192}, {140,24} )
SetAppfocus( oSle )
nEvent := 0
while nEvent != xbeP_Close
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:HandleEvent( nEvent, mp1, mp2 )
end
return
// ---------------------------------------------------------------------------
CLASS DragableGet FROM XbpSLE
EXPORTED:
// --------------------------------------------------------------------
INLINE METHOD WndProc(hWnd,nMsg,wp,lp)
if( nMsg == WM_NCHITTEST )
@user32:SetFocus(hWnd)
return 2
elseif( nMsg == WM_MOVING )
::Moving( lp )
return 1
end
return NIL
// --------------------------------------------------------------------
INLINE METHOD Create( oParent, oOwner, aPos, aSize, aPP, lVisible )
::xbpSLE:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
ot4xb_SubclassWindow( ::GetHWnd() , Self , WM_DESTROY)
return Self
// --------------------------------------------------------------------
INLINE METHOD Moving(pRect)
local aRect := iif( Empty(pRect) , NIL , PeekDWord(pRect,0,4) )
if( aRect != NIL )
@user32:MapWindowPoints(0, ::SetParent():GetHWND() , @aRect , 2)
DispOutAt(0,35, "L:" + StrZero(aRect[1],5) +;
", T:" + StrZero(aRect[2],5) +;
", R:" + StrZero(aRect[3],5) +;
", B:" + StrZero(aRect[4],5) )
end
return NIL
// --------------------------------------------------------------------
ENDCLASS
Question ...
To make an xbp that recive any event of the OS, do I need to make a subclassing ? ( ot4xb_SubclassWindow( ::GetHWnd() , Self , WM_DESTROY)
So then, this function call automaticly the WndProc(hWnd,nMsg,wp,lp)
where in this place I can trap any events of the OS ... Is it right ?
---------------------------------
Solo para confirmar
Para hacer que un xbp reciva eventos del OS, necesito hacer dicho xbp un subclassing () ?
Y este automaticamente llama la funcion wndproc ? en donde ahi atrapamos todos los eventos de windows ? Es correcto.
Entonces si quiero poner algo asi como ot4xb_SubclassWindow( oDlgVentanPrincipal ) , Self , WM_DESTROY)
Ahi puedo atrapar todos los eventos de windows hasta el cntrl-alt-delete ?
Saludos
Osvaldo Ramirez