|
Thanks for your reply.
But can you please tell me under which registry key this service is stored.
Suppose my exe name is ABC.exe and i want to create service for this exe to run in background.
As you send me link on that page they have given key
HKEY-LOCAL_MACHINE\SYSTEM\SERVICES
but can you please tell me under this key where i have to put my exe or where I have to create my new key to run my service in background for ABC.exe
Thanks again!!!!
|
|
|
|
|
It is not really enough to take a normal EXE and throw it into the Services entry in the Registry. A Windows Service is a special type of executable and needs to be written as such. A Windows Service supports control functionality, and the SCM, which manages Services, handles things like authentication and dependencies.
You should create a new Windows Service project. You should be able to use much of the boilerplate/wizard code as-is and just add your functionality to it.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks James for your reply!!!
|
|
|
|
|
Hi all,
What am I doing wrong?
class TCP32CLIENT
{
public:
TCP32CLIENT_API void MsgBoxThreadProc(void *var);
};
void TCP32CLIENT::MsgBoxThreadProc(void *var)
{
...
}
bool TCP32CLIENT::setApplicationParameters()
{
int val = 1;
HANDLE handle;
handle = (HANDLE) _beginthread( &TCP32CLIENT::MsgBoxThreadProc,0,&val);
WaitForSingleObject(handle,7000);
...
}
Error: Error 6 error C2664: '_beginthread' : cannot convert parameter 1 from 'void (__thiscall TCP32CLIENT::* )(void *)' to 'void (__cdecl *)(void *)' c:\documents and settings\baileyr\my documents\tcpip project\tcp32client\tcp32client.cpp 166
Even if I do this:
...
handle = (HANDLE) _beginthread( MsgBoxThreadProc,0,&val);
...
I receive the following error:
Error 6 error C3867: 'TCP32CLIENT::MsgBoxThreadProc': function call missing argument list; use '&TCP32CLIENT::MsgBoxThreadProc' to create a pointer to member c:\documents and settings\baileyr\my documents\tcpip project\tcp32client\tcp32client.cpp 166
Many Thanx
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
It is because global functions and member functions of a class don't have the same prototype. For the member functions, there is an implicit parameter that is passed which is the 'this' parameter (identifies to which instance of the class it belongs to).
So, that's why your compiler complains. A solution is to use a static function: in that case, the member function doesn't belong to a specific instance of the class but is shared across all instances. In that case, the 'this' parameter is not passed but that also means that you can only access static members of your class in your static function.
|
|
|
|
|
Thank you very much for the help Cerdic.
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
we have developed one application in which we can download new updated exe from the ftp.
We got success in that process but while downloading new file taskmanager window shows the message Not Responding instead of running.
Can anyone tell me what's wrong going on in my application?
|
|
|
|
|
If the code is in the main thread, then your application won't be able to respond to GUI events (thus the 'Not Responding' message and the window will stay blank). You need to start your download in a separate thread for that.
|
|
|
|
|
Hi
thanks for giving me reply
But actually I am very new to VC++ programming so I don't know thread programming. So can you please provide me the whole details that what should I do to go ahead.
Thanks again!!!!
|
|
|
|
|
You can have a look here[^]. There are a lot of articles about this subject.
|
|
|
|
|
Oh!!!!
Thanks for your reply
|
|
|
|
|
Jigish Shah wrote: So can you please provide me the whole details that what should I do to go ahead.
Read here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Actually my problem is like in my application client can download updated version of exe from our server.
We have made success to reach this part. But when user start downloading new exe after few seconds the TASKMANAGER window shows the message Not Responding instead of running.
So, this is the thing where I struck. I hope you will understand my problem.
if you find any type of solution than please tell me.
Thanks
|
|
|
|
|
James_Programmer wrote: So, this is the thing where I struck. I hope you will understand my problem.
I understand fully. Cedric has explained why and offered a solution. Did you implement it?
Check out SendMessageTimeout(hWnd, WM_NULL, ..., SMTO_ABORTIFHUNG, ...) for more.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The "Not Responding" message appears if your application does not pump messages for a certain amount of time (I believe it is 5 seconds), and then a user tries to interact with it by activating it, clicking on it, etc.
The background thread suggestion(s) are the way to go, I just wanted you to understand exactly why that message appears.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi James,
Thanks for giving me reply but as per you told that I have to pump message continuously to keep running my application So, How can i pump message in background to do this?
I have used Spawnl() function in my application to replace my older exe to new one.
I hope you will understand the problem which I have faced.
Thanks again!!!!
|
|
|
|
|
You do not pump messages in the background, you download the updated EXE in the background. You do this by creating a background thread and having it do the FTP transaction, and your primary thread continues to pump messages and operate normally.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
oh!!!
james thanks for giving your valuable time to give solution of my problem
Thanks!!!!!!!!
|
|
|
|
|
I have a window where 3D diagrams are drawn.When the window is maximized the
diagram appears correctly.But when it is minimized or if we change the size of the window the diagram is getting clipped.
Sometimes when the diagram which is clipped originally is displayed without clipping when we change the size.
I need code for resizing the diagram(clipped and unclipped) according to the window size.
plz help...
Thanks
|
|
|
|
|
That depends a lot of what you are using to draw your 3D diagrams. The only thing I can say is that you need to resize the 'window' (or the control) in which they are drawn.
|
|
|
|
|
I have compute the character width by using GetTextExtent() but i get wrong value.
The code is: -
///////in fuction1
//setting the character width
m_nCharWidth = dc.GetTextExtent(CString(pChar->GetCharacter()),1).cx;
////////in fuction2
//setting the character width by current character
m_nCharWidth = m_oMemDC.GetTextExtent(CString(m_pChar->GetCharacter()),1).cx;
-----m_oMemDC is created as follow: -
m_oMemDC.CreateCompatibleDC(&dc);
Why these two differs i dont know please help me on this topic?
Thank u
Hi
|
|
|
|
|
GetTextExtent() uses the font currently selected into the device context in it's calculations. You have to make sure both device contexts have the same font in them in order to get the same result.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
I have one sheet which is inherited CPropertySheet, I have added 3 page (inherit CPropertyPage) in to the sheet. How to set caption text in each sheet?
I used SetWindowText and SetDlgItemText but not success
Thanks.
Papais
|
|
|
|
|