• Advertisement

Archived

This topic is now archived and is closed to further replies.

WM_SYSCOMMAND: how to use it?

This topic is 6449 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all! I thank all of you who has helped me to figure out how to modify windows'' interface. Unfortunately it isn''t the end yet. I need to put minimize and close boxes over my title. As i found out, if I want to have this buttons, I have to specify WS_SYSMENU style and ~WS_MAXIMIZEBOX to disable maximize box. When I done it the window appeared the same as without ws_sysmenu (it was in the beginning, i was hoping i don''t need to mimize), but if I click in the place where the close or minimize boxes are I see them. Ok, then i decided just to overdraw them. I fought few hours (heh, i hope that doesn''t mean i''m so stupid, i''m just new to all this stuff) and I can put additional pictures that are totally overdraw origin ones. When a button is pressed, it changes it''s view and again I can overdraw it. I used WM_NCHITTEST, WM_NCLBUTTONDOWN and WM_NCLBUTTONUP. When the event LButtonDown occurs to the close box (i played only with this button, because it wont that hard to make about the same things to minimize box) it causes CFrameWnd::OnNcLButtonDown(nHitTest, point) to be executed. nHitTest is supplied by OnNcHittest and is an enumerated value of mouse position (hm.. actually i don''t know what is the value for close box i thought it should be HTSYSMENU, but it isn''t), and point is the mouse position in screen''s coordinates. And this function causes new image of "pressed" button to be drawn. I couldn''t avoid it and decided to disable this f-call at all. At present, my system does not get the message, that i have pressed close button. Hence, when the LButtonUp event occurs, system doesn''t proceed WS_SYSCOMMAND/SC_CLOSE. I have to execute this button myself. I don''t want to use something like "system.exit(0)", i wan to send windows message WM_SYSCOMMAND with the parameter SC_CLOSE to the window to close and destroy it. The CFrameWnd class is the base class for the window. I''ve tried next:
CWnd * wnd = GetWindow(GW_OWNER); wnd->SendMessage(WS_SYSCOMMAND, SC_CLOSE);

and it gives me "the programm has performed...". Ok, my brains got screwd with this today. Thanks you in advance... i hope you will make things more clear for me than they are at the moment... best wishes, Grey P. ========================= Life is a bitch, and we are its kids.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement