Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3670
Number of posts: 9122

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Message handling Posted by emperor on 20 Oct 2003 at 12:10 PM
I'm writing a small programme for Win 98 using VC++ 6, all it is meant to do is start when Windows starts, logging the time & date, then wait until shutdown to log the time & date again. I've got it to do the first bit easily enough, but I'm not sure how to get it to wait for shutdown. Presumably I must put it into a loop waiting to receive WM_ENDSESSION or something, so I need to know it if I can receive / handle messsages if my programme doesn't have a window. Will I need to create an invisible window just so I can get messages?
Report
Re: Message handling Posted by velius on 20 Oct 2003 at 3:30 PM
I do believe that a windowless program also recieves messages. And you will recieve the WM_QUERYENDSESSION message.


Oh my god
I can't deny this
I've been taught just to kill and fight this
To bury it deeper where nobody can find it
Like nobody wanted to know
-- Oh My God - Guns N' Roses

Report
Re: Message handling Posted by emperor on 21 Oct 2003 at 12:13 PM
Any idea how to get & process them (preferably without MFC)?

: I do believe that a windowless program also recieves messages. And you will recieve the WM_QUERYENDSESSION message.

Report
Re: Message handling Posted by velius on 21 Oct 2003 at 2:16 PM
Yes, write a Win32 program. Also you may want to look at Petzold's Programming Windows 5th edition at your local book store if you don't want to buy it. Also I'm sure there are online tutorials to get that taken care of. If you want I can supply you with a skeleton program that you can "fill in the blanks".


Oh my god
I can't deny this
I've been taught just to kill and fight this
To bury it deeper where nobody can find it
Like nobody wanted to know
-- Oh My God - Guns N' Roses

Report
Re: Message handling Posted by emperor on 22 Oct 2003 at 3:47 AM
I know how to process messages for programmes with a window, I need to know how to do it without a window. GetMessage and PeekMessage both require an hWnd, and I've tried supplying it with NULL but nothing seems to work. I can't seem to find much online or in the official docs about windowless message handling (or in my book for that matter). Whatever you know about it would be much appreciated!

: Yes, write a Win32 program. Also you may want to look at Petzold's Programming Windows 5th edition at your local book store if you don't want to buy it. Also I'm sure there are online tutorials to get that taken care of. If you want I can supply you with a skeleton program that you can "fill in the blanks".
Report
Re: Message handling Posted by velius on 22 Oct 2003 at 4:00 AM
You could create a window like normal and do not call ShowWindow().


Oh my god
I can't deny this
I've been taught just to kill and fight this
To bury it deeper where nobody can find it
Like nobody wanted to know
-- Oh My God - Guns N' Roses




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.