Prevent splash-screen showing an icon in the start-bar - winapi

For a game project, we found some old win32 code on the web to display a splash-screen, and I noticed it puts an icon on the start-bar. This looks weird because then when the app creates its own window, you see the icon in the startbar disappear and reappear as the splash window is destroyed and the main app window created.
Is it possible to make the splash-screen HWND not shown on the start-bar with some style or window class setting?

For my splash screens I use these extendes window styles: WS_EX_TOOLWINDOW|WS_EX_TOPMOST
and these window styles: WS_POPUP|WS_VISIBLE
No taskbar icon shows up with this combination of styles.

There are multiple ways. One is to make it owned by another top-level window that is hidden.
For example, you can create your main window, but don't show it. Then create the splash screen as an owned window (with your main window as the owner). Show the splash screen. Do your initialization. Then show the main window and destroy the splash screen.

Related

Detect show/hide Task View (Win+Tab)

I'm developing a Application Desktop Toolbar (next Toolbar). Toolbar receives ABN_FULLSCREENAPP notification when a fullscreen application window is opened or closed (e.g. through F11). A window is fullscreen when its client area occupies the entire screen. Toolbar should take themselves out of the topmost z-order so that they do not cover the fullscreen window. For this I use SetWindowPos() with flag HWND_BOTTOM/HWND_TOPMOST.
Problem: On Windows 10 when a fullscreen application window is opened (e.g. Explorer window through F11) Toolbar receives ABN_FULLSCREENAPP and send themselves to bottom z-order. Then, when Win + Tab is pressed, Task View appears. Task View occupies the entire working area of the screen - entire screen exclude the Taskbar area and the Toolbar area. But Toolbar remains under the full-screen window and Takbar appears on top, see image below. I want the Toolbar to also be on top of the full-screen window when TaskVew is open.
During the opening of Task View, Toolbar does not receive any messages. Apparently since Microsoft stopped development of the ADT API, there is no special message for the Toolbars.
Possible solutions:
1) Use the solution from similar question by performing the function in the timer between the opening and closing of the full-screen window;
2) Use LowLevelKeyboardProc() with SetWindowsHookEx().
Both solutions are not elegant. If you know other method of detecting the opening / closing TaskView please report. Undocumented methods are also useful.

How to create an arrow pointing to my app's icon on the menu bar?

I have a menu bar only application. On the first time the user runs the app I want to create an animated arrow pointing to my app's icon on the menu bar.
The first idea I had was to create a NSPopover showing the arrow but that is obtrusive per se because I don't think I can make the popover invisible at all. I just want to make an arrow moving up and down pointing to my app's icon on the menubar and that must be App Store compatible.
Is that possible? How?
You can create a borderless transparent window and set its level to screen saver and set it to ignore mouse clicks. Within this window you can draw your arrow, again use a transparent content view. Look up the docs on NSWindow, NSView etc. to construct this.
Alternatively you can change the menu bar icon of your app itself - switch it, highlight it, animate it. This is the typical way a menu bar app attracts attention. Look up NSStatusItem and NSStatusBarButton.
HTH

Hide/Show the application icon of the Windows taskbar (LabVIEW - WINAPI)

I have an application created with LabVIEW and I need to show/hide the application icon on the Windows taskbar at run time.
I think that WINAPI can be used for this purpose and I tried to use the ShowWindow function (user32.dll)
ShowWindow(hWnd,SW_HIDE) -> hides the application window. The taskbar icon disappears for a second than re-appears.
ShowWindow(hWnd,SW_SHOWMINIMIZED) -> It simply minimizes the application window, so the taskbar icon remains
By default a "normal" visible un-owned window gets a taskbar button and the taskbar button is visible in every state except SW_HIDE.
MSDN also documents a couple of tricks you can use to override the button:
The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.
... If you want to dynamically change a window's style to one that does not support visible taskbar buttons, you must hide the window first (by calling ShowWindow with SW_HIDE), change the window style, and then show the window.
Another alternative is to use the ITaskbarList interface, it gives you full control over your taskbar button.

Full-Screen, Transparent App & Main Menu Interaction

I'm making an app that covers the screen, so I have a window covering the screen completely, with its level higher than the main menu.
So I draw over the main menu, but I want the main menu to be accessible, still.
How would I do so?
IMHO it is probably best (and also MAS acceptable) to force your app to run in full-screen mode. That way the menubar will still display if the user hovers in its area but you get the benefit of using the entire screen.

NSWindow, how not to be part of a screenshot?

My Cocoa app displays a transparent window on the screen, but when the user tries to take a screenshot using Mac OS X's built-in screen capture key with the option of selecting full windows (Command-Shift-4, then Space Bar), my window gets highlighted as part of the possible windows to capture.
How can I tell my Window or App not to allow this? My Window already refuses to be the Main Window or Key Window through -canBecomeKeyWindow and -canBecomeMainWindow both returning NO, but this still happens.
The Window is also at the NSModalPanelWindowLevel and NSScreenSaverWindowLevel does the same thing.
Notice that every window is eligible for screenshots, even the desktop, dock and menu bar, which are special windows. You can even take a screenshot of the Exposé overlay window itself. This leads me to believe that there is no way to do this.
I suppose you could hook the Command+Shift+4 key event and hide the window, but that key combo is user-definable, so it is subject to change.

Resources