|
It worked... Thanks a lot.
|
|
|
|
|
Hi,
I have developed an mfc application and I want to run it as service...Is it possible? Please help me if anyone has some idea.
Thanks in advance
Deepesh
|
|
|
|
|
I reckon the easiest way is to start the ATL wizard, create a service, and move your code into it.
I dunno how hard it is to replumb an app as a service. I thought a service ideally had no GUI though.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Thanks for the reply..but I am not able to understand what you are trying to say. I got one exe called Sc.Exe from microsoft which is used to make an application as service. When I used this I got the entry of the application in services but not able to start it gives error msg saying "Error 1053:The service did not respond to the start or control request in a timely fashion."
Do you have any idea why its happening?
|
|
|
|
|
Anonymous wrote:
Error 1053:The service did not respond to the start or control request in a timely fashion."
This usually means that your service hasn't been written properly i.e. it is not responding to commands that you give it from the service control panel e.g. stop and start.
I would really recomment that you get a skeleton service working first that does nothing more than log something to a file saying that it has started, stopped, etc., get that working and *then* transfer your real code into it.
You really need to be careful when transferring MFC code as well. Even if you do not do any UI stuff like show a dialog or message box, MFC still does some stuff behind the scenes that require you to be logged on. Check the MSDN.
he he he. I like it in the kitchen! - Marc Clifton (on taking the heat when being flamed)
Awasu v0.4a[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
After being savagely “beaten” for posting this message in the Lounge, for which I’m sorry, here it goes again.
I’m performing a lengthy whenever the user logs off or shuts down. Currently I’m trapping WM_QUERYENDSESSION, and mimicking the request after the operation is finished.
This as the nasty effect of leaving some applications opened that could require the user intervention to save unsaved work as an example.
Is there another way to do this?
Thank you
Artur Jales Moreira
|
|
|
|
|
jales wrote:
This as the nasty effect of leaving some applications opened that could require the user intervention to save unsaved work as an example.
Normally, an application will respond to the WM_QUERYENDSESSION (or some WM_CLOSE related ) message and behave itself in a good manner. You should'nt have to do nothing about that; except if you trap the message and ditch it, so that no one else can receive it.
If you handle the WM_QUERYENDSESSION message in your application ( which I assume you are doing ), the OS should wait until your application is done before continuing with the shutdown/logoff process; It might show the "wait/cancel" dialog if the application is not responding for too long.
Max.
|
|
|
|
|
Maximilien wrote:
If you handle the WM_QUERYENDSESSION message in your application ( which I assume you are doing ), the OS should wait until your application is done before continuing with the shutdown/logoff process; It might show the "wait/cancel" dialog if the application is not responding for too long.
The reason that I'm not doing the work in the handler is to avoid that dialog from ever being shown. I also need to do a similar task on logon, and I solved that by registering the application in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. Isn't there a way to register an application to run on shutdown?
Thank you
Artur Jales Moreira
|
|
|
|
|
I'm glad you decided to post this after your savage beating.
From looking at the help on this message, it seems all you need to do is return something other than 0. Maybe your should allow other apps to handle this message while you continue to process.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
And doing the work in the handler for WM_ENDSESSION? Wouldn't that also show a System Dialog after a certain time, saying my application is not responding?
Artur Jales Moreira
|
|
|
|
|
jales wrote:
Wouldn't that also show a System Dialog after a certain time, saying my application is not responding?
Not if you do your operations in a seperate worker thread, and leave the UI thread open to talk to the system. If you're using MFC, it's as simple as AfxBeginThread()...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
But if I respond to WM_ENDSESSION the application will end.
Artur Jales Moreira
|
|
|
|
|
I designed a small activex control with a Property page. The property page has a button control.
Suppose if a place this control on a Dialog Box by right clicking on the Control and selecting properties..., it displays the property page with button control. when i click a button the focus will change to ActiveX control window , where i can draw using mouse .
Any help ...
Thank you.
|
|
|
|
|
chepuri_uk wrote:
it displays the property page with button control. when i click a button the focus will change to ActiveX control window , where i can draw using mouse .
Any help ...
huh??? Are you asking how to do that just telling us you already do? Do you want to draw, like MS-Paint draw, or draw as in an owner-drawn menu?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hi All...;P
i new in VC++...i have problem when i run the application in Release version...after a few click of button the application return a meesagebox
Application Error
The instruction at "0x6c3ce337" reference
memory at "0x0000003c". The memory could
not be "read"
Click on OK to terminate
Click on CANCEL to debug the program
When i click CANCEL another message box come ...it written unhandled eception MFC42 access violation...
but in the debug version is no problem....
how i want to overcome the problem....
regards
:_Rocket_:
|
|
|
|
|
There is an article here on CP about setting the project to build debug but think it's release.
Otherwise you can use messageboxes to figure out where you are crashing, or a log file.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
You may have a stray pointer there. Look at the memory address: 0x0000003c is certainly not a real variable adress.
You are having this error in Debug build also, but it is masked by some of the error-correction mechanisms there. Look for mentions of memory leaks when executing your Debug-build.
You are positively sure that every pointer you are using has been initialised and checked for validity before?
This can only be a starting point, but (as Christian said) there is an article about this on CP
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
If you cannot recreate in debug mode, perhaps you should throw in some message boxes to see exactly where the error is occurring. Once you narrow it down maybe you can figure out the problem.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
Thanks in advance........;)
I want to get the label of Hard disk and number of Hard disk attached to the system.......
Shahzad Ahmad.
Software Engineer.
|
|
|
|
|
How does 'GetVolumeInformation' and
'GetDriveType' sound ?
|
|
|
|
|
Refer
GetVolumeINformation() API
* * * Code the dreams * * *
When you are programming code you are creating a little universe and you get to define the rules. It's a cheap way of creating your own castles in the sky
|
|
|
|
|
Hey all, in my view class i have it create a Object of mine that uses a thread to complete it's task, when the thread finishes it users AfxGetMainWnd()->PostMessage(MY_MESSAGE, 0, 0); to post a message. I am trying to catch it in the view class with ON_MESSAGE(MY_MESSAGE, MyFunction) but no luck. tho if I put that in the MainFrame class it catches it. Any ideas on how to get the view class to notice this message?
thanks in advanced.
Luke.
|
|
|
|
|
OK, It's something like this, the Message Pumps are associated with a
thread and not a window. Inside this thread the messages are dispatched
to different windows based on the windows handles.
So your code is posting back to the same thread which does not
have a message pump (while(GetMessage(..) {...}) so what ever messages
you post will never be executed!
Now you have two options
1. Post the message to the main thread and have it executed there
by using PostThreadMessage.
2. Provide a message Pump (this will mean you will need to re-tailor
your existing thread function to use the message pump and not
the simple while)
Hope this helps..
|
|
|
|
|
Post a user-defined command instead with AfxGetMainWnd()->PostMessage(WM_COMMAND,MAKEWORD(0,ID_YOURCOMMAND,0); and add an ON_COMMAND handler to your view: the MFC framework will properly route the command to the view handler.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi all,
please tell me how i can change the color of Mainframe,like scrollbars.
thanks
Hari Krishnan
|
|
|
|