|
Hi!
I've posted this question in the "Suggestion" board, because there is no API discussion, and was advised to post it to C++ board. Sorry for long story.
I've created the NT service that in the case of error not only register event in the Application EventLog, but also may send this event by mail to the predefined SMTP address. In the configuration applet for this service I'd like to let the user to select, what events he/she wants to receive in mail. So I'd like to extract the list of events from the event source, registered in HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\Application\EventMessageFile.
I can extract the single event with FormatMessage, if I know the ID. But if I don't? The question is: How I can enumerate the events in the EventMessageFile? Sure I can do it "manualy" analyzing the message file structure. But I prefer something more safe in the case, they in MS will change the message file structure. And using API (if there is any) will save me from unskilled labour. I don't afraid to do such a work, but if I can avoid it ...
Thanks in advance.
Regards,
Gennady
|
|
|
|
|
Message table is normal Win32 resource, so you need to load message file using LoadLibraryEx() with LOAD_LIBRARY_AS_DATAFILE flag. Then, use EnumResourceXXX/FindResource/LoadResource functions to retrieve MESSAGE_RESOURCE_XXX structures.
Hope that helps.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks ! EnumResourceNames is exactly what I looked for. Don't know why I couldn't find it myself - may be search expression was wrong.
Thank you once more.
Regards,
Gennady
|
|
|
|
|
In the below given program, 'cout' in the destructor doesn't work. But if the iostream is replaced with iostream.h and the statement using namespace std; is commented then, it works fine and displays - "Hello how are you?"
Can anyone explain why is it so?
#include iostream
using namespace std;
struct A
{
A(){cout<<"Hello";}
~A(){cout<<" you?";}
}a;
void main( void )
{
cout<<" how are";
}
//"void (*p[10]) (void (*)());"
|
|
|
|
|
In VC++ <iostream> and <iostream.h> use different implementations of the run-time library routines, so they work differently.
|
|
|
|
|
Thnx for ur reply. But I would like to know why is the STL cout is behaving like this? Is it a bug in STL?
"void (*p[10]) (void (*)());"
|
|
|
|
|
Don't have an answer for you but you may want to just debug the app to see why the last cout doesn't do anything. Have you tried appending an "endl" to the "you"?
Alvaro
|
|
|
|
|
You need to flush "cout" before exiting the application. std::endl takes care of this, as in
cout << "d'tor" << endl;
|
|
|
|
|
I wonder why this compiles without an error :
m_nScrollPos-=nPos,1.0,2,3
(IMHO this is obviousely nonense)
|
|
|
|
|
> (IMHO this is obviousely nonense)
Grab any C/C++ book and learn about 'sequential-evaluation operator' or 'comma operator'. If you don't have one, read this excerpt from C++ Language Reference included in MSDN:
"Consider the expression
e1 , e2
The type and value of the expression are the type and value of e2; the result of evaluating e1 is discarded. The result is an l-value if the right operand is an l-value."
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
enlightened
|
|
|
|
|
Hi,
I have a small app that runs autonomously. It's dialog based, and has a button on the dialog. I set this button to Disabled in resource editor, cos i don't want the user hitting it until certain events occur. I also want it nicely greyed out.
Here comes the silly part... how do i reenable it when i'm ready?
Thanks
|
|
|
|
|
Make a member variable for the button then go
m_Button.EnableWindow(true);
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello,
I have written an app. that hooks the keyboard, I have used the AfxGetApp()->m_hInstance as a parameter in the HINSTANCE hMod parameter.
The effect of doing so is that I have locked all the keys choosen in all the OS. (perfect for me, that's what I wanted).
Now I'm trespassing that code into a Win2k service and what I've found is that i don't know the instance of it, how should I get it?
I've readed in the MSDN that if you want system scope, the code must be placed inside a DLL, if this is true, why it is working OK for me?
As you will have probably seen my english is not my best... sorry about that...
|
|
|
|
|
hi to all !
does anyone know how to save the dialog or any CDC device to bmp/jpg File?
pascal.
pascal
|
|
|
|
|
I answered this question about 5 questions down. If we ever get a FAQ, this has to be one of the top answers to put in it.
You can do it with GDI+ quite easily, my 'Doodle' tutorial shows you how. If you don't want to use GDI+, try paintlib ( www.paintlib.de ). They still haven't incorperated the code I submitted six months ago, but I have code to save Targa as well here if you get paintlib and want it. ( also lots of filters ).
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I've just finished implementing a custom menu. When you open a menu, it goes modal. This means that the parent window appears inactive. While this doesn't affect how the menu works, it just doesn't look right.
So my question is, does anyone know how to parent make parent appear active, while a child window is modal?
Hygge
John
|
|
|
|
|
|
Yes I know, but the problem is that my menu is a com object. What you suggest would require that I subclass my parent window and I don't know if that is such a good idea. I was hoping that some sort of temporary style modification, would do the trick.
|
|
|
|
|
> I was hoping that some sort of temporary style modification,
> would do the trick.
AFAIK, there's no style controlling title bar status. The code lives in WM_NCACTIVATE part of DefWindowProc.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hmm, I was afraid of that, but I guess there's no way around it then.
Gotta go sub-class some parent windows then..
Thanks for your help
John
|
|
|
|
|
Hi everybody,
I would like to attach a dialog to the left side frame, I used something like CDialoBar class but unfortunatly I can't associate variables to the control interted.
How can I create something like that?
Best regards,
Giancarlo
|
|
|
|
|
You can do it by csplitterwnd and cformview.
You can split the frame by csplitterwnd,
and then on the left create a form view(dialog like).
|
|
|
|
|
I Create a new window in the client of Frame
how to only show the new window and hide the frame!!
thanks a lot!
|
|
|
|
|
Be a bit more detailed.
To hide a window:
ShowWindow(SW_HIDE)
|
|
|
|