|
You need to handle the WM_QUERYENDSESSION message. Windows will send out this message whenever the user chooses to end the session or when an application calls the ExitWindows() function.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
ALT+F4 - Process WM_SYSCOMMAND and watch for SC_CLOSE
ESC Key - Process/watch for WM_CLOSE
'X' in upper right corner of window - Process/watch for WM_CLOSE
|
|
|
|
|
How do you disable the 'X'?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
- -Uknown.
|
|
|
|
|
I have not tried it but this should work
CMenu *pSysMenu = GetSystemMenu(FALSE);
ASSERT(pSysMenu != NULL);
VERIFY(pSysMenu->RemoveMenu(SC_CLOSE, MF_BYCOMMAND));
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
I am not sure. I think you have to change the window's style to get the 'X' to go away.
I usually don't disable it so much as I just catch the WM_CLOSE and do not let the WM_CLOSE go through. It is polite to display a message box explaining to the user why the window can not be closed 'at this time'. Like 'You can not close this window because it is busy scanning e-mail right now' or something like that.
Of course, you might be closing for a more legitimate reason, like the user is logging off or Windows is shutting down, so you need to catch those events as well if you completely disable closing for a window.
|
|
|
|
|
Hi everyone.
I have a question concerning a timeout value for connect() calls.
I tried to solve the problem by using non-blocking socket, but that causes winsock to return WSAEWOULDBLOCK (I already know the reason for that error!).
Are there better ways to handle this?
Don't try it, just do it!
|
|
|
|
|
The setsockopt can help you set the TimeOut value for Connect(...) Call.
Alexander M. wrote:
causes winsock to return WSAEWOULDBLOCK (I already know the reason for that error!).
I consider this error as warning only and never bother about it, till my socket is functioning
"I Think this Will Help"
[Vote One Here, Complete my Survey....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi all,
I have created multiple desktops in VC++ and I am able to switch between them. I can capture the active desktop but cannot find a way to capture inactice(other)desktops. By capturing I mean to store the desktop in memory or a buffer and access that storage area later. I tried by creating DC for inactive desktop but that returns with error If by ny chance capturing is not possible, is there ny way to access the inactive desktop's heap?? Can nyone help me with this?? Waiting....
|
|
|
|
|
I have not done this, but I would try this starting point:
Loop EnumWindowStations -> Loop EnumDesktops -> Loop EnumDesktopWindows
You can possibly get DC once you have a window handle.
Assuming you have enough security, you should be able to enumerate all windows in entire system.
|
|
|
|
|
Is it possible to draw a window within another window, for example if I had 3 dialog windows layed out how I wanted them and a parent window, I would like to have the dialog window displayed as part of the parent window.
|
|
|
|
|
yes it's possible ... create your dialogs as child or the parent window.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
How would I do that at runtime with existing windows? Is there a way to set a window to "child" and draw it within the parent at runtime?
|
|
|
|
|
See here and here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for the links but I'm not talking about keeping a window within an MDI window, I want the contents of the window (i.e. the controls etc) drawn in the parent window, not as a seprarate dialog on top of the window.
|
|
|
|
|
My bad. I totally misunderstood.
Are you talking about just drawing a control at run-time versus at design-time?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Basically I am trying to create a plugin to add functionality to another language, I want to add the ability to create a parent window and subsequent child windows of the same size, I would then lay out the child windows as different views to be drawn on the parent window at runtime, the user would never see the child windows, just the different "views" in the parent window. Does that make sense?
I have access to the various properties of the window such as the window handle so I can modify any necessary properties of the windows in C++.
|
|
|
|
|
Have you seen the CreateWindow() function. If, for example, you wanted to create an edit control, you'd have something like:
CreateWindow("Edit", ..., hWndParent, ...); I think the second parameter is WS_POPUP | WS_VISIBLE but can't be for sure without trying it out.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yeah, I have tried that but the window already exists and contains controls, I just need it to become part of a parent window.
|
|
|
|
|
__makaveli__ wrote:
I just need it to become part of a parent window.
Would SetParent() help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It may well do! Don't know how I missed that, I would have to set the child to "overlapped" to make it draw within right?
|
|
|
|
|
Thanks for the suggestions! After some messing about, it worked like a charm!
|
|
|
|
|
Hi guys.
I don't know if this is the best place for this post.
If not, please redirect me.
I need a design suggestion.
I have to solve a problem consistent in:
8 balls and 8 boxes. Boxes and balls have diferent sizes.
I have to know if I can put each ball inside one of the boxes.
Evidently the balls must fit inside the boxes.
The problem has solution only when each ball fit inside a box.
I solved this problem using backtracking and works fine.
My question is: there is a fast way to do this than with backtracking?
I need the fastest solution.
Thanks in forwarding.
Doc
|
|
|
|
|
make a ball class, make a box class. define an overloaded operator for comparing sizes, probably based on the box's height and the ball's diameter. sort both arrays (or vectors). they should be matched up at that point.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
BlackDice wrote:
sort both arrays (or vectors)
Ensure you sort them in the same way, say smallest first. Sorry, could not resist!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi ,
1:I want to create a full duplex network program.
2:what is the best way to create a network program ? more powerful
than CSocket?
Best Wishes,
Thanks.
|
|
|
|