Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

codemonkey

Creating "task bar" TSR's...how?

This topic is 6648 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am just wondering, for my basic need for knowledge, how to make an application minimize to the start menu (task bar thing). You know, that thingy near the clock :-) I notice every other program seems to do that now adays. I have a bazillion of them on my bar, and I want to know how to make one I haven''t seem to find anything in the MSDN...however I don''t know what to be looking for, hehe. Thanks a ton and a half. CodeMonkey

Share this post


Link to post
Share on other sites
Advertisement
You''re talkin'' ''bout MFC? Nah, this site is for game programmin''. So letz say ya wanna find codez for MFC, therez a site that I know of, offer quite number of solutionz to any problemz that ya might have.

http://www.codeguru.com

I just started to learn MFC also, but from what I know, it''z best to start with a MFC book say from MSPress. They mention before, the system tray (right side in the task bar) programmin'' kind da thinggy.

Urr, good luck man, for whatever ya programmin''.

Share this post


Link to post
Share on other sites
If you lookup some of the procedures and stuff in source-code below in some Win32 help, this could help you further...I hope...

    
//---------------------------------------------------------------------------

BOOL __fastcall Create(HWND hWnd)
{
HINSTANCE hInst = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);
NOTIFYICONDATA tnid;

tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = hWnd;
tnid.uID = IDI_TASKBAR;
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnid.uCallbackMessage = WM_NOTIFYICON;
tnid.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_TASKBAR));
LPSTR lpszTip = "3D Graphic Controls";
lstrcpyn(tnid.szTip, lpszTip, sizeof(tnid.szTip));

return Shell_NotifyIcon(NIM_ADD, &tnid);
}
//---------------------------------------------------------------------------

BOOL __fastcall Destroy(HWND hWnd)
{
NOTIFYICONDATA tnid;

tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = hWnd;
tnid.uID = IDI_TASKBAR;

return Shell_NotifyIcon(NIM_DELETE, &tnid);
}
//---------------------------------------------------------------------------

LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{ case WM_CREATE:
{ Create(hWnd);
return 0;
}
case WM_DESTROY:
{ Destroy(hWnd);
PostQuitMessage(0);
return 0;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);
}


Share this post


Link to post
Share on other sites
i wrote two smaples ...
so check''em out

http://workspot.net/~kondor/tutors/windows/systray.html

good luck!

Share this post


Link to post
Share on other sites
Baling, I know this is a game developer site, hence "Gamedev.net" However, that does not mean that I do not need the system tray code, and believe it or not it is for developing my game network server testbed. Yes, I am using MFC, I''ve used it for the past two years.

baskuenen, that''s for the code snippet. I''ll try it out and see what occurs. Heheh.

CodeMonkey

Share this post


Link to post
Share on other sites
Arkon, thanks a lot! I downloaded those samples, and will see what you did. I got it working with the code snippet from baskuenen, but I am still a little confused on one area. I have my main client window, and now I have this little icon However I''d like to attach some type of context menu so that if you right click on the icon it pop''s up with a set of options. You know, like how every other systray icon works.

The problem is I don''t know where to attach the context menu, and if I wanted to pop it up based on x,y coordinates then I''d need to know what coordinates they are. The callback message that you can have sent to your main window only passes the mouse message, and the ID to the systray icon. However, it doesn''t send the coordinates of the right click, so you can''t just "popup" a menu. Any ideas? Arkon, if your code example does this, then I guess you can disregard this rambling... hehe

Thanks,

CodeMonkey

Share this post


Link to post
Share on other sites
You could try catching the WM_LBUTTONDOWN/WM_LBUTTONUP in above WndProc.
The mouse coords can be found with GetCursorPos();
You can use the TrackPopupMenu() to display the popupmenu.


Share this post


Link to post
Share on other sites
Just wanted to post two clarifications:

First:
The thingy near the clock is called the "systray", so that should help people look up assistance on coding for it.

Second:
Making an application use the systray, or any other Windows feature is in NO WAY related to MFC programming - conrary to what Baling said. I have been writing for Windows for 3 years now, creating windows and using the API and such, and have not used MFC since 2.5 years ago when I had a college course which made us. MFC is almost exclusively a set of class wrappers for Windows API functions, along with a certain model for coding standard Windows applications. It's a fine programming model, which I have never decided to use - due to my games need to behave somewhat outside of the norm. If mastering MFC it took no time, then I am almost positive my code would become a mix of: C++ library classes and functions, Windows API calls, my own class heirarchy, MFC's class library, DirectX and other COM services.

USE WHATEVER TOOLS YOU HAVE AVAILIBLE TO GET THE JOB DONE!

Edited by - Xai on September 3, 2000 4:50:10 PM

Share this post


Link to post
Share on other sites
baskuenen & arkon, you guys rock The hold up on my part was due to GetCursorPos(). For the life of me I could not find the api that would give me this functionality I found it in Arkon''s example code, and then came out here and saw that Baskuenen re-inforced that idea. It works! It wasn''t a matter of "if" and "how" but "what is the API call called?" I was thinking more on the line of "GetMousePos" or something with mouse in it... not cursor. Oh well.

Xai, good call! I''m writing my code in MFC just because I like it better then Win32 "old school" way. I''ve done both for a few years, and I can swap back and forth and read either of them (hmm...multi-lingual?). Bailing was just being a little ignorant to that whole ideal, but that''s ok because I know Bailing meant well. All the code you guys have supplied, and examples, all work well after I converted what I needed to MFC calls

Again, thanks for the help. I hope I can help you on your next questions!

CodeMonkey

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!