|
You must set up CPrintInfo Class. It has a Method
called SetMaxPage that would set up the number of pages you want to print.
Then you can use the following loop to print
CDC dc; // Printer dc obtained from Print Dialog
CPrintInfo info; // Printer info class
For(page=Info.GetMinPage();page
|
|
|
|
|
i've got a very special problem. i created a global variable. the variable contains an array of an other object. that object contains only three pointers to other objects. they are initialized with 0.
the problem is:
the array can't be bigger than 213. why is that, and how can i solve this?
thx
|
|
|
|
|
Hi,
when i create a new document the new child window is shown in its original size; i want to
resize it to its maximum. How can i do that?
My problem is that i don't know how to get access to the new child window.
I have tried to resize all available views in CDocument::OnNewDocument() with ShowWindow(...), but this didn't work.
Any help?
Thanks,
Chris
|
|
|
|
|
|
In CChildFrame::OnCreate() send message WM_SYSCOMMAND with wParam=SC_MAXIMIZE
|
|
|
|
|
Perfect! Thanx
|
|
|
|
|
I've developed an NT Service and implemented event messages that are logged as application messages. The message compiler builds the .RC file and the .BIN file for me. The .RC file is compiled into the .RES file for the service. After I install and run the service, however when I look into the event log, I discover that while the differents events have been logged, the message assoicated with them is not available as part of the 'Details' of the event. I suspect that the .BIN file has to go somewhere, but I don't where. Anybody have a thought of what to look at?
Thanks.
Chris
|
|
|
|
|
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
|
|
|
|