|
You need to create an registry entry with the appname you use in the call to register the message.
HKEY_CURRENT_MACHINE(?)\SYSTEM\CurrentControlSet\Services \Eventlog\Application\myprog (i think)
The myprog subkey will contain several entries, one of which is the path to the file containing the resource format strings associated with the messages you are writing. In your case, this would be your service, but it could also be (and often is) a separate resource DLL.
When you invoke details on a message in the event viewer, it looks in the myprog key and tries to find the resource file specified so it can format the message for view.
There's an article on "EventLog Service Entries" in the MDSN that helps a bit - check the other reg entries to get an idea of what is needed.
|
|
|
|
|
The .BIN and .RC file from the message compiler end up being produced in the project directory. The need to be there so the resource compiler can find them. However after the service is installed, for some reason the event viewer, needs to find the .BIN file in the same directory as where the service has been registered. Once a put a copy there, all works fine. I've added a post build command to copy the .BIN files to the appropriate directory and I can forget all about it.
HTH somebody else!
Chris
|
|
|
|
|
I've found, that putting the binary messages into a dummy DLL works fine. All you do is create a dummy DLL, edit the Registry key for EventLog\Application to point at your DLL and it should work.
Just a suggestion.
Matthias
p.s.: I'm currently writing a simple tutorial "A total idiots guide to the Event Log". I will be posting it till the end of the week. So if you are patient enough...
|
|
|
|
|
HI,
I am using the following in MFC to ensure WebBrowser control on a dialog
will not run scripts etc...
BOOL CMainDlg::OnAmbientProperty(COleControlSite* pSite, DISPID dispid,
VARIANT*
pvar)
{
if (dispid == DISPID_AMBIENT_DLCONTROL)
{
// What should be enabled?
V_VT(pvar) = VT_I4;
V_I4(pvar) = DLCTL_DLIMAGES | DLCTL_NO_JAVA | DLCTL_NO_SCRIPTS |
DLCTL_NO_DLACTIVEXCTLS | DLCTL_NO_RUNACTIVEXCTLS | DLCTL_SILENT ;
return TRUE;
}
else
return CWnd::OnAmbientProperty(pSite, dispid, pvar);
}
How do i handle OnAmbientProperty for Dialog in WTL...?
note that i use the DDX macro to get the hwnd ,i didnot use CreateControl.
Thanks
tomer
|
|
|
|
|
How do i stretch blit a bitmap in the source DC to a destination DC ? As i see it the destination DC has to have a bitmap selected into it and when i stretchblt the source DC to the dest DC only the part where the selected bitmap of the dest DC exists can be overwritten by the stretched source DC and the remaining of the stretched source DC isn't visible.
|
|
|
|
|
Hi Harry,
maybe this code can help you a bit...
SetStretchBltMode(*pDC,COLORONCOLOR);
BITMAPINFOHEADER bmi;
memset(&bmi,0,sizeof(bmi));
bmi.biSize=sizeof(bmi);
bmi.biWidth=pDoc->m_nDataWidth;
bmi.biHeight=-pDoc->m_nDataHeight; // note the negative sign
bmi.biPlanes=1;
bmi.biBitCount=32;
bmi.biCompression=BI_RGB;
StretchDIBits(*pDC,
0, 0,
nWidth, nHeight, // dest
0,0,bmi.biWidth,-bmi.biHeight, // src; again note the negative sign
pDoc->m_pdwData,(BITMAPINFO*)&bmi, // Pointer to the bitmap data
DIB_RGB_COLORS, SRCCOPY);
Chris
|
|
|
|
|
Recently a simple typo produced "a -+ b". It compiled OK in VC6 Level 3. Why? What does this weird sytax mean?
|
|
|
|
|
The + is a unary operator and associates with b. So it's the same as a - (+b)
|
|
|
|
|
CODE:
LPCTSTR pszLicenseKey = "1410[Digisoft]888015934085437";
CComPtr<iclassfactory2>pICF2;
HRESULT hr1 = CoGetClassObject(__uuidof(ProxyGW),CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory2,(void**)&pICF2);
if(FAILED(hr1))
{
CString strMsg;
strMsg.Format("Error (%X) creating ProxyGW", hr1);
AfxMessageBox(strMsg);
return false;
}
hr1 = CoGetClassObject(__uuidof(ProxyGW),CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory2,(void**)&pICF2);
IProxyGW *pUIRaw;
pICF2->CreateLicenseLic(NULL,NULL,__uuidof(ProxyGW),_bstr_t(pszLicenseKey),(void**)&pUIRaw);
ERROR MESSAGE is this:
D:\tsadmin\HostInfoList.cpp(66) : error C2039: 'CreateLicenseLic' : is not a member of '_NoAddRefReleaseOnCComPtr<struct iclassfactory2="">'
|
|
|
|
|
In the COM Declaration Use DECLARE_CLASSFACTORY2(THE_LIC_CLASS)
Cheers
|
|
|
|
|
http://www.autodidact.co.il/
|
|
|
|
|
Too bad I can't read a word of it Is there an English translation in store for it?
|
|
|
|
|
http://www.autodidact.co.il/
|
|
|
|
|
Alona,
Your site is in Hebrew, and a lot of people speak English...
Could you possibly offer a version of your site in English?
Brian Hart
|
|
|
|
|
Hi all,
I have somewhat simple DOS command line, but I can't get it to work.
Here is my code:
// the line to be executed:
// c:\a\wzzip c:\b\b.zip c:\b\*.*
// my first try, it return "The specified file was not found."
ShellExecute(NULL, "open", "C:\\a\\wzzip C:\\b\\b.zip C:\\b\\*.*", NULL, NULL, SW_SHOWNORMAL);
//my second try
WinExec ("c:\\a\\wzzip c:\\b\\b.zip c:\\b\\*.*", SW_SHOW);
//my third try
_spawnl( _P_WAIT, "C:\\a\\wzzip C:\\b\\b.zip C:\\b\\*.*", "C:\\a\\wzzip C:\\b\\b.zip C:\\b\\*.*", NULL, NULL, NULL);
Can anyone please help me? Thanks a lot.
|
|
|
|
|
Hi,
Why not trying the 'system' command? I've done it already a few times to execute a Dos command like you would give it on the command line, and this works fine.
Give it a try?
Best regards,
Geert
|
|
|
|
|
Thank you very much Geert
It works wonderfully!
|
|
|
|
|
I know, i know, this sould trivial, but it's not! CRichEditCtrl has a method to set the default character properties. Here's what I used:
CHARFORMAT cf;
DWORD dwMask = GetRichEditCtrl().GetDefaultCharFormat(cf);
cf.dwMask = dwMask | CFM_COLOR;
cf.crTextColor = m_crFace;
cf.dwEffects &= ~CFE_AUTOCOLOR;
GetRichEditCtrl().SetDefaultCharFormat(cf);
Unfortunately, this does nothing. I added the cf.dwEffects when the cf.crTextColor didn't work. Then I tried calling this code from various places. I put it in the view's OnInitialUpdate(), then ran it from a menu command. Then I tried adding pDC->SetTextColor(m_crFace) to OnPrepareDC(), but that did work either. The font always remains black.
Has anyone else had a problem doing this and found a solution?
Thanks,
Mike Newberry
|
|
|
|
|
Are you calling SetDefaultCharFormat() before putting text in the control? SetDefaultCharFormat() has no effect on text that's alredy in the control.
|
|
|
|
|
Mike Dunn's suggestion started me thinking about the order of things adn I found the solution. I was calling GetRichEditCtrl().SetFont( m_EditorFont ) to set the font immediately *after* calling SetDefaultCharFormat(). Apparently, SetFont() set my font characteristics correctly, but reverted the color to the default system color since the LOGFONT has no provision for color information.
There are 2 ways to fix this: 1) set all the font info in the CHARFORMAT struct and skip the SetFont() call, or 2) call SetFont() *before* calling SetDefaultCharFormat(). I did method 2 to get a quick result. When I did this, the text color automatically changed for all the text *already* in the control, which is the behavior I wanted. I called these methods from the CRichEditView's OnInitialUpdate() method.
Thanks to Mike Dunn for providing the spark to figure this out!
Mike Newberry
|
|
|
|
|
i:\eldis3\bib_source\eurodialoge\errdlg.h(47) : warning C4251: 'm_text' : class 'CString' needs to have dll-interface to be used by clients of class 'ErrDlg'
c:\programme\microsoft visual studio\vc98\mfc\include\afx.h(368) : see declaration of 'CString'
Since I use a lot of lib's (dll's) I get this warning for nearly everything I am exporting.
I can't see any problems with this warning (There are (I hope so) no problems at runtime) but I want to get rid of
these endless warnings at compile time.
Does anyone know from where these warnings are coming?
Does anyone know how to get rid of these warnings?
Thank you...
|
|
|
|
|
Well, you could use
#pragma warning(disable:4251)
But I think this is a warning based upon some other problem you are not diagnosing.
My suspicion is that you might have some of your DLL statically linked to MFC and some are dynamically linked.
Good luck! I was just at a location where they had mixed and matched them with VC 5.0, and wow! did things really go crazy when the VC 6.0 was first used. Had to go through all modules of all related projects and settle on one type or another.
|
|
|
|
|
In the header file for each class in your DLL, specify AFX_EXT_CLASS just before the name of the class and then the whole class will be exported.
ie.
class AFX_EXT_CLASS CErrorDialog : public CDialog
{
//..
};
and then remove any and all export stuff you have anywhere else for that class.
Brian
|
|
|
|
|
Situation:
There is one machine (host) to which number of other machines (subscribers) want to establish connection over Internet. None of the subscribers is under the same domain as host. The idea is that the subscribers could establish as much real-time communication link over Internet to the host, which can only relay on Internet connection. The communication would mostly involve text base exchange.
Question:
I would use some guidelines on how to construct a solution, Windows Sockets, RPC SDK, anything else please suggests. Is it possible? I would also appreciate any samples that you many know off.
Thanks in advance.
|
|
|
|
|
Hi,
You'd need a program which uses winsock to register on a certain port,
then reads the requests from the clients, parses them, connects to the internet, creates new requests and sends
them to the internet servers, gets back its data, removes the header data, sends back the data to the
client programs. And then goes on listening on its port for the next client.
Just an idea...
Chris.
|
|
|
|