Originally Posted by
Aflatoon
What would be the point in setting a breakpoint in code that cannot possibly run or be compiled?
If Question = FriendlyJab then
Answer = "Ouch! Ouch! Ouch! Okay, I suppose I deserved that one."
ElseIf Question = ProvokeThinkingOnMyEnd
Answer = LotsOfLuckWithThat
Else
Answer = SeeBelow
Hi Aflatoon,
Well yeh, I wasn't really thinking it all the way through. The minimal brain waves available came up with "Huh? I wonder if I misspell a variable, whether even that would be caught?". Thinking it through, I imagine not, as it either compiles or does not...
Okay, so myabe you provoked a little bit of thought :-)
well, I am going to "cheat" a bit and ask an "extra" question. Disregarding any missing declared procedures or missing written procedures, does this look correct? Soecifically, I copied just enough of what I had written tonight at work, to cover how I am providing conditional:
Declared procedures
Variable declaration
Written procedures
#If VBA7 Then
Public Declare PtrSafe Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As LongPtr, _
ByVal lpString As String, _
ByVal cch As Long _
) As Long
#Else
Public Declare Function GetWindowText Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd As Long, _
ByVal lpString As String, _
ByVal cch As Long _
) As Long
#End If
Sub test()
Dim lRet As Long
#If VBA7 Then
Dim hwndDesktop As LongPtr
Dim lParam As LongPtr
#Else
Dim hwndDesktop As Long
Dim lParam As Long
#End If
hwndDesktop = GetDesktopWindow()
lRet = EnumChildWindows(hwndDesktop, AddressOf EnumChildProc, lParam)
MsgBox ETermRunning("E-Term32.exe")
End Sub
#If VBA7 Then
Private Function EnumChildProc(ByVal lpHwnd As LongPtr, ByVal lpParam As LongPtr) As Long
Dim lRet As Long
Dim sWinClassBuff As String * 255
Dim sWinTitleBuff As String * 255
Dim sWinClass As String
Dim sWinTitle As String
lRet = GetClassName(lpHwnd, sWinClassBuff, 255)
sWinClass = StripNulls(sWinClassBuff)
lRet = GetWindowText(lpHwnd, sWinTitleBuff, 255)
sWinTitle = StripNulls(sWinTitleBuff)
Debug.Print " Child Class = "; sWinClass; ", Title = "; sWinTitle
EnumChildProc = True
End Function
#Else
Function EnumChildProc(ByVal lhWnd As Long, ByVal lParam As Long) As Long
Dim lRet As Long
Dim sWinClassBuff As String * 255
Dim sWinTitleBuff As String * 255
Dim sWinClass As String
Dim sWinTitle As String
lRet = GetClassName(lhWnd, WinClassBuf, 255)
sWinClass = StripNulls(sWinClassBuff)
lRet = GetWindowText(lhWnd, sWinTitleBuff, 255)
sWinTitle = StripNulls(sWinTitleBuff)
Debug.Print " Child Class = "; WinClass; ", Title = "; WinTitle
EnumChildProc = True
End Function
#End If
In close, I am unfortunately, quite the 'babe in the woods' reference API. In this particular case, I did manage to get Excel (though I used Word's DDE) to extract data from a terminal emulator. When due to a new goal, I ran some the old code, it pretty much blew up. I'm just starting to sort the causes, but appears to be related to the OS we previously used (XP 32-bit) and what is slowly replacing (WIN7 64-bit). (And frankly, I have no idea currently as to why we are loading 64-bit currently)
Of course, thank you so much for your guidance and help,
Mark