|
-
Apr 29th, 2002, 07:40 AM
#1
Thread Starter
Addicted Member
using Sendmessage on user control ....
i have one active-x control made by me it just have a frame and command button .. i wanted to move my control like window to any where on form ... i did it my Send message passing using control's hwnd with WM_NCLBUTTONDOWN window message in control coding .. its working fine but now if i want to move it from code in outer form i.e. i move it by proeprties like top,left etc. through my code it doesnt move.It changes it pos once only but not after that ... i m not able to changes its position in run time through coding ... API usage on frame's mouse move is liek this ....
Private Sub frmCaption_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lngReturnValue As Long
'// Detect the left mouse button
If Button = 1 Then
'// Release the capture of the mouse
Call ReleaseCapture
'// Move the form with the mouse
lngReturnValue = SendMessage(UserControl.hwnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 0&)
End If
End Sub
frame is some thing on which putting mouse i move/drag the control ...
i think use of this API stuck the movement of control when i use it in some form when i say usercontrol1.top = somehting etc. any one can help ??
-
Apr 29th, 2002, 01:43 PM
#2
Frenzied Member
lngReturnValue = SendMessage(
UserControl.hwnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 0&)
Try changing it to..
lngReturnValue = SendMessage(
UserControl.Extender.hwnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 0&)
-
Apr 29th, 2002, 11:51 PM
#3
Thread Starter
Addicted Member
i tested it .. while run time i move the control it says .. object doesnt support this property and get crash ...
-
Apr 30th, 2002, 02:11 AM
#4
Hyperactive Member
why not try using PostMessage instead of Sendmessage?
-
Apr 30th, 2002, 02:44 AM
#5
Frenzied Member
Are you sure that you've set the WindowLess property to false and does contain a hwnd..
If you just want to move the control.. why don't you set its left and top properties by the way?
-
Apr 30th, 2002, 04:45 AM
#6
Thread Starter
Addicted Member
move means i want to drag it like form ... it happens with normal controls like command button and works properly but with my control its not happening .. actually its moving but not going on same position again once i drag it if i move it to some other pos then it will go but again it will not go at same pos but will go at different pos .. the only prob i thinking is hwnd ... as there hwnd in normal control my control doesnt has hwnd .. how to get hwnd of a control ?? means there is usercontrol.hwnd but when my control is on form i dont hv its hwnd ....
-
Apr 30th, 2002, 09:52 AM
#7
Frenzied Member
you want to move the control during design time? I think it happens automatically... and you don't have to code for achieveing this behavior...
-
Apr 30th, 2002, 09:54 AM
#8
Frenzied Member
to add the hwnd to the design and runtime instance of your control make a property hwnd and map is to UserControl.hwnd and for the runtime you'll have to use UserControl.Extender.hwnd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|