| View previous topic :: View next topic |
| Author |
Message |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sun Nov 23, 2008 3:09 pm Post subject: How To Obtain Icon Handle (HICON) Of Another Process? |
|
|
| 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 |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Sun Nov 23, 2008 6:08 pm Post subject: |
|
|
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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Nov 23, 2008 7:25 pm Post subject: |
|
|
| nog_lorp wrote: | | What structure are you talking about? |
I guess he wants to get the WndClass structure of another process
|
|
| Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Sun Nov 23, 2008 7:37 pm Post subject: |
|
|
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 |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Nov 23, 2008 8:47 pm Post subject: |
|
|
Can't you just modify the icons with something like ResHacker?
_________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Nov 24, 2008 2:29 am Post subject: |
|
|
| 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 |
|
 |
sloppy Expert Cheater
Reputation: 0
Joined: 17 Aug 2008 Posts: 123
|
Posted: Mon Nov 24, 2008 3:28 am Post subject: |
|
|
| 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 |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Nov 24, 2008 4:08 am Post subject: |
|
|
| 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 |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Nov 24, 2008 6:02 am Post subject: |
|
|
| You can simply send a WM_GETICON notification to the main window.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Nov 24, 2008 6:12 am Post subject: |
|
|
| 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 |
|
 |
DoomsDay Grandmaster Cheater
Reputation: 0
Joined: 06 Jan 2007 Posts: 768 Location: %HomePath%
|
Posted: Mon Nov 24, 2008 6:56 am Post subject: |
|
|
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 |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Nov 24, 2008 7:11 am Post subject: |
|
|
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 |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Mon Nov 24, 2008 7:20 am Post subject: |
|
|
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 |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Nov 24, 2008 7:27 am Post subject: |
|
|
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 |
|
 |
|