 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Mon Feb 09, 2009 4:10 pm Post subject: [C++ help] Using the Windows toolbar |
|
|
| You know how if you're using Windows, on the bottom toolbar, on the very right, there's little icons next to the clock, right? How can I make my application minimize to that tray with its own little icon?
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Feb 09, 2009 5:31 pm Post subject: |
|
|
NOTIFYICONDATA Structure
Shell_NotifyIcon() API
CreateMenu
AppendMenu
DestroyWindow
SetForegroundMenu
TrackPopupMenu
| Code: |
#define TASKMSG WM_USER+0x0300
#define TASKBAR 100
#define RESTORE 101
#define EXIT 102
void AddIcon() {
NOTIFYICONDATA nid;
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hWnd;
nid.uID = TASKBAR;
nid.uFlags = NIF_MESSAGE | NIF_ICON;
nid.uCallbackMessage = TASKMSG;
nid.hIcon = LoadIcon(NULL, IDI_APPLICATION);
Shell_NotifyIcon(NIM_ADD, &nid);
}
void ShowMenu() {
POINT point;
GetCursorPos(&point);
HMENU hMenu = CreateMenu();
AppendMenu(hMenu, MF_STRING, RESTORE, "Restore");
AppendMenu(hMenu, MF_SEPERATOR, 0, 1);
AppendMenu(hMenu, MF_STRING, EXIT, "Exit");
SetForegroundWindow(hwnd);
TrackPopupMenu(hMenu, TPM_BOTTOMALIGN, point.x, point.y, 0, hWnd, NULL);
DestroyMenu(hMenu);
}
//coding
//this code is within the message handler
case TASKMSG:
switch(LOWORD(lParam)) {
case WM_CONTEXTMENU:
ShowMenu();
break;
case WM_LBUTTONDBLCLK:
ShowWindow(hWnd, SW_NORMAL);
break;
}
break;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case RESTORE:
ShowWindow(hWnd, SW_NORMAL);
break;
case EXIT:
PostQuitMessage(0);
break;
}
break;
|
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Mon Feb 09, 2009 5:35 pm Post subject: |
|
|
Well first of all, that would be the system tray.
Second,
Handle WM_SIZE, Fill a NOTIFYICONDATA struct, Shell_NotifyIcon, then handle the ID you gave in the NOTIFYICONDATA struct in your WndProc as well, for WM_CONTEXTMENU/WM_RBUTTONDOWN/WM_LBUTTONDOWN/etc.
For the menu just CreatePopupMenu, Insert items to it, TrackPopupMenu and destroy it.
Then you'll be able to have a system tray icon in there, with its own little icon, and its own little menu.
@oib111: Don't feed him, let him figure things out on his own.
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Feb 09, 2009 5:40 pm Post subject: |
|
|
Heh, I know not to spoonfeed, I just happened to have a snippet.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
talkerzero Grandmaster Cheater
Reputation: 1
Joined: 24 Jul 2008 Posts: 560 Location: California
|
Posted: Mon Feb 09, 2009 5:40 pm Post subject: |
|
|
| Thanks, figured it out.
|
|
| Back to top |
|
 |
|
|
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
|
|