I would like to create an application, the window in which would be regardless of the style of Windows, would not have a title, something like Winamp or Aimpa windows, or avast, qip pop-up windows, but using C ++ WinApi. Are there any simple ways to do this in C ++?
4 answers
hWnd = CreateWindowEx( WS_EX_APPWINDOW, "MyWindowClass", "Window Title", WS_VISIBLE | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, x, y, cx, cy, NULL, NULL, NULL, NULL );
If you experiment with the first ( dwExStyle ) and fourth ( dwStyle ) parameters, you will get about a hundred types of various windows.
You can visually remove any frame by rewriting 2 messages: WM_NCCALCSIZE
and WM_NCPAINT
(and just in case - WM_PRINT
and WM_PRINTCLIENT
, so that this window could not be drawn in any other context).
In handlers, you simply need to return 0 without transferring processing to the built-in window handler, usually DefWindowsProc
.
To avoid mouse reaction to certain service areas of the window, you need to rewrite WM_NCHITTEST
, returning the HTCLIENT
answer HTCLIENT
same way, directly to the system, without transferring processing to the built-in window handler
The mouse should be isolated from service areas due to the fact that some service components and functions can be engaged in drawing directly into the graph. window context, bypassing WM_PAINT
, such as DrawCaption
— in response to the WM_NCACTIVATE
message, therefore, these service components just need not be allowed to manifest themselves.
But even all these methods do not guarantee 100% independence from the window styles that are set when it is created, for example: when a certain application hangs (including Winamp), the GUI subsystem creates a utility window in place of the hung application window to allow the user to manipulate them at such times, and this window does not inherit your procedure, so it looks exactly the way Microsoft was designed.
So my advice to you is to use ordinary styles and don’t bother with how to bypass the system, it’s like proving to everyone that you have dermantine under your clothes instead of leather.
CreateWindowEx is the creation of standard windows with different styles.
In cases with Aimp, skins are used there, you can see here .
- 2Drawing on the window and attaching the region does not cancel the actual creation of the window: no frame there and so on. - Ali
When using Borland, you can put the window (form) in the border = none properties. Then there will be just a gray rectangle, without edging and window control buttons.
- oneThe question is written about WinAPI, and there is nothing about the builder. - gammaker