Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Message handling

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?

Comments

  • veliusvelius Posts: 456Member
    I do believe that a windowless program also recieves messages. And you will recieve the WM_QUERYENDSESSION message.
    [hr]
    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

  • emperoremperor Posts: 59Member
    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.

  • veliusvelius Posts: 456Member
    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".
    [hr]
    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

  • emperoremperor Posts: 59Member
    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".
  • veliusvelius Posts: 456Member
    You could create a window like normal and do not call ShowWindow().
    [hr]
    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

Sign In or Register to comment.