開発環境からの起動か、EXEからの実行かを判断する(API編)
'開発環境からの起動か、EXEからの実行かを判断する(API編) ' dai 2001/07/05 (木)10:12 'モジュール名を得る(宣言部) Private Declare Function GetModuleFileName Lib "kernel32" _ Alias "GetModuleFileNameA" _ (ByVal hModule As Long, _ ByVal lpFileName As String, _ ByVal nSize As Long) As Long Public Function IsIDE() As Boolean 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") Or _ (UCase(Right(strFileName, 7)) = "VB6.EXE") Then Debug.Print "開発環境です" IsIDE = True Else Debug.Print "コンパイルして実行してます" IsIDE = False End If End Function