-
August 11th, 2014, 11:22 AM
#1
Writing windowless Win32 progrram
Greetings,
I want to make a small C++ program that does not show any windows
I am using Visual C++ and I assume I want to create a Win32 program.
The program will change desktop wallpaper every time Windows resumes from sleep (WM_POWERBROADCAST message) and when the computer shuts down (WM_CLOSE message)
Some people suggest I don't create a window and just create a Win32 app for windows subsystem with just a WinMain.
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
return 0;
Problem is, how do I receive Windows messages if the program has no window ?
Thanks.
-
August 11th, 2014, 12:22 PM
#2
Re: Writing windowless Win32 progrram
You can create a message only window.
Victor Nijegorodov
-
August 11th, 2014, 02:47 PM
#3
Re: Writing windowless Win32 progrram
Originally Posted by VictorN
A message only window doesn't receive broadcast messages (see http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx and community additions) - so won't receive WM_POWERBROADCAST messages.
I suggest you create a non-visible window 1 pixel in size.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|