rover Posted March 7, 2009 Posted March 7, 2009 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@YashiedI stand corrected if I've mistaken your intent I see fascists...
ResNullius Posted March 7, 2009 Posted March 7, 2009 @rover, Is the "DestroyIcon" dllCall necessary? Seems to work fine without it (on XP anyway).
James Posted March 7, 2009 Posted March 7, 2009 It's conventional. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
martin Posted March 8, 2009 Posted March 8, 2009 @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.
rover Posted March 8, 2009 Posted March 8, 2009 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.@ResNulliusAs the two handles to the icon are deleted from the WndClassEx struct the icon should be destroyed to free the memory as Martin saidand 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...
GEOSoft Posted March 8, 2009 Posted March 8, 2009 @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!"
Yashied Posted March 9, 2009 Author Posted March 9, 2009 (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). Thanks again. Edited March 9, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
rover Posted March 10, 2009 Posted March 10, 2009 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. @Yashied, Your welcomeThe word "prompt" I did not mean quick. I would say - a hint (advice). my mistake @GeOSoftThat is so nice that I turned it into a function to include in my dialog.au3 UDF (with your permission of course).No problem. 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...
GEOSoft Posted March 10, 2009 Posted March 10, 2009 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!"
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