Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
InIDE in non forms based apps.
Message
From
12/12/2000 14:48:51
 
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
InIDE in non forms based apps.
Miscellaneous
Thread ID:
00452447
Message ID:
00452447
Views:
62
I use the following code to determine if I am 'in' the IDE. This works fabu if there is a form in the app. In other apps I need a way to make the same determination. I don't want to look for the running VB.EXE as I may compile and run the compiled file from another app in the IDE...

Anyone have any good ideas?


'***** Code follows
Option Explicit
' ---- Used in InIde() function.
' get window word constants
Public Const GWW_HWNDPARENT = (-8)
Public Declare Function GetWindowWord Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Integer
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

' ------------------------------------------------------------------------------------
' ROUTINE:.....InIDE:BOOL, Params( inhwnd InputOnly )
' Purpose:.....To determine if the program is running in the Integrated Development Environment
' Description:.Uses the class of the hidden parent window to determine if the program
' is running in the IDE or is compiled into an EXE.
' INPUT:.......inhwnd -- the window handle of the calling window
' OUTPUT:......Return code is True if the program is running in the IDE, False if it is an EXE
' ------------------------------------------------------------------------------------
Public Function InIDE(ByVal inhwnd As Integer) As Integer
Dim parent%, pclass$, nlen%

parent% = GetWindowWord(inhwnd, GWW_HWNDPARENT)
pclass$ = Space$(32)
nlen% = GetClassName(parent%, pclass$, 31)
pclass$ = Left$(pclass$, nlen%)

If InStr(pclass$, "RT") Then ' Look for thunder forms...
InIDE = False
Else ' ok we must be in the IDE
InIDE = True
End If

End Function
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Next
Reply
Map
View

Click here to load this message in the networking platform