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 


[C++ help] Using the Windows toolbar

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 4:10 pm    Post subject: [C++ help] Using the Windows toolbar Reply with quote

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
View user's profile Send private message Visit poster's website
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon Feb 09, 2009 5:31 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Mon Feb 09, 2009 5:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon Feb 09, 2009 5:40 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
talkerzero
Grandmaster Cheater
Reputation: 1

Joined: 24 Jul 2008
Posts: 560
Location: California

PostPosted: Mon Feb 09, 2009 5:40 pm    Post subject: Reply with quote

Thanks, figured it out.
Back to top
View user's profile Send private message Visit poster's website
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