Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How To Obtain Icon Handle (HICON) Of Another Process?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Nov 23, 2008 3:09 pm    Post subject: How To Obtain Icon Handle (HICON) Of Another Process? Reply with quote

I thought of: My method is to create a .dll which you inject to the process, then it gets the structure within the process address, and loops till it hits the hIcon member, then when it returns true it creates a heap to send the information to my process and when i receive it i close the heap and call Shell_NotifyIcon() with NIM_DELETE flag and the icon handle i've got from the heap, will this work ?
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Sun Nov 23, 2008 6:08 pm    Post subject: Reply with quote

What structure are you talking about?
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Nov 23, 2008 7:25 pm    Post subject: Reply with quote

nog_lorp wrote:
What structure are you talking about?


I guess he wants to get the WndClass structure of another process
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Sun Nov 23, 2008 7:37 pm    Post subject: Reply with quote

Yeah, but there can be more than one WndClass with different icons.

I guess you could:
Use FindWindow to get the window, GetWindowClassEx to get the WNDCLASS, and then access the hIcon member (no looping needed... you just need to access WNDCLASS.hIcon).

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Nov 23, 2008 8:47 pm    Post subject: Reply with quote

Can't you just modify the icons with something like ResHacker?
_________________
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Nov 24, 2008 2:29 am    Post subject: Reply with quote

lurc wrote:
Can't you just modify the icons with something like ResHacker?


I don't want to modify the Icon, when i kill the process by getting it's id from PROCESSENTRY, its tray icon remains on the tray notification area, so i want to remove it instead of the user moving his mouse there so the icon would disappear.

nog_lorp: *NotifyIconDataW
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Mon Nov 24, 2008 3:28 am    Post subject: Reply with quote

How are you killing the process? Try post a WM_QUIT message to the main window handle, that should peform any necessary clean up and remove the tray icon.
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Nov 24, 2008 4:08 am    Post subject: Reply with quote

sloppy wrote:
How are you killing the process? Try post a WM_QUIT message to the main window handle, that should peform any necessary clean up and remove the tray icon.


Doesn't work, the tray icon still stays there.

I was thinking of using SendMessage to TrayNotifyWnd with WM_PAINT, not sure didn't work.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Mon Nov 24, 2008 6:02 am    Post subject: Reply with quote

You can simply send a WM_GETICON notification to the main window.
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Nov 24, 2008 6:12 am    Post subject: Reply with quote

Symbol wrote:
You can simply send a WM_GETICON notification to the main window.


Renko advised me that shit too, but if you read about it, it doesn't get the Tray Icon, only the Alt-Tab (LARGE) and the Window Caption (SMALL).
Back to top
View user's profile Send private message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Mon Nov 24, 2008 6:56 am    Post subject: Reply with quote

Try updating the notification window (you can get it if you debug explorer.exe)
pseudo code wrote:
t <- FindWindow("Shell_TrayWnd",NULL)
t <- FindWindowEx(t,NULL,"TrayNotifyWnd",NULL)
t <- FindWindowEx(t,NULL,"SysPager",NULL)
t <- FindWindowEx(t,NULL,"ToolbarWindow32",NULL)
UpdateWindow(t)
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Nov 24, 2008 7:11 am    Post subject: Reply with quote

DoomsDay: Thanks, i will try though UpdateWindow() is just sending the notification WM_PAINT.

Edit: Doesn't work, doesn't even find the class. :S

Edit2: Oh.. now i got it lol, i looked at nog_lorps link, thanks !.


Last edited by DeletedUser14087 on Mon Nov 24, 2008 7:26 am; edited 2 times in total
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Mon Nov 24, 2008 7:20 am    Post subject: Reply with quote

Interesting reading material:
http://www.codersource.net/forums/160/ShowPost.aspx

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Nov 24, 2008 7:27 am    Post subject: Reply with quote

nog_lorp wrote:
Interesting reading material:
http://www.codersource.net/forums/160/ShowPost.aspx


thanks, i'm looking at it and i realized that the tray is like a form in a form in a form lol.

So far this is what i got:

Code:
function GetTrayHWnd: HWnd;
var h: HWND;
begin
h := FindWindow('Shell_TrayWnd', nil);
 if h <> 0 then
  begin
   h := FindWindowEx(h, 0, 'TrayNotifyWnd', nil);
   if h <> 0 then
    begin
      h := FindWindowEx(h, 0, 'SysPager', nil);
      if h <> 0 then
       begin
        h := FindWindowEx(h, 0, 'ToolbarWindow32', nil);
        if h <> 0 then
         begin
          ShowMessage('Yep!'); //Debug check to ensure it is success
         end;
       end;
    end;
  end;
Result := h;
end;


Edit: I got the TrayWnd, but sending messages to it doesn't seem to change it or do anything, any ideas ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites