|
-
Feb 23rd, 2004, 11:25 PM
#1
Thread Starter
Addicted Member
Finding Active MDI CHILD [RESOLVED]*
Ok, first of all a little background:
I have mdi setup this is something similar to how a normal graphics program has their MDI setup(ex: paintshoppro, photoshop)... ok now I need a Mouse Subclass hook, I know nothing about them really, to catch the scroll wheel. but it needs to be individual to each child that is created. The scroll wheel is to zoom... so I have some code that contains:
VB Code:
Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
On Error Resume Next
If wMsg = WM_MOUSEWHEEL Then
If HiWord(wParam) < 0 Then
MsgBox "here1"
Else
MsgBox "here2"
End If
End If
WindProc = CallWindowProc(WndProcOld&, hwnd&, wMsg&, wParam&, lParam&)
End Function
this was found at an example on here, but it seems difficult to do it because this sub is called from... hmm actually I dont know where because I dont understand subhooking very well...
but where ever it gets called from.... I dont know how to do this for the MDICHILD ... and basically I dont care how it gets done I just need the public variable "zoom" on the MDICHILD to change according to which way the scrollwheel is going, if you need more information to help me... no problem but please help because this sub classing/hooking confuses me.
-SpeedyDog
Last edited by SpeedyDog; Dec 31st, 2004 at 03:08 PM.
-
Feb 23rd, 2004, 11:46 PM
#2
Thread Starter
Addicted Member
ok, after I did some more looking into the code, All I need to do, oh by the way I'm someone new to MDI too. so either I can keep that one sub inside the MOD. the one that gets called on scrollwheel. and then just say.. THE ACTIVE MDI.ZOOM = THE ACTIVE MDI.ZOOM (+/-) 25 ...
so bascially now I just need to determine which MDI CHILD of "frmWork" is activated.
-Speedy the Dog.
-
Feb 24th, 2004, 07:15 AM
#3
Thread Starter
Addicted Member
-
Feb 24th, 2004, 08:43 AM
#4
Addicted Member
Hi,
just use :
mdiMain.ActiveForm (my mdi forms are always called mdiMain).
This will give you a reference to they active form. With an mdi environment you should always use MDIForm.ActiveForm and not
Screen.ActiveForm because the last one also recognices the mdiform as an active form.
from MSDN, maybee important for your case (if the zoom function is in a seperate module, outside of the child form) :
"If you plan to pass Screen.ActiveForm or MDIForm.ActiveForm to a procedure, you must declare the argument in that procedure with the generic type (As Form) rather than a specific form type (As MyForm) even if ActiveForm always refers to the same type of form."
regards,
per-i
-
Feb 24th, 2004, 04:08 PM
#5
Thread Starter
Addicted Member
Getting Active Form MDI [Fixed]
Thanks, this has really helped...
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
|