luger Posted February 12, 2016 Posted February 12, 2016 Hello, My English is not good. -->(The following picture) #pragma compile(Out, example.exe) #pragma compile(Icon, black.ico) #include <GUIConstantsEx.au3> $Gui = GUICreate("Gui", 150, 50) $button = GUICtrlCreateButton("Help", 32, 13, 80, 24) GUISetState(@SW_SHOW) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($Gui) Exit Case $button MsgBox(4096, "Help", "Help!") EndSwitch WEnd Icon ---> black.ico This problem stems from? I can not solve. Why so?
AutoBert Posted February 12, 2016 Posted February 12, 2016 Try: MsgBox(0, "Help", "Help!",0,$Gui) luger 1
luger Posted February 12, 2016 Author Posted February 12, 2016 (edited) 18 minutes ago, AutoBert said: Try: MsgBox(0, "Help", "Help!",0,$Gui) there must be icon.. Edited February 12, 2016 by luger
luger Posted February 15, 2016 Author Posted February 15, 2016 (edited) Help me, will destroy anyone? (My English is not good.. ) Edited February 15, 2016 by luger
luger Posted February 16, 2016 Author Posted February 16, 2016 (edited) Anybody for resolving? Anyone who can help? Edited February 16, 2016 by luger
Danyfirex Posted February 16, 2016 Posted February 16, 2016 I dont know why it does happen. But I wrote a way to show correct icon. expandcollapse popup#NoTrayIcon #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> #include <SendMessage.au3> #include <WinAPISys.au3> #include <GUIConstantsEx.au3> #pragma compile(Out, example.exe) #pragma compile(Icon, black.ico) #Region Globals Global $hEventProc = 0 Global $hEventHook = 0 Global Const $ICON_BIG = 1 Global $hIcon=0 #EndRegion Globals $hGUI = GUICreate("GUI", 150, 50) $button = GUICtrlCreateButton("Help", 32, 13, 80, 24) GUISetState(@SW_SHOW) $hIcon = _GetClassLongPtr($hGUI, $GCL_HICONSM) _RegisterOwnMessageHandler() Func _GetClassLongPtr($hwindow, $nIndex) ;GetClassLongPtr 64 Return DllCall("User32.dll", "ULONG_PTR", "GetClassLong", "handle", $hwindow, "int", $nIndex)[0] EndFunc ;==>_GetClassLongPtr While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete($hGUI) _FreeHandles() Exit Case $button MsgBox(4096, "Help", "Help!") EndSwitch WEnd Func _FreeHandles() If $hEventHook Then _WinAPI_UnhookWinEvent($hEventHook) If $hEventProc Then DllCallbackFree($hEventProc) $hEventHook = 0 $hEventProc = 0 EndFunc ;==>_FreeHandles Func _RegisterOwnMessageHandler() If $hEventProc Or $hEventProc Then _FreeHandles() EndIf $hEventProc = DllCallbackRegister('_EventProc', 'none', 'ptr;dword;hwnd;long;long;dword;dword') If $hEventProc = 0 Then Return False $iRegistered = OnAutoItExitRegister('_FreeHandles') If $iRegistered = 0 Then Return False $hEventHook = _WinAPI_SetWinEventHook($EVENT_SYSTEM_ALERT, $EVENT_SYSTEM_ALERT, DllCallbackGetPtr($hEventProc)) If $hEventHook = 0 Then Return False Return True EndFunc ;==>_RegisterAutoitMsgErrorHandler Func _EventProc($hEventHook, $iEvent, $hWnd, $iObjectID, $iChildID, $iThreadId, $iEventTime) #forceref $hEventHook, $iObjectID, $iChildID, $iThreadId, $iEventTime If WinGetProcess($hWnd) = @AutoItPID Then _SendMessage($hWnd, $WM_SETICON, $ICON_BIG, $hIcon) EndIf EndFunc ;==>_EventProc Saludos luger 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
luger Posted February 16, 2016 Author Posted February 16, 2016 (edited) @Danyfirex : Thank you so much.. Working. Why not an easier way? (Msgbox(Here adjust easily possible , "", "")) Thank you.. Thank you.. I am very happy.. :)) Edited February 16, 2016 by luger
Danyfirex Posted February 17, 2016 Posted February 17, 2016 Hi. I'm not sure if messagebox has an easy way for that. so the script I wrote avobe is the easier I found. You're Welcome. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
luger Posted February 17, 2016 Author Posted February 17, 2016 (edited) 4 hours ago, Danyfirex said: Hi. I'm not sure if messagebox has an easy way for that. so the script I wrote avobe is the easier I found. You're Welcome. Saludos I understand you.. Thanks again.. Edited February 17, 2016 by luger
Skysnake Posted February 17, 2016 Posted February 17, 2016 Hi Not sure if this is the point. MsgBox comes predefined with limited icon options. Gui's run as scripts inside AU3 will not show their icons. (this is what Danyfirex fixed...) You already have a pragma setting, I use this at compile time : #AutoIt3Wrapper_Icon=RosterGriffin.ico And when compiled as an EXE then it shows the right icon. Hope that helps. Skysnake Why is the snake in the sky?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now