Skip to main content
GameDev.net gamedev.net
🔒 Locked

Taskbar & WS_EX_TOOLWINDOW

Started by MetaCipher Jul 3, 2007 at 11:17 AM 7 replies 9.5k views
Original Post
MetaCipher
MetaCipher
I am initializing a Win32 window with SDL, grabbing the handle, and creating a tray icon. This all works fine, but when I attempt to change the Exstyle to WS_EX_TOOLWINDOW to hide the button from the taskbar it still shows up (though, it doesn't show up on the Alt+Tab window which is correct). I am using SetWindowLong to change the Exstyle. Also, right clicking the taskbar button doesn't bring up a Context menu either. I am not really sure why it is doing this. Code: SDL_SysWMinfo Info; SDL_VERSION(&Info.version); SDL_GetWMInfo(&Info); SetWindowLong(Info.window, GWL_EXstyle, WS_EX_TOOLWINDOW); WindowHandle = Info.window; //Declared elsewhere... //Other code for Tray, etc... ShowWindow(WindowHandle, SW_HIDE); UpdateWindow(WindowHandle);
CrazyCdn
CrazyCdn
I'll assume you ment GWL_EXstyle not GWL_EXstyle... ?

Also you'll need to post more code likely before we can help you.

Edit: What the heck, I put in GWL_EX... all in caps and it for some reason makes style lower case. Someone broke something on these forums someplace.

So OP I'll assume yours was all uppercase also.
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin
MetaCipher
MetaCipher
Quote:
Original post by Mike2343
I'll assume you ment GWL_EXstyle not GWL_EXstyle... ?

Also you'll need to post more code likely before we can help you.


GD apparently has something that is changing the capitalization of the word style. But, yes, it should be all caps of course.

Anyway, here is more code:

SDL_SysWMinfo Info;SDL_VERSION(&Info.version);SDL_GetWMInfo(&Info);SetWindowLong(Info.window, GWL_EXstyle, WS_EX_TOOLWINDOW);SetWindowLong(Info.window, GWL_style, WS_POPUP);WindowHandle = Info.window;if(OpenGL_OnInit() == false) {    return false;}TrayIcon.cbSize 	= sizeof(NOTIFYICONDATA);TrayIcon.uID 		= WM_ID_TRAYICON;TrayIcon.uFlags 	= NIF_ICON | NIF_MESSAGE | NIF_TIP;TrayIcon.hIcon 		= (HICON)LoadImage(NULL, "icon.ico", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_LOADFROMFILE);TrayIcon.hWnd 		= WindowHandle;TrayIcon.uCallbackMessage = WM_ONMESSAGE_TRAYICON;Shell_NotifyIcon(NIM_ADD, &TrayIcon);Menu = CreatePopupMenu();AppendMenu(Menu, MF_STRING, WM_ID_EXIT, "E&xit");RECT DesktopRect;SystemParametersInfo(SPI_GETWORKAREA, 0, &DesktopRect, 0);SetWindowPos(WindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE);ShowWindow(WindowHandle, SW_HIDE);UpdateWindow(WindowHandle);
Black Knight
Black Knight
Try using SetWindowPos on the Info.window.

Read here : MSDN

In order for the changes made by SetWindowLong to take effect you need to call SetWindowPos with SWP_FRAMECHANGED.
Maybe that fixes the problem.
Black Knight
Black Knight
SetWindowLong(WindowHandle,
GWL_EXstyle,
(GetWindowLong(WindowHandle,GWL_EXstyle) | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW);

Found this over here :
http://episteme.arstechnica.com/eve/ubb.x/a/tpc/f/6330927813/m/190001652731/r/953007043731

Says you need to remove WS_EX_APPWINDOW from the window let me know if that works I may need this sometime too [smile]
Mastaba
Mastaba
When the window is first made without the WS_EX_TOOLWINDOW style, CreateWindow creates the taskbar button. When the style is removed with SetWindowLong, it doesn't touch the taskbar button. What will make the taskbar button disappear is ShowWindow(hWnd, SW_HIDE). So hide the window, change the extended style, then reshow the window.

Topic Locked

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

Sign in to reply to this topic.