Jump to content

Recommended Posts

Posted

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?

Posted

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]

Posted

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!

Posted

You have to use WM_GETICON :Phttp://msdn.microsoft.com/en-us/library/ms632625(VS.85).aspx

Then you get a handle, whih represents the Icon and you can use it With WM_SETICON for your gui :P

*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

Posted

SaphuA

This?

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

E.g. from Microsoft :P

MSDn -> WinAPI : http://msdn.microsoft.com/en-us/library/aa383749(VS.85).aspx

or 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

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
×
×
  • Create New...