-
Jan 25th, 2021, 11:07 AM
#41
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Made this to show a friend what I was working on. Posting here just to show you guys...
https://www.youtube.com/watch?v=yzTSLRKz8l0
Last edited by ColinE66; Jan 25th, 2021 at 11:10 AM.
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 25th, 2021, 05:37 PM
#42
Hyperactive Member
Re: [RESOLVED] Getting hWnd from VBIDE.Window
looks great could you share the add-ins
a greeting
-
Jan 26th, 2021, 10:59 AM
#43
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by yokesee
looks great could you share the add-ins
Yes, that's the plan....
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Jan 27th, 2021, 06:26 PM
#44
Re: [RESOLVED] Getting hWnd from VBIDE.Window
I started to develop an addin, and I had to stop because of exactly this ...
Getting hWnd from VBIDE.Window
When I can I will come back again ... with this addin that I will develop there will be more space on the code screen ... and design.
-
Jan 27th, 2021, 07:20 PM
#45
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by Episcopal
I started to develop an addin, and I had to stop because of exactly this ...
Getting hWnd from VBIDE.Window
When I can I will come back again ... with this addin that I will develop there will be more space on the code screen ... and design.
Be aware that Trick's technique will only work in Design mode, in case that makes a difference to your usage of it. If you attempt it during Run or Break mode, you will get a 'permission denied' error.
Also, this may be useful information for you: If you attempt to enumerate the VBWindows collection, there is no way of knowing what component each window relates to. The way around that is to take the following 'backwards' approach:
Code:
Private Sub ListWindowInfo()
Dim CP As CodePane, VBComp As VBComponent, VBProj As VBProject
For Each CP In gVBInstance.CodePanes
Set VBComp = CP.CodeModule.Parent
Set VBProj = VBComp.Collection.Parent
Debug.Print VBProj.Name & " - " & VBComp.Name & "(" & CP.Window.Type & ")"
Next CP
For Each VBProj In gVBInstance.VBProjects
For Each VBComp In VBProj.VBComponents
If VBComp.HasOpenDesigner Then
Debug.Print VBProj.Name & " - " & VBComp.Name & "(" & VBComp.DesignerWindow.Type & ")"
End If
Next VBComp
Next VBProj
End Sub
That may seem convoluted, but other approaches, where you 'touch' a window that doesn't exist, will force that window to be created. And that's why there's two loops in the above code; the second one will pick up open designer windows where the code pane isn't also open.
Somebody may find this useful...
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Apr 4th, 2021, 04:52 PM
#46
Junior Member
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Hi,
I'm ***very*** interested in the addin and looking at the complete code.
I also would like to go the other way and if there is a listbox "window" get the listbox so I can look at the contents. This is from using spy++ on the stck window when debugging. If that works I'd like to query the watch and locals windows as well!!!
TIA
Lisa
-
Apr 5th, 2021, 06:02 AM
#47
Re: [RESOLVED] Getting hWnd from VBIDE.Window
If you don't know where you're going, any road will take you there...
My VB6 love-children: Vee-Hive and Vee-Launcher
-
Apr 5th, 2021, 06:15 PM
#48
Junior Member
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by ColinE66
Thank you ColinE!!!!!
Unzipping it now!!!
Regards
Lisa
-
Apr 11th, 2021, 04:05 AM
#49
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by wqweto
The idea of xiaoyao's code is that if Caption property is writable then you can temporaty change the Caption to a unique string (a GUID) then use FindWindow API to locate the hWnd before restoring the original Caption.
Super hacky but can be used as a last resort until anything better comes up.
cheers,
</wqw.
Yep, the caption can be temporarily changed:
Code:
Private Function GetDesignerHwnd(nComponent As VBComponent) As Long
Dim w As Window
Dim iCaptionPrev As String
Dim h As Long
Const cTmpCaption As String = "! tmp_caption ^_^"
iCaptionPrev = nComponent.Properties("Caption")
On Error GoTo ErrNext
nComponent.Properties("Caption") = cTmpCaption
For Each w In VBInstance.Windows
If w.Caption = cTmpCaption Then
CopyMemory h, ByVal ObjPtr(w) + &H1C, 4
GetDesignerHwnd = h
Exit For
End If
Next
ErrNext:
nComponent.Properties("Caption") = iCaptionPrev
End Function
-
Apr 11th, 2021, 07:23 AM
#50
Junior Member
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Um.... please excuse me if I'm being dense but.. which caption/window?
Lisa
-
Apr 11th, 2021, 08:51 AM
#51
Re: [RESOLVED] Getting hWnd from VBIDE.Window
Originally Posted by lisagreen
Um.... please excuse me if I'm being dense but.. which caption/window?
Lisa
It is the caption of the form at design time, and its hWnd.
-
Apr 12th, 2021, 11:56 AM
#52
Junior Member
Re: [RESOLVED] Getting hWnd from VBIDE.Window
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
|