本帖最后由 afan 于 2022-10-14 21:28 编辑
“...在桌面上建立快捷方式...” 这个有什么关系……
拖放用事件模式
Opt("GUIOnEventMode", 1)
Local $Width = 480
Local $Height = 100
GUICreate("可执行文件版本信息", $Width, $Height, @DesktopWidth - $Width - 8, 4, -1, BitOR(16 + 8, 256 + 8))
GUISetOnEvent(-3, '_Exit')
GUISetOnEvent(-13, '_GetInfo_DragFile')
GUICtrlCreateButton("浏览(&B)", 8, 10, 52, 20)
GUICtrlSetOnEvent(-1, "_GetInfo_FileSelect")
Global $InputFile = GUICtrlCreateInput("", 70, 12, 400, 16)
GUICtrlSetState(-1, 8)
GUICtrlCreateLabel("合法版权", 10, 34)
Global $LegalCopyright = GUICtrlCreateInput("", 70, 32, 400, 16)
GUICtrlCreateLabel("公司名称", 10, 54)
Global $CompanyName = GUICtrlCreateInput("", 70, 52, 400, 16)
GUICtrlCreateLabel("文件版本", 10, 74)
Global $FileVersion = GUICtrlCreateInput("", 70, 72, 400, 16)
GUISetState(@SW_SHOW)
Local $iMsg, $File
While 1
Sleep(1000)
WEnd
Func _GetInfo_FileSelect()
Local $File = FileOpenDialog("请选择一个可执行文件。", @WindowsDir & "", "可执行文件 (*.exe)", 1)
If @error Then Return
__GetVersionInfo($File)
EndFunc ;==>_GetInfo_FileSelect
Func _GetInfo_DragFile()
__GetVersionInfo(@GUI_DragFile)
EndFunc ;==>_GetInfo_DragFile
Func __GetVersionInfo($File)
GUICtrlSetData($InputFile, $File)
GUICtrlSetData($LegalCopyright, FileGetVersion($File, "LegalCopyright"))
GUICtrlSetData($CompanyName, FileGetVersion($File, "CompanyName"))
GUICtrlSetData($FileVersion, FileGetVersion($File))
Local $IS = "AppCopyright=" & GUICtrlRead($LegalCopyright) & @CRLF & "AppPublisher=" & GUICtrlRead($CompanyName) & @CRLF & "VersionInfoVersion=" & GUICtrlRead($FileVersion)
ClipPut($IS)
EndFunc ;==>__GetVersionInfo
Func _Exit()
Exit
EndFunc ;==>_Exit
|