|
Hi,
Plz have a look at the following code snippet.This code will be executing in an endless while loop waiting for an event to be logged in the application log.If any event is logged then it will post a message to the dialog class for displaying it.
NotifyChangeEventLog(hEventLog, hEvent);
DWORD dwWaitResult = WaitForSingleObject(hEvent, INFINITE);
if(dwWaitResult ==WAIT_FAILED)
{
AfxMessageBox("Waiting Failed");
return 0;
}
PostMessage(pDlg->m_hWnd,UM_EVENT_LOGGED,0,0); //(long)hEventLog );
Now the problem is it will not notify all the events logged.ie if it notifyes a event logged then it will notifyes only after 5 seconds.So all the events logged with in this 5 second time will be lossed.
Plz help me with a solution...
With Luv
|
|
|
|
|
WaitForSingleObject is stopping your application for five seconds, until it times out, I reckon.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
"WaitForSingleObject" never get timed out becoz the time out parameter is specified as "INIFINITE".
Suppose if an event is logged at 12:05:30(hh:mm:ss).
If ur belief is true, then the application will displays the event only at
12:05:35. Isn't it?
But here it displays at 12:05:30 itself. But after that it is ignored all the events logging till 12:05:35.
|
|
|
|
|
VCSharp007 wrote:
if it notifyes a event logged then it will notifyes only after 5 seconds.So all the events logged with in this 5 second time will be lossed.
This is by design because the system calls PulseEvent() no more than once every five seconds.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
...any idea to overcome this problem?
any alternate method for checking the event logging process??
Plz tell me a solution.
|
|
|
|
|
Couple what you have with a "date/time since last check" flag.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thnx David.
Eventhough itz a good idea ..real time display is not possible??
another problem with this is if two events logged in the same time one wil be losed.
I think the "event count " checking is more effective, isn't it?
|
|
|
|
|
VCSharp007 wrote:
Eventhough itz a good idea ..real time display is not possible??
Of course not. PulseEvent() only notifies once every five seconds.
VCSharp007 wrote:
another problem with this is if two events logged in the same time one wil be losed.
Then this is a problem with the event logger itself, not your monitoring application. It should not matter when you check for new events, whether it's twelve times per minute or once per day, as long as the events are present in the log.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all,if i have a string,i.e : "jry1924",how to check whether it is a number or not?
I tried using function atof but if your string is not a number,it returns 0.
Help me pls!
|
|
|
|
|
|
The old fashioned way was to use strtoul and check the 'end pointer'.
But be aware if it is a very large number it will fail with an overflow.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Use strtod instead of atof . It has a parameter that points to first character in the string that it does not recognize as part of a number. If that character is not NULL (the end of the string) the string is not a number. It takes into account your current locale settings and exponential numbers.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
have you given the thought of making ur own function? tis a little longer though!,if u like doing it from the basic,then this might intrest u.....
char a[]="jry1924";
int ch;
BOOL flag=0;
for(int i=0;(ch=*(a+i))!=0;i++)
{
ch-=48;
if(ch<0 || ch>9)
flag=1
}
if(flag ==0)
cout<<"NUMBER!"
else
cout<<"nope!not a number!";
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
HI all!
I m calling a function by a pointer of an external class & that pointer has been defined in the parent class of the class from which the already specified function is being called. The pointer's class is linked with the parent class (through its header).
So, the scenario is that a function accesses the protected member of a parent class (pointer) & then uses that member to call a function.
Now, when i compile the code, LNK2001/LNK1120 error is thrown.
Can any body tell me y this problem occured & what about its remedy?
Regards
Usman Arif
Usman Arif
|
|
|
|
|
External as in not part of your project ? Have you linked to the appropriate .lib files ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
External means another application.
infact, i m integrating the dll of my project in an application (external). Now, in the next step, i m trying to access a class from the external application. For this, i included the header in my project. It worked fine uptil now. But, when i try to access a function from that external class, the linking error was thrown.
Usman Arif
|
|
|
|
|
OK, so you need to take the .lib file from when you build that external dll, and link to it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello Mr arif,
you misunderstood MR Graus. He is saying that you forget to include .lib file which contain the runtime symbol for you external class(i.e. class from DLL).
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
The external application, i m using, has an .exe file as its output file.
I converted the output file to .lib file & then included it into my project, but the error is LNK1136 ,i.e. "Invalid or corrupt file".
Usman Arif
|
|
|
|
|
Usman Arif wrote:
The external application, i m using, has an .exe file as its output file.
Buddy I am here talking about .LIB file which will produce with the DLL (when you build it). you can find that .lib in DEBUG/RELEASE folder of DLL project
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Friend!
That .lib file is already there, no problem with that.
My problem is that i wanna access the external application's (in which .lib of my project was included already)function from my project.
now, r u clear with my problem? if yes, suggest some remedy for it; if possible.
Usman Arif
|
|
|
|
|
i can't seem to find matlab.h in my matlab7 folders or my visual stuido6.0 folders. Where can i get it
Thanks in advance
|
|
|
|
|
Do you have the rest of matlab, but not the .h file ? If not, then the .h file is of no use to you.
It sounds like you have it installed ( you have a matlab7 folder ), so do a system wide search for it. If you can't find it, I'd suggest that finding a copy of that file is a waste of time. If you're missing one file for some reason, you may be missing others, and a reinstall of matlab is the only sensible option IMO.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i think i have the rest. Do u think i can download it somewhere? Because i don't think reinstalling will help.
|
|
|
|
|
um.... dude, if reinstalling it won't help, then your setup is fundamentally broken. If that file is not in your setup, and you need it, then your setup file is broken, or you're looking for the wrong thing.
No, I've never used matlab. It's a library for image processing, right ? I have written a lot of image processing code in C++ and C#, but the only external library I ever used was paintlib, and GDI+ makes that redundant.
Christian Graus - Microsoft MVP - C++
|
|
|
|