Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bindevent to non VFP windows messages
Message
 
To
13/05/2006 03:31:23
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
01121600
Message ID:
01121603
Views:
20
Hi Carlos,

If you want bindevent() to message for non VFP window message, you must hack window has get these message inclusive redirect window procedure:
.ctl32_OldProc = GetWindowLong(This.ctl32_controlHwnd, GWL_WNDPROC)
Bindevent(This.ctl32_controlHwnd, WM_PAINT, This, [ctl32_WM_Paint], 1)
MartinJ

>I am having some trouble trying to do a bindevent, I want to do some custom drawing in a window. This is the code:
>
>The window handle in ctl32_controlHwnd refers to a window progressbar common control, created doing CreateWindowEx:
>
>
>	.ctl32_dwExStyle = 0
>	.ctl32_lpClassName = [msctls_progress32]
>	.ctl32_lpWindowName = .ctl32_lpClassName + SYS(2015)
>	.ctl32_dwStyle = Bitor(WS_CHILD, WS_CLIPSIBLINGS)
>	.ctl32_hWndParent = .ctl32_HostHwnd
>	.ctl32_Left = .Left
>	.ctl32_Top = .Top
>	.ctl32_Width = .Width
>	.ctl32_Height = .Height
>	.ctl32_hMenu = 0
>	.ctl32_hInstance = GetWindowLong(.ctl32_HostHwnd, GWL_HINSTANCE)
>	.ctl32_lpParam = 0
>
>	.ctl32_ControlHwnd = CreateWindowEx( ;
>		.ctl32_dwExStyle, ;
>		.ctl32_lpClassName, ;
>		.ctl32_lpWindowName, ;
>		.ctl32_dwStyle, ;
>		.ctl32_Left, ;
>		.ctl32_Top, ;
>		.ctl32_Width, ;
>		.ctl32_Height, ;
>		.ctl32_hWndParent,  ;
>		.ctl32_hMenu, ;
>		.ctl32_hInstance, ;
>		.ctl32_lpParam)
>
>.ctl32_OldProc = GetWindowLong(_vfp.HWnd, GWL_WNDPROC)
>Bindevent(This.ctl32_controlHwnd, WM_PAINT, This, [ctl32_WM_Paint], 1)
>
>
>I understand that this window, although is a child of a VFP form, somehow its not part of the VFP message queue, or something like that.
>
>If I do:
>
>?GetWindowLong(THISFORM.HWND, GWL_WNDPROC)
>?GetWindowLong(_VFP.HWND, GWL_WNDPROC)
>
>I see that they all share the same window procedure, but the window control has another window procedure. I have been reading a lot about this, and it seems I do not have enough knowledge to solve it.
>
>What I want to do exactly is this: I want to remove the 3d border from a non-themed progressbar (DONE) And I want to replace it with a one pixel thick black border. (Also DONE, just dont know how to call that procedure after the WM_PAINT event of the control window)
>
>This is how I remove the 3d border:
>
>
>	If .Flat = .T.
>		SetWindowLong(.ctl32_ControlHwnd, GWL_EXSTYLE, 0)
>	Else
>		SetWindowLong(.ctl32_ControlHwnd, GWL_EXSTYLE, WS_EX_STATICEDGE)
>	Endif
>
>	*!* Refresh control window so frame change gets redrawn
>	SetWindowPos(.ctl32_ControlHwnd, ;
>		HWND_TOP, ;
>		0, ;
>		0, ;
>		0, ;
>		0, ;
>		BITOR(SWP_NOMOVE, SWP_NOSIZE, SWP_NOZORDER, SWP_FRAMECHANGED))
>
>
>And this is how I draw the black border:
>
>
>	m.lnDC = GetDC(.ctl32_ControlHwnd)
>
>	m.lcRect = Space(16)
>	GetClientRect(.ctl32_ControlHwnd, @m.lcRect)
>	m.lnLeft   = .uStrToLong(Substr(m.lcRect,  1,4))
>	m.lnTop    = .uStrToLong(Substr(m.lcRect,  5,4))
>	m.lnRight  = .uStrToLong(Substr(m.lcRect,  9,4)) - 1
>	m.lnBottom = .uStrToLong(Substr(m.lcRect, 13,4)) - 1
>
>	MoveToEx(m.lnDC, m.lnLeft, m.lnTop, [])
>
>	LineTo(m.lnDC, m.lnRight, m.lnTop)
>	LineTo(m.lnDC, m.lnRight, m.lnBottom)
>	LineTo(m.lnDC, m.lnLeft, m.lnBottom)
>	LineTo(m.lnDC, m.lnLeft, m.lnTop)
>
>	ReleaseDC(.ctl32_ControlHwnd, m.lnDC)
>
>
>The only thing left is to have ctl32_WM_Paint fire every time the control window receives a WM_PAINT message.
>
>I need to know if this kind of event binding can be done, or where can I find information that will help me understand the concepts involved.
>
>Carlos
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform