SaphuA Posted July 31, 2008 Share Posted July 31, 2008 Hello, Is it possible to substract/use the icon that a window uses? I do not need the actual file; I just want to use the icon in my GUI. Thank you! http://www.saphua.com/ Link to comment Share on other sites More sharing options...
SaphuA Posted July 31, 2008 Author Share Posted July 31, 2008 I've been looking around a little and I guess I have to use something along the lines of 'SendMessageTimeout' or DLL-calls. The only problem is that I'm not that advanced with AutoIt yet. Anyone got some tips for me? http://www.saphua.com/ Link to comment Share on other sites More sharing options...
Vindicator209 Posted July 31, 2008 Share Posted July 31, 2008 Do you wish just to have the icon of something els to use in your program, or do you actually want something for autoit to take and use temporarily? If you just want an icon to compile with, look up the resource hacker thing [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
Zedna Posted July 31, 2008 Share Posted July 31, 2008 If I understand you right then use Scite4AutoIt3 and #AutoIt3Wrapper_Icon=your_app_icon.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\au3.ico #AutoIt3Wrapper_Res_Icon_Add=C:\Program Files\AutoIt3\Icons\filetype1.ico ... Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
SaphuA Posted August 1, 2008 Author Share Posted August 1, 2008 No you're both wrong. I want to use the icon of any window handle, and use that icon in my gui. Perhaps it's possible to see what executable file opened the window and use the icon from that executable? Thank you! http://www.saphua.com/ Link to comment Share on other sites More sharing options...
Zedna Posted August 1, 2008 Share Posted August 1, 2008 Look at _WinAPI_ExtractIconEx() and search forum for more examples. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
ProgAndy Posted August 1, 2008 Share Posted August 1, 2008 You have to use WM_GETICON http://msdn.microsoft.com/en-us/library/ms632625(VS.85).aspxThen you get a handle, whih represents the Icon and you can use it With WM_SETICON for your gui *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
rasim Posted August 1, 2008 Share Posted August 1, 2008 SaphuAThis?#include <WindowsConstants.au3> Global $GCL_HICONSM = -34 Global $GCL_HICON = -14 $hGUI = GUICreate("Test", 300, 200) GUISetState() Run("notepad.exe", "", @SW_MINIMIZE) WinWait("[Class:Notepad]") $hNotepad = WinGetHandle("[Class:Notepad]") MsgBox(0, "", "Change GUI icon") $hIcon = DllCall("user32.dll", "int", "GetClassLong", "hwnd", $hNotepad, "int", $GCL_HICON) $hIcon = $hIcon[0] If $hIcon = 0 Then $hIcon = DllCall("user32.dll", "int", "GetClassLong", "hwnd", $hNotepad, "int", $GCL_HICONSM) $hIcon = $hIcon[0] EndIf DllCall("user32.dll", "int", "SendMessage", "hwnd", $hGUI, "int", $WM_SETICON, "int", 1, "int", $hIcon) DllCall("User32.dll", "int", "DestroyIcon", "hwnd", $hIcon) WinClose($hNotepad) Do Until GUIGetMsg() = -3 Link to comment Share on other sites More sharing options...
SaphuA Posted August 2, 2008 Author Share Posted August 2, 2008 Seems like it! Awesome! Thanks http://www.saphua.com/ Link to comment Share on other sites More sharing options...
SaphuA Posted August 4, 2008 Author Share Posted August 4, 2008 Btw, I was just wondering, how do you guys know what functions these DLL's contain and how to use them? http://www.saphua.com/ Link to comment Share on other sites More sharing options...
ProgAndy Posted August 4, 2008 Share Posted August 4, 2008 E.g. from Microsoft MSDn -> WinAPI : http://msdn.microsoft.com/en-us/library/aa383749(VS.85).aspxor from examples in other languages like VB, delphi, ... *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
SaphuA Posted August 5, 2008 Author Share Posted August 5, 2008 Phew, I'm trying to get this to work with:http://www.autoitscript.com/forum/index.ph...l=ModernMenuRawBut I want to change the icons of the context menu items, but they don't accept a pointer, only a file.Is there a way I can either temporarily save the icon, make it accept pointers or are their alternate sources available like that one? http://www.saphua.com/ 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