Private Declare Function GetModuleFileName Lib "kernel32" Alias "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
Function IsRunUnderVB6() As Boolean
Dim s As String
Dim Length As Long
Length = 256
s = String(Length, 0)
GetModuleFileName 0, s, Length
s = Left(s, InStr(s, Chr(0)) - 1)
IsRunUnderVB6 = UCase(Right(s, 7)) = "VB6.EXE"
End Function
GetModuleFileName §ó¦hªº®ÉÔ¬O¥Î¨ÓÀò¨úÀ³¥Îµ{¦¡¦Û¤vªº°õ¦æÀÉ
³o®ÉÔ hModule ´N¬O 0
¥H¤Uµ{¦¡´N¬O³q¹L½Õ¥Î GetModuleFileName ¨Ó§PÂ_·í«e¬O¹B¦æ¦bVBÀô¹Ò¤¤¡A
ÁÙ¬O¹B¦æªº½sĶ«áªºEXEÀÉ
Function IsRunUnderVB6() As Boolean
Dim s As String
Dim Length As Long
Length = 256
s = String(Length, 0)
GetModuleFileName 0, s, Length
s = Left(s, InStr(s, Chr(0)) - 1)
IsRunUnderVB6 = UCase(Right(s, 7)) = "VB6.EXE"
End Function