Jump to content

Substract icon from window


Recommended Posts

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

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Phew, I'm trying to get this to work with:

http://www.autoitscript.com/forum/index.ph...l=ModernMenuRaw

But 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?

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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