|
I wrote that example for VS 2008, looks like the callback signature has changed a little since VS6. Try to change it to
void __stdcall myOnTimer(HWND hwnd, unsigned int uMsg, unsigned int idEvent, DWORD tickCount)
{
}
as the error message suggests. If you have an MSDN library with your VS then you should be able to find the correct callback function signature there. Maybe even an example.
|
|
|
|
|
|
Hi
code working good.. but I cant able to kill this timer... can you help to kill this call..
Regards,
S.Shanmugaraja
|
|
|
|
|
You just call ::KillTimer(0, timerId); where timerId is the timer id value you got back from ::SetTimer.
|
|
|
|
|
Thanks Thanks so much
|
|
|
|
|
Hi,
I am beginner to MFC application. I need your suggestion to improve my skill in MFC. How you come know about __stdcall and other functionality of MFC. Any material you have been using? kindly share your views and ideas. It may help me to improve my MFC skills. I am looking forward your valuable suggestion.
Regards,
S.Shanmugaraja
|
|
|
|
|
This is not MFC as such. SetTimer and KillTimer Windows system functions documented by Microsoft.
http://msdn.microsoft.com/library/default.aspx[^]
There are many good books and online resources on the subject of C++ programming, Windows system programming and MFC. I suggest you try searching the net for recommendations and book reviews.
|
|
|
|
|
Hi,
I am Calling CapWatchID: = ::SetTimer(SetTimer(0, 42, 1000, CaptureStopWatchT); and after sometime I killed this running timer using ::KillTimer(0, CapWatchID);. But the problem is, when I start the same timer again then Updation time became lessthan 1000 millisecond. Why its happing like this. kindly help me to fix this problem.
Regards,
S.Shanmugaraja.
|
|
|
|
|
I have not observed similar behavior so I'm afraid I can't help with that.
Also please note that the number 42 as second parameter to SetTimer in my example was chosen randomly. Probably, it would be more correct in your context to use the value 0.
|
|
|
|
|
shanmugarajaa wrote: how to create "TIMERPROC"..
It's in the docs: http://msdn.microsoft.com/en-us/library/windows/desktop/ms644901(v=vs.85).aspx#creating_timer[^]
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
I want to have a fast algorithm to determine if it’s leap year, is this a good one?
bool isLeapYear(int year)
{
bool leapYear = year%4 == 0 && (year %100 != 0 || year%400 == 0;
return leapYear;
}
Thanks!
|
|
|
|
|
It's the only algorithm I know. It's so simple that asking for another one makes no sense. To optimize for speed you may define it as macro or inline function (better):
#define IS_LEAP_YEAR(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
inline bool isLeapYear(int year) const
{
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}
|
|
|
|
|
First code has to be syntactically correct, then fast.
Veni, vidi, vici.
|
|
|
|
|
|
How did you find that!
Veni, vidi, vici.
|
|
|
|
|
i have it bookmarked
|
|
|
|
|
|
It's looks good, syntax errors aside (missing a closing bracket).
Steve
|
|
|
|
|
Hello,
In the MSDN, GetWindow function page(http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515(v=vs.85).aspx[^]),
Remark section, it's said:
"The EnumChildWindows function is more reliable than calling GetWindow in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed."
Does anybody know in which case will the risks(caught in an infinite loop or referencing a handle to a window that has been destroyed) happen?
Thanks & BR
|
|
|
|
|
the answer to part of your question is on the page for EnumChildWindows:
A child window that is moved or repositioned in the Z order during the enumeration process will be properly enumerated. The function does not enumerate a child window that is destroyed before being enumerated or that is created during the enumeration process.
|
|
|
|
|
Thanks! I think I got it:
If calling GetWindow in a loop, there might be some problem.
Especially when they might be some window-hierarchy change during the loop.
But still confused why there might be run-into a endless loop?
|
|
|
|
|
xrg_soft@163.com wrote: Does anybody know in which case will the risks(caught in an infinite loop or referencing a handle to a window that has been destroyed) happen?
Any specific reason to use GetWindow instead of EnumChildWindows?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
GetWindow still exists and not marked as obsoleted by MS.
|
|
|
|
|
xrg_soft@163.com wrote: GetWindow still exists and not marked as obsoleted by MS.
try FindWindow then!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I'm trying to discover a better way to determine if IIS is installed with Windows Vista.
I've gone over the registry, the Windows\System32\InetSrv Folder, and all the registry entries and files seem to be intact when you uninstall IIS Server using Windows Features.
So I'm looking at Windows Feature, it know what features are installed, and I'm trying to figure out the method it uses, or the location of the information.
Just wanted to know if anyone out there has any information on this.
|
|
|
|