Jump to content

Recommended Posts

Posted

Excellent example rover, thanks.

In Yashied's defence, I think his use of the word "prompt" was an an interpretation of "advise" and not a request to be quick.

Thanks Martin

@Yashied

I stand corrected if I've mistaken your intent

I see fascists...

Posted

@rover,

Is the "DestroyIcon" dllCall necessary?

Seems to work fine without it (on XP anyway).

Since the window has been told there is no icon then it won't free the memory used by the icon when it closes, so I think that line is needed.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

Since the window has been told there is no icon then it won't free the memory used by the icon when it closes, so I think that line is needed.

@ResNullius

As the two handles to the icon are deleted from the WndClassEx struct the icon should be destroyed to free the memory as Martin said

and as James mentioned it's convention, or 'good form' and programming practices I guess. The memory would be freed when the script is exited anyway.

I removed the second destroyicon call for the small icon handle GCL_HICONSM as it always returned 0, even if deleted before GCL_HICON.

its a handle to the same resource anyway, maybe its just an alias to the GCL_HICON handle? I haven't checked MSDN on that one.

I see fascists...

Posted

@rover

That is so nice that I turned it into a function to include in my dialog.au3 UDF (with your permission of course).

;
#include <GUIConstantsEX.au3>
#include <WindowsConstants.au3>
$hGUI = _GUINoIcon("Test GUI", 300, 200)
GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func _GUINoIcon($sTitle, $iWidth = -1, $iHeight = -1, $iXpos = -1, $iYpos = -1)
   Local $GCL_HICONSM = -34, $GCL_HICON = -14
   Local $hWnd = GUICreate($sTitle, $iWidth, $iHeight, $iXpos, $iYpos, _
         BitOR($WS_CAPTION, $WS_SYSMENU), $WS_EX_DLGMODALFRAME)
   Local $hIcon = GetClassLong($hWnd, $GCL_HICON)
   DllCall("User32.dll", "int", "DestroyIcon", "hwnd", $hIcon)
   SetClassLong($hWnd, $GCL_HICON, 0)
   SetClassLong($hWnd, $GCL_HICONSM, 0)
   Return $hWnd
EndFunc  ;<==> _GUINoIcon()

Func GetClassLong($hWnd, $nIndex)
   Local $hResult = DllCall("user32.dll", "dword", "GetClassLong", "hwnd", $hWnd, "int", $nIndex)
   Return $hResult[0]
EndFunc  ;<==> GetClassLong()

Func SetClassLong($hWnd, $nIndex, $dwNewLong)
   Local $hResult = DllCall("user32.dll", "dword", "SetClassLong", "hwnd", $hWnd, "int", $nIndex, "long", $dwNewLong)
   Return $hResult[0]
EndFunc  ;<==> SetClassLong()
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted (edited)

Many thanks to you, rover! This is a great example! That's exactly what I wanted. Also thanks to all who have discussed this topic.

The word "prompt" I did not mean quick. I would say - a hint (advice). :unsure:

Thanks again.

:P

Edited by Yashied
Posted

Many thanks to you, rover! This is a great example! That's exactly what I wanted. Also thanks to all who have discussed this topic.

The word "prompt" I did not mean quick. I would say - a hint (advice). :(

Thanks again.

:unsure:

@Yashied, Your welcome

The word "prompt" I did not mean quick. I would say - a hint (advice). ;)

my mistake :P:D

@GeOSoft

That is so nice that I turned it into a function to include in my dialog.au3 UDF (with your permission of course).

No problem. :D

those API's already coded by others (lod3n, Rasim etc.) as is the WndClassEx struct (Kip)

I have a drop shadow UDF in the examples forum for adding shadows to forms and dialogs by adding the CS_DROPSHADOW style to the WndClassEx struct.

I see fascists...

Posted

great. Thank you and I'll take a look at the drop shadow as well.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...