Article ID: 177636
Article Last Modified on 6/29/2004
Option Explicit
Private Declare Function GetModuleFileName Lib "kernel32" _
Alias "GetModuleFileNameA" _
(ByVal hModule As Long, _
ByVal lpFileName As String, _
ByVal nSize As Long) As Long
Private Sub Form_Load()
'Set the command button names
Command1.Caption = "Different Project and Executable Names"
Command2.Caption = "Similar File Names"
End Sub
Private Sub Command1_Click()
'Click this button if the project name and the compiled file
'name are different.
MsgBox VB.App.EXEName
End Sub
Private Sub Command2_Click()
'Click this button if the project name and the compiled file
'name are the same.
Dim strFileName As String
Dim lngCount As Long
strFileName = String(255, 0)
lngCount = GetModuleFileName(App.hInstance, strFileName, 255)
strFileName = Left(strFileName, lngCount)
If UCase(Right(strFileName, 7)) <> "VB5.EXE" Then
MsgBox "Compiled Version"
Else
MsgBox "IDE Version"
End If
End Sub
118819 : How To Tell Whether an App Runs in VB Design Environment
Additional query words: exe executable running design-time run-time runtime kbVBp500 kbVBp600 kbIDE kbVBp kbdsd kbDSupport
Keywords: kbhowto kbgrpdsvb KB177636