Skip to main content
gamedev.net
🔒 Locked

Making A Window Minimize to Taskbar

Started by Cibressus Jul 14, 2004 at 2:46 PM 3 replies 1k views
Original Post
Cibressus
Cibressus
in WinAPI how do i make a window minimize to the taskbar?
darrylsh
darrylsh
ShowWindow(hWnd,SW_MINIMIZED);

Darryl
Anti-Sig: Do Not Read This Signature
zennehoy
zennehoy
Or did you mean the system tray (where the clock is?)
In that case, take a look at TaskBarAddIcon.
Cheers!
Zen
zennehoy
zennehoy
Oops, hehe.
Hadn't looked at it in a while: TaskBarAddIcon is a wrapper I wrote/ripped from somewhere else. Just for the record I've posted them below, cheers!
Zen
// TaskBarAddIcon - adds an icon to the taskbar status area. // Returns TRUE if successful, or FALSE otherwise. // hwnd - handle to the window to receive callback messages. // uID - identifier of the icon. // hicon - handle to the icon to add. // lpszTip - tooltip text. BOOL TaskBarAddIcon(HWND hwnd, UINT uID, HICON hicon, LPSTR lpszTip)  {	BOOL res;	NOTIFYICONDATA tnid;	tnid.cbSize = sizeof(NOTIFYICONDATA);	tnid.hWnd = hwnd;	tnid.uID = uID;	tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;	tnid.uCallbackMessage = TB_NOTIFYICON;	tnid.hIcon = hicon;	if(lpszTip)		lstrcpyn(tnid.szTip, lpszTip, sizeof(tnid.szTip));	else		tnid.szTip[0] = '\0';	res = Shell_NotifyIcon(NIM_ADD, &tnid); 	if(hicon) 		DestroyIcon(hicon);    return res; } // TaskBarDeleteIcon - deletes an icon from the taskbar //     status area. // Returns TRUE if successful, or FALSE otherwise. // hwnd - handle to the window that added the icon. // uID - identifier of the icon to delete. BOOL TaskBarDeleteIcon(HWND hwnd, UINT uID) {	BOOL res;	NOTIFYICONDATA tnid;	tnid.cbSize = sizeof(NOTIFYICONDATA);	tnid.hWnd = hwnd;	tnid.uID = uID;	res = Shell_NotifyIcon(NIM_DELETE, &tnid);	return res;}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.