|
-
Feb 27th, 2005, 03:58 AM
#1
Thread Starter
Junior Member
Window class name "afxwnd42s"
Parent Win class name is "#32770" and several buttons' class names are "afxwnd42s" (the only thing differentiating these buttons are the text). Anyone ever been in this situation? I just want to get the text of the buttons for now. Thanks
-
Feb 27th, 2005, 01:54 PM
#2
Re: Window class name "afxwnd42s"
You should be able to do a FindWindow for the dialog window #32770. Then do a FindWindowEx passing
the buttons classname and caption. Then you will have the handle to the button.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 27th, 2005, 03:20 PM
#3
Thread Starter
Junior Member
Re: Window class name "afxwnd42s"
I'm having trouble finding the parent window, since it's one of those funky #32770 class names. My API Spy says the parent is returning a text, but doesn't have a parent class name or handle.
-
Feb 27th, 2005, 03:40 PM
#4
Re: Window class name "afxwnd42s"
Which Spy utility are you using? I only have M$ Spy++. If your getting the #32770 window, it should have a caption title?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 27th, 2005, 04:07 PM
#5
-
Feb 27th, 2005, 07:12 PM
#6
Re: Window class name "afxwnd42s"
here, i think this will help you find the form name easier:
VB Code:
Option Explicit
'Functions, constants and types for the hook
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" ( _
ByVal idHook As Long, _
ByVal lpfn As Long, _
ByVal hmod As Long, _
ByVal dwThreadId As Long _
) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" ( _
ByVal hHook As Long _
) As Long
Private Declare Function CallNextHookEx Lib "user32" ( _
ByVal hHook As Long, _
ByVal ncode As Long, _
ByVal wParam As Long, _
lParam As Any _
) As Long
Public Const WH_MOUSE_LL = 14
Public Type POINTAPI
x As Long
y As Long
End Type
Public Type MSLLHOOKSTRUCT
pt As POINTAPI
mouseData As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type
Private hHook As Long
Public IsHooked As Boolean
'functions for getting windows properties
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" ( _
ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long _
) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" ( _
ByVal hwnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long _
) As Long
Private Declare Function WindowFromPoint Lib "user32" ( _
ByVal xPoint As Long, _
ByVal yPoint As Long _
) As Long
Sub GetWindowData(x As Long, y As Long)
Dim hWndFrm As Long
Dim lpClassName As String, lpString As String
lpClassName = Space(100)
lpString = Space(100)
'get handle to window
hWndFrm = WindowFromPoint(CLng(x), CLng(y))
If hWndFrm = 0 Then Exit Sub
'get window text (caption)
Call GetWindowText(hWndFrm, lpString, Len(lpString))
'get window class name
Call GetClassName(hWndFrm, lpClassName, Len(lpClassName))
With Form1
.txthandle = Hex(hWndFrm)
.txtCaption = lpString
.txtClassName = lpClassName
End With
End Sub
Public Sub SetMouseHook()
If IsHooked Then
MsgBox "Don't hook the MOUSE_LL hook twice or you'll be sorry."
Else
'This has to be set up as a system-wide hook
hHook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf MouseProc, App.hInstance, 0)
IsHooked = True
End If
End Sub
Public Sub RemoveMouseHook()
Dim temp As Long
temp = UnhookWindowsHookEx(hHook)
IsHooked = False
End Sub
Public Function MouseProc(ByVal uCode As Long, ByVal wParam As Long, lParam As MSLLHOOKSTRUCT) As Long
If uCode >= 0 Then
Call GetWindowData(lParam.pt.x, lParam.pt.y)
End If
MouseProc = CallNextHookEx(hHook, uCode, wParam, lParam)
End Function
Added this to a form:
visual basic code:Option Explicit
'Always on top stuff
Private Const HWND_TOPMOST = -1
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long _
)
Private Sub cmdStart_Click()
'make window always on top
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or _
SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
'set the system-wide low level mouse hook
Call SetMouseHook
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call RemoveMouseHook
End Sub
you need three textboxes named txthandle, txtCaption, txtClassName
and a cmd button named cmdStart
--
Now, im having a similar problem. On the form there are 2 textboxes with teh same classname and caption, so i dont know how to send a message to one of them (it wont work just sending it)
-
Feb 27th, 2005, 07:16 PM
#7
Thread Starter
Junior Member
Re: Window class name "afxwnd42s"
 Originally Posted by RobDog888
Which Spy utility are you using? I only have M$ Spy++. If your getting the #32770 window, it should have a caption title?
I'm using PatorJK's API Spy. Weird thing is I can "Apply code" with it and it will click a button or whatever but the code itself is useless.
-
Feb 27th, 2005, 09:02 PM
#8
Re: Window class name "afxwnd42s"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 27th, 2005, 09:16 PM
#9
Thread Starter
Junior Member
Re: Window class name "afxwnd42s"
Handle = FindWindow("#32770", vbNullString)
B1 = FindWindowEx(Handle, 0&, "afxwnd42s", vbNullString)
B2 = FindWindowEx(B1, 0&, "afxwnd42s", vbNullString)
B3 = FindWindowEx(B2, 0&, "afxwnd42s", vbNullString)
afxwnds = FindWindowEx(B3, 0&, "afxwnd42s", vbNullString)
Call SendMessageLong(afxwnds, WM_LBUTTONDOWN, 0&, 0&)
Call SendMessageLong(afxwnds, WM_LBUTTONUP, 0&, 0&)
-
Feb 27th, 2005, 10:00 PM
#10
Re: Window class name "afxwnd42s"
You can also try using the PostMessage API with the BM_Click message instead of the SendMessageLong.
Why not add the window caption in the parameters for the FindWindowEx? If they are buttons then they
wont have any childern windows?
Is that correct for the window class for the buttons (afxwnd42s)???
Shouldnt the buttons class be "Button"?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|