Jump to content
luger

MsgBox Titlebar Icon not showing.. :(

Recommended Posts

luger

Hello, My English is not good. :)

-->(The following picture)

sshot-11.png.28c2d9285061e41c102d456db74

#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?

Share this post


Link to post
Share on other sites
AutoBert

Try:        

MsgBox(0, "Help", "Help!",0,$Gui)

 

  • Like 1

Share this post


Link to post
Share on other sites
luger
18 minutes ago, AutoBert said:

Try:        

MsgBox(0, "Help", "Help!",0,$Gui)

 

sshot-12.png.ae80c86876c1d6a2766a046ec2c

there must be icon.. :)

Edited by luger

Share this post


Link to post
Share on other sites
luger

sshot-13.png.c12781cb6d1d6fb3afcc0478d85

Help me, will destroy anyone? (My English is not good.. :( )

Edited by luger

Share this post


Link to post
Share on other sites
luger

Anybody for resolving? Anyone who can help?

Edited by luger

Share this post


Link to post
Share on other sites
Danyfirex

I dont know why it does happen. But I wrote a way to show correct icon.

 

#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

  • Like 1

Share this post


Link to post
Share on other sites
luger

 

@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 by luger

Share this post


Link to post
Share on other sites
Danyfirex

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

 

Share this post


Link to post
Share on other sites
luger
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 by luger

Share this post


Link to post
Share on other sites
Skysnake

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?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×