473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

my software prevents windows from shutting down


Hi guys ,
I face a peculiar problem.
I have a mutithreaded software trhat uses sockets to connect to my
webserver.
The problem is that while my software is running , windows is unable to
reboot/logoff or shut down.
I have to shut down the software before windows can do this.
Any suggestions on why this could be happening?
Thanks/Regards
Sanket Gupta


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #1
4 2199
sanket gupta wrote:
The problem is that while my software is running , windows is unable
to reboot/logoff or shut down.
I have to shut down the software before windows can do this.
Any suggestions on why this could be happening?


I have no idea what can be causing this, but it's damn funny :))).
Anyway, I think you could try to catch the shutdown message and close
all sockets, threads, handles, etc in your handler and then terminate
the application. It's just a wild guess and of course an workarround
not a solution, but could help.

Christina Androne
Nov 15 '05 #2
sanket gupta wrote:

Hi guys ,
I face a peculiar problem.
I have a mutithreaded software trhat uses sockets to connect to my
webserver.
The problem is that while my software is running , windows is unable
to reboot/logoff or shut down.


Second though: are you having a loop where a socket listens and listens
and listens and never ends?

Christina Androne
Nov 15 '05 #3
Max
Your program has to process WM_QUERYSHUTDOWN and WM_SHUTDOWN messages
correctly.

I believe what happens in your case - you answer "yes" on queryshutdown,
system proceeds with shutdown, sends shutdown and your program can not quit
because one of the threads is in some loop or wait function waiting for
messages through socket.
You should think of a mechanism to wake that thread up and tell it to exit
or answer "no" to queryshutdown.
Killing a thread is also an option but not so pretty one.

Search for information about these messages in MSDN.
"sanket gupta" <sa****@tsucorp.net> wrote in message
news:ea**************@TK2MSFTNGP11.phx.gbl...

Hi guys ,
I face a peculiar problem.
I have a mutithreaded software trhat uses sockets to connect to my
webserver.
The problem is that while my software is running , windows is unable to
reboot/logoff or shut down.
I have to shut down the software before windows can do this.
Any suggestions on why this could be happening?
Thanks/Regards
Sanket Gupta


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #4

Thanks guys.
You gave me ahint and rest of the work was done by google whcih gave me
more hints and finally i could solve the problem.
thanks a lot

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Jesper | last post by:
Does anyone know some c++ code for shutting down windows? I want to write a program using borland c++ builder to shut down windows. --
3
by: Claire | last post by:
Windows refuses to close down if my applications main form is hidden and there's a notify icon in the system tray. If I restore the form, then shutting down Windows succeeds. If I comment out the...
3
by: quilkin | last post by:
Hi When I use the WM_QUERYENDSESSION event to prevent closing of my app when Windows is shut down, I get the 'windows forms parking window' appearing which is very confusing for users. Any ideas...
6
by: Jm | last post by:
Hi All I have a simple vb.net app that once run for some reason does not allow me to log off or shutdown the pc ? When i try to do so it will close my app and then will only shutdown or logoff...
4
by: Markus Stoeger | last post by:
Hi, I have a problem with Application.Run() when Windows is shutting down. Please have a look at the copy&paste example program below. The application has no forms. It has only got a notify...
7
by: Mark | last post by:
It is possible from a .NET application to prevent Windows from shutting down? I understand that a .NET application can "know" that windows is initiating the process of to shutting down - but...
3
by: Chris Knievel | last post by:
Hi, i am trying to save some data in a excel spreadsheet, whenever the programm shuts down. Mostly this happens when a user is logging off or shuts the computer down. im am using the Private Sub...
3
by: leocwh | last post by:
Dear all, I would like to know how to run the execuatable before windows shutting down. Here is my simple code: Private Sub Command1_Click() Shell "C:\abc.bat", vbNormalFocus End Sub ...
1
by: =?Utf-8?B?YWRpZWJveWVz?= | last post by:
Latey, when shutting down my pc, Windows has been installing updates before shutting down automatically. This hasn't been a problem, until I recently tried to do a System Restore. Windows went...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.