Article ID: 113680
Article Last Modified on 1/9/2003
' Enter each of the following Declare statements as one, single line:
Declare Function GetModuleFileName Lib "Kernel"
(ByVal hModule As Integer, ByVal lpFilename As String,
ByVal nSize As Integer) As Integer
Declare Function GetWindowWord Lib "User" (ByVal hWnd As Integer,
ByVal nIndex As Integer) As Integer
Const GWW_HINSTANCE = (-6)
Sub Form_Load ()
Dim ModuleName As String
Dim FileName As String
Dim hInst, ret As Integer
ModuleName = String$(128, Chr$(0))
' Get the hInstance application:
hInst = GetWindowWord(Me.hWnd, GWW_HINSTANCE)
' Get the ModuleFileName:
' Enter the following two lines as one, single line:
ModuleName = Left$(ModuleName,
GetModuleFileName(hInst, ModuleName, Len(ModuleName)))
If (Len(ModuleName)) > 0 Then
' Get the "." in the file name. Then go back three characters.
' FileName should = \VB.EXE, so check for the backslash (\)
' because FileName could be GVB.EXE, which isn't the
' VB executable name:
FileName = Mid$(ModuleName, InStr(ModuleName, ".") - 3)
If FileName = "\VB.EXE" Then
MsgBox "In VB development Shell"
Else
MsgBox "Not in VB development Shell"
End If
End If
End Sub
Additional query words: 3.00
Keywords: KB113680