…so , what I had tried to say before was … that … I had continued my research….
I often came/come across something called
Microsoft Spy++ which gets info about windows. It’s only for things going on at the time, but it is a start at getting that Class name thing, since apparently it shows those, amongst other things. Unfortunately it is a tool in Visual Studio, and I don’t feel like overstretching my brains capture capacity and going off in yet another tangent to get into Visual Studio.
A few suggested sources of getting
Microsoft Spy+ without Visual Studio did not work, :(
There are a few things claiming to be a third party equivalent. I have not found and tried them all out yet, but to be going on with
this one seems a nice small portable one and is working well for me across a few computers and operating systems, :). (Some bigger things I tried needing instillations and sometimes caused some crashes or slowed my computer down, so for the time being I will forget those for a while.)
There seems to be rather a lot of Class Names found by these "
Windows Spy++ things", but a nice characteristic of these tools, perhaps, is that you can
drag something into a window , and it will then
tell you stuff about that window , amongst other things that
Class Name thing , and this little portable one is allowing me to
highlight and copy the name .
Hmm…. I researched further
Observation 1
So I amused myself for a few hours with codings like this. For what purpose I don’t know, yet
Code: Select all
Option Explicit
' https://eileenslounge.com/viewtopic.php?p=321874#p321874
Private Declare Function APIssinUserDLL_MsgBox_NonModal Lib "user32" Alias "MessageBoxA" (Optional ByVal hwnd As Long, Optional ByVal Prompt As String, Optional ByVal Title As String, Optional ByVal buttons As Long) As Long '
Private Declare Function FindWndNumber Lib "user32" Alias "FindWindowA" (Optional ByVal lpClassName As String, Optional ByVal lpWindowName As String) As Long
Sub TestWndBreaks() ' http://www.eileenslounge.com/viewtopic.php?f=18&t=28885#p223583
Debug.Print Application.Name ' & " " & Application.hwnd ' Application.hwnd only works in Excel
Dim ClsNames() As Variant, NmeSteer As Variant
' Excel , Word
Let ClsNames() = Array("XLMAIN", "OpusApp")
Dim Response As Long, WndNumber As Long
For Each NmeSteer In ClsNames()
Let WndNumber = FindWndNumber(lpClassName:="" & NmeSteer & "", lpWindowName:=vbNullString): Debug.Print NmeSteer & " " & WndNumber '
Let Response = APIssinUserDLL_MsgBox_NonModal(hwnd:=WndNumber, Prompt:="Q_- Where am I, the MessageBoxA?" & vbCrLf & "I used" & vbCr & vbLf & "(lpClassName:=""" & NmeSteer & """, lpWindowName:=vbNullString)" & vbCr & vbLf & "to get" & vbCr & vbLf & "hWnd which was " & WndNumber & "", Title:="Experimanting with lpClassName:= ", buttons:=vbOKOnly) '
Next NmeSteer
End Sub
I did notice something rather strange, strange that is, when bearing in mind two things:
_1 MessageBox
A is similar to the standard VBA MsgBox except that it is non model, which means that when its up you can still select things
_2 XLMAIN is something important to do with Excel, something to do with a main window. (OpusApp is something like the equivalent in Word)
Well, here is the strange thing: (assume you have Word and Excel open); ….
_ use the hwnd of XLMAIN, (like the coding does in the first loop), and then the MessageBoxA is up, but it loses its non modalability just in Excel.;
_ use the hwnd of OpusApp, (like the coding does in the second loop), and then the MessageBoxA is up, but it loses its non modalability just in Word.
You could sort of say like … tie it into the window you want to use it in and that will break it, or break its non modalabilityx at least.??
???? Maybe the standard VBA MsgBox as we know it, is the MessageBoxA "tied" into a spreadsheet, and so it losses its non modalability, (by design or accident)???
_._________________
Observation 2
A further observation…
_... this could be helpful to reference in the future from a few other places, so for better organising I will post that in the next post…