新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Function f_WinExe(ByVal Exe As String) As Integer
Dim fh As Integer
Dim t As String * 1
fh = FreeFile
Open Exe For Binary As #fh
Get fh, 25, t
Close #fh
f_WinExe = (Asc(t) = &H40&)
End Function
Private Sub Command1_Click()
Dim strFN As String
strFN = App.Path & "\manongku.exe" '如果是exe文件显示-1
MsgBox f_WinExe(strFN)
strFN = App.Path & "\manongku.txt" '如果是不是exe文件显示0
MsgBox f_WinExe(strFN)
End Sub