|
What is the effective way to find the uptime of an application? I have a server application and i want to ask the server its uptime. For this purpose i need to record the time when application starts and then subtract the current time from initial time to get the difference. I want this difference in the format "dd:hh:min:sec", how can i do so ?
|
|
|
|
|
You can get current time using W32API function GetLocalTime(LPSYSTEMTIME);
|
|
|
|
|
just an idea ..not sure whether right or wrong...what about gettickcount()
|
|
|
|
|
tarundeep singh wrote:
what about gettickcount()
It would work, but measuring uptime in milliseconds is probably overkill. Using GetSystemTime() will be more than adequate.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
tarundeep singh wrote:
gettickcount()
No, i can't use GetTickCount(), because its return value is of 4 bytes, and suppose my computer is up continuously for 2 months then these 4 bytes are not enough to get time difference.
|
|
|
|
|
John-theKing wrote:
What is the effective way to find the uptime of an application? I have a server application and i want to ask the server its uptime.
Are you wanting to know how long an application has been running, or how long the OS has been running?
|
|
|
|
|
DavidCrow wrote:
Are you wanting to know how long an application has been running, or how long the OS has been running?
I want to know that how long my application is running ?
|
|
|
|
|
See if GetProcessTimes() helps.
|
|
|
|
|
Use CTime and CTimeSpan
John
|
|
|
|
|
i do the following to change the font size of my CEdit control.But
it doesn't work well,Who can tell me what's the wrong
BOOL CDlgBase::OnInitDialog()
{
CDialog::OnInitDialog();
CFont *m_Font;
CFont m_newFont;
LOGFONT m_lf;
memset(&m_lf,0,sizeof(LOGFONT));
m_Font = GetFont();
m_Font->GetLogFont(&m_lf);
CClientDC dc(this);
m_lf.lfHeight = -MulDiv( 8,dc.GetDeviceCaps( LOGPIXELSY ), 72 );
m_newFont.CreateFontIndirect(&m_lf);
m_edit.SetFont(&m_newFont);
return true;
}
gucy
|
|
|
|
|
You're must CFont m_newFont move to the header file as global object
Best regards,
Eugene Pustovoyt
|
|
|
|
|
hi :
After i move the CFont declaration out of the function,it works well.
But what i wonder is that i have used these code int the function CMainFrame::OnCreate to change the edit control'size on the toolbar.
i also declare the CFont as local vaiable and it works perfect.
Why i must delare it as global variable here.
gucy
|
|
|
|
|
your code is perfectly working for me.
|
|
|
|
|
As Eugene Pustovoyt said, the font variable needs to be a global variable. It really doesn't matter if it works for you (no offense) or for anyone else. It won't work all the time. MSDN says that the font variable MUST be a global variable and I learned that the hard way.
// Afterall, I realized that even my comment lines have bugs
|
|
|
|
|
I need to strcpy the following phrase (I go "to" school) to a string. I tried the following:
char test[50];
strcpy(test,"I go "to" school");
of course this is wrong!!
Please help!
Thanks in advance
|
|
|
|
|
strcpy(test,"I go \"to\" school");
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Use Escape charater
char test[50];
strcpy(test,"I go \"to\" school");
Best Wishes,
Uma Mahes
|
|
|
|
|
If I have a dll, how can I know if it's a C++ dll or C# dll ? Can I have a C++ access function that allow me to know ?
Thank you for your answer.
|
|
|
|
|
I think you can use Dependency Walker tool. It will show all the
dependency dll. If its a C# dll then MSCOREE.dll should be one of
the dependent. I dont know any C++ function to differentiate the DLL.
Thanks,
Uma Mahes
|
|
|
|
|
Thank you very much Uma, I try with Dependency Walker.
Bye
Andrea
|
|
|
|
|
I have tried with Dependency Walker but I have a problem. I have a C++ dll that include and use a C# dll, so the dll MSCOREE.dll is one of the dependent of C++ dll .... Do you know any other method to resolve my problem ?
Thank you very much
Andrea
|
|
|
|
|
Simple and bestway
Have your own DllGetLanguage function in both the dll.
|
|
|
|
|
I'm sorry but I don't understand the answer. What is DllGetLanguage ?
|
|
|
|
|
I guess both the dll is created by you. so
have your own function in the dll say DllGetLanguage
to identify which language it has been built.
I dont know for what purpose you want this detail.
|
|
|
|
|
SD3 wrote:
If I have a dll, how can I know if it's a C++ dll or C# dll ?
Are both of these written in a .NET language (ie Managed C++ or C#)?
You could try using ILDASM to open both files. If the one is just plain C++, then you won't be able to open it in ILDASM.exe . If it opens, then it is most likely in C# (correct me if I am wrong, but how many people actually use MC++?).
Also, I don't know of a function to do this programmatically.
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|