dufran3 Posted April 10, 2007 Share Posted April 10, 2007 I want to create an icon on a GUI... $iKey = GUICtrlCreateIcon($LocalIconPath & 'key.ico','',390,473,16,16) oÝ÷ ØÚ0¶¶¢râ²Ø^æ§v©§"$"|vØb±·¥£Â)e®éíꮢÔÞ²Ú®¢×îËb¢|!z{az'(+'$yÚ'"Ëaz·Á¬¢f¤z+l¢ØZ¶+pYg¢×hj|)àºy^²À®_'íùÉbrJ'Ó«ë-J·à¥É(+ZºÚ"µÍÕRPÝÙ]Û][ ÌÍÚRÙ^K ÌÎN×ÕÝ ÌÎNÊH Link to comment Share on other sites More sharing options...
smashly Posted April 11, 2007 Share Posted April 11, 2007 (edited) There's probly a better way to do it... #include <GUIConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) GUICreate('Test', 130,100) $iKey = GUICtrlCreateIcon('Shell32.dll',45,20,20,16,16) GUICtrlSetOnEvent($iKey, '_Test') GUISetOnEvent($GUI_EVENT_CLOSE, 'Close') GUISetState() While 1 Sleep (10) WEnd Func _Test() $dll = DllOpen("user32.dll") If _IsPressed('11', $dll ) And _IsPressed('10', $dll) Then ;Press Ctrl + Shift (11 = Ctrl , 10 = Shift) ;;;; Your code here MsgBox(0,'', 'Yep') EndIf $dll = DllClose($dll) EndFunc Func Close() Exit EndFunc As you can see the _Test function is still called , but if the keys aren't pressed then it shouldn't launch the "Your code here". Cheers Edited April 11, 2007 by smashly Link to comment Share on other sites More sharing options...
therks Posted April 11, 2007 Share Posted April 11, 2007 That's not bad smashly, although putting the DllOpen/Close inside the function is kind of redundant to the point of using DllOpen/Close. The reason you use these functions is so that during the entirety of your script you only load the dll file once, and unload it once you're completely done with it. I would suggest the following modification: expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) Global $user32dll = DllOpen("user32.dll") GUICreate('Test', 130,100) $iKey = GUICtrlCreateIcon('Shell32.dll',45,20,20,16,16) GUICtrlSetOnEvent($iKey, '_Test') GUISetOnEvent($GUI_EVENT_CLOSE, 'Close') GUISetState() While 1 Sleep (10) WEnd Func _Test() If _IsPressed('11', $user32dll ) And _IsPressed('10', $user32dll) Then ;Press Ctrl + Shift (11 = Ctrl , 10 = Shift) ;;;; Your code here MsgBox(0,'', 'Yep') EndIf EndFunc Func Close() DllClose($user32dll) Exit EndFuncoÝ÷ Ø mz¹Ú¶+Þ(Ê·ö·®²)ඦzËéh¢¨uè§²×vÞ½éí^#]v(ëax%G+ºÚ"µÍÚ[ÛYH ÑÕRPÛÛÝ[Ë]LÉÝÂÚ[ÛYH ÓZØË]LÉÝÂÛØ[ ÌÍÝÙÌHÜ[ ][ÝÝÙÌ ][ÝÊBÕRPÜX]J ÌÎNÕÝ ÌÎNËLÌL BÌÍÚRÙ^HHÕRPÝÜX]RXÛÛ ÌÎNÔÚ[Ì ÌÎNË KMMBÕRTÙ]Ý]J BÚ[HB ÌÍÙÛHHÕRQÙ]ÙÊ BÝÚ]Ú ÌÍÙÛBØÙH ÌÍÚRÙ^BYÒÔÜÙY ÌÎNÌLIÌÎNË ÌÍÝÙÌ H[ÒÔÜÙY ÌÎNÌL ÌÎNË ÌÍÝÙÌ H[ÔÜÈÝ ÈÚY LHHÝLHÚY BÎÎÎÈ[ÝÛÙHBÙÐÞ ÌÎNÉÌÎNË ÌÎNÖY ÌÎNÊB[YØÙH ÌÍÑÕRWÑUSÐÓÔÑB^]ÛÜ[ÝÚ]ÚÑ[ÛÜÙJ ÌÍÝÙÌ Either of those should work. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
smashly Posted April 11, 2007 Share Posted April 11, 2007 Nice catch saunders Yep as you can tell I'm still very newb to autoit scripting and I have no gerat talent for it ...yet Most the time straight out logic fails me..lol Cheers Link to comment Share on other sites More sharing options...
dufran3 Posted April 11, 2007 Author Share Posted April 11, 2007 Sweet, that is exactly what I needed, thanks both of you! Link to comment Share on other sites More sharing options...
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