|
The first thing to note is that GetCurrentTime() has been deprecated by GetTickCount() . Second, calling SetThreadPriority() with a priority greater than 11 may cause disk caches to not flush, hang the mouse, and so on.
jinzhecheng wrote: How can I ensure those steps are not interupted?
By using a critical section (e.g., InitializeCriticalSection() ). I'm not sure you actually want to do this, however.
If you are simply wanting to time a section of code, GetTickCount() is the way to do this. Since Windows is not a RTOS, you'll not ever get 100% accuracy. For example, let's say that, per your watch, the code took 5 seconds to execute. However, span had a value of 6000, or 6 seconds. That means that the code was preempted for a total of 1000 ms. This is not necessarily a bad thing. It's much like weighing yourself at home on a scale that is not 100% accurate. Whether it shows you to be too heavy or too light, it doesn't matter as long as it's consistent. By comparing one weigh with another from the same scale, you can judge for yourself whether you are gaining or losing weight. Make sense?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
i need help with input plz
how do i get input for hour and minute if the time is entered as this format hour:min
|
|
|
|
|
There is insufficient information to provide you with a useful answer (e.g., how was the time acquired). In a very general sense:
char *pTime = "12:59";
char *pSep = strchr(pTime, ':');
int nHour = atoi(pTime);
int nMin = atoi(pSep + 1);
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hello,
I wonder how to disable the automaic menu enable/disable for CFrameWnd mechanism in eVC 4.0, I thought it could be done by setting the m_bAutoMenuEnable to FALSE?
Am I wrong with that? How can I accomplish it to stop that automatism?
Thnaks a lot...
Martin
|
|
|
|
|
Thank you, found out myself! It´s always the same: Searching two hours for a solution, then decide to ask the forum, then try again and find solution self within 2 minutes!
Here is the solution: Subclass a CMyMenu from CMenu and overwrite
"void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)"
in this new class.
In this function do nothing, so the automatism doesn´t work.
Greez...
|
|
|
|
|
Hello,
I have a Single Document Interface application generated by AppWizzard. The title bar of the application displays "Untitled - MyApp". I want to get rid of the "Untitled -" so the title bar just reads, "MyApp".
Any suggestions?
Thanks!
-Ian
|
|
|
|
|
go to the resource editor, then check the SDI frame properties and search the caption...
you could also do it at run time with a little SetWindowText() on you main frame...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Right you are! And here I was thinking I'd have to override one of the CDocTemplate methods... I guess I over-thunk this one... lol...
Thanks!
|
|
|
|
|
|
Isn´t it just AfxGetMainWnd()->SetWindowText("MyApp")? Didn´t try, but it´s a suggestion...
Greez! Martin...
|
|
|
|
|
Most folks use:
BOOL CMainFrame::PreCreateWindow( CREATESTRUCT &cs )
{
cs.style &= ~FWS_ADDTOTITLE;
return CFrameWnd::PreCreateWindow(cs);
}
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
D'oh! Yes, you are right! (I definately over-thought this one... ) Thanks alot!
|
|
|
|
|
Ian Bowler wrote: "Untitled - MyApp". I want to get rid of the "Untitled -" so the title bar just reads, "MyApp".
CDocument *doc;
doc.SetTitle("Any title can be given here");
Hope this will do.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I'm at a loss for how to correct for a level 4 warning.
header file
void some_func(some_type *ptr, int flag);
source file
void some_func(some_type *ptr, int flag)
{
...
...
} and when I compile, I get
warning C4100: 'flag' : unreferenced formal parameter and yes 'flag' is an unreferenced parameter, so I make the following change
source file
void some_func(some_type *ptr, int )
{
...
...
} and when I compile, I get
error C2055: expected formal parameter list, not a type list
I'm not sure how I have to change the source file, such that I don't get either the warning or the error. Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
You could always do:
void some_func(some_type *ptr, int flag)
{
......
UNREFERENCED_PARAMETER(flag);
}
|
|
|
|
|
Graham Bradshaw wrote: UNREFERENCED_PARAMETER(flag);
I don't use that often enough. Thanks for the quick response, too.
Chris Meech
I am Canadian. [heard in a local bar]
Remember that in Texas, Gun Control is hitting what you aim at. [Richard Stringer]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
#pragma warning( push )
#pragma warning(disable:4100)
void some_func(some_type *ptr, int /* flag */ ){......}
#pragma warning(pop)
or...
Refactor your code so that the unused parameter is not passed to function in first place
|
|
|
|
|
Chris Meech wrote:
... so I make the following change
source file
void some_func(some_type *ptr, int /* flag */ )
{
...
...
}
and when I compile, I get
error C2055: expected formal parameter list, not a type list
Assumption: 'ptr' or even (the real name for) 'some_type' is declared in a header file (from you or from Windows) and confuses the compiler.
|
|
|
|
|
#include "ODBCVER.H"
what is alternation for "ODBCVER.H"of vc6.0 in vc7.0?
can any one please let me know this?
Previously I was using vc6.0;
Now I uninstalled the vc6.0 completely and Installed the vc7.0;
Now I could not run my project. I am getting error as could not open the file "ODBCVER.H".
Please help me.
Nice talking to you.
|
|
|
|
|
I think this file was included in VC6 by accident. It appears to contain data used when building the ODBC library (version information to be included in the file version resource data); I can't imagine what you're using this file for but it should not be necessary.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi Mike,
Many thanks for giving the reply. Thanks for your suggestion. Now in my project I simply ignored this include statement. Now my project is working as usual.
Nice talking to you.
|
|
|
|
|
Is it possible to use WinInet FTP and scroll in some window exact communication ? I mean whole ftp commands and responses ?
Thanks!
rrrado
|
|
|
|
|
rrrado wrote: Is it possible to use WinInet FTP and scroll in some window exact communication ? I mean whole ftp commands and responses ?
Better hook winsockX.dll to see actual command coming and going !
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
Hi. I'm reading through some *very* old 'C' code that was created during the C89 standards - pre-1999. Basically, I've inherited some code from company A to support at company B.
Anyway, in one procedure I've located a #define that the original programmer quoted as it being local to the procedure.
Now, correct me if I'm wrong (of course you will! ); but, arn't #define's that are created anywhere in the code visible to the remaining portions of the project? That is, all remaining code, across files, that has yet to be compiled (from when the #define is declared) will contain the #define'd parameter until it is undefined?
Was there ever a difference in this behaviour between C89 and C99 conventions?
Thanks!
Carl
-- modified at 10:19 Wednesday 30th November, 2005
|
|
|
|