|
A computer word can be any size, it is the unit with which a the system operates. Actually DWORD should be a word, because we are all using 32 bit systems now, but it is a strange holdover from 16-bit days of windows.
|
|
|
|
|
My programs is getting slowed down and the GUI get updates slow IF another average heavy work is running on my computer.. ( like compiling something )
No other program is getting slow. And my program is at normal priority like the other program. It gets a little better if I raise it but I shouldn’t have to (I think).
The strange think is that this only happens if I run the version of my program that is compiled with VS2003. If I run the version I compiled with VS6 everything works fine.
I Also get some freeze up when I start a background thread ( worker thread ) and this thread is doing a lot of work and is sending messages to main thread to update a progress bar and stuff. This totally freezes up the application to until the thread is done.
And this also works fine in VS6. And only happens to the VS2003 compiled version.
So the question is.
Does anyone know what makes this happen?
Does anyone know if any difference from the MFC in VS6 to VS2003 that require some redesign or something?
Or do I have to go back to VS6 for MFC development
|
|
|
|
|
Is it possible to set the default printer as a PDF printer....are there any APIs which support commands to do the conversion
Maverick
|
|
|
|
|
SetDefaultPrinter(LPCTSTR pszPrinter)
|
|
|
|
|
thanks a lot...but it seems that you didn't get the whole problem or rather I didn't frame the problem properly...actually there is an application through which I generate some data, and while printing I want to get the printout in PDF format(I have the PDF writer with me), in that what I get is that the browser window asks me first to save the file in a different format which I don't want. I just want file to be stored at some specified location(which we are free to decide)....In all I want that once the user gives the print command he should get the printout in the PDF format....no interaction in between.....hope I am clear this time
|
|
|
|
|
Are you acessing the PDF print driver through the ICDIntf interface?
If you are, I did it this way:
void CMyView::OnPdfPrint()
{
DOCINFO di;
CPrintInfo printInfo;
CString filename;
CDC dc;
CRect draw_area;
char fname[_MAX_FNAME];
memset(&di, 0, sizeof(DOCINFO));
CFileDialog dlg(FALSE, "PDF", filename, OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY, "Adobe acrobat PDF files (*.pdf)|*.pdf||");
if (dlg.DoModal() == IDCANCEL)
{
return;
}
AfxGetMainWnd()->EnableWindow(false);
CPrintStatus dlgPrintStatus(this);
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_DOCNAME, "Creating PDF interface");
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PRINTERNAME, "");
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PORTNAME, "");
dlgPrintStatus.ShowWindow(SW_SHOW);
dlgPrintStatus.UpdateWindow();
dlgPrintStatus.PumpMessages();
try
{
ICDIntf pdfInterface;
if (pdfInterface.CreateDispatch("CDIntf.CDIntf"))
{
long lPdfError = pdfInterface.PDFDriverInit("Sirius PDF Generator");
if(lPdfError != 0)
{
return;
}
pdfInterface.SetPaperSize(9);
pdfInterface.SetDefaultFileName(filename);
pdfInterface.SetFileNameOptions(1 + 2 + 32);
HDC hDC = (HDC)pdfInterface.CreateDC();
if (hDC != NULL)
{
OnAboutToPrint();
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = pDoc->GetPathName();
di.lpszOutput = filename;
dc.Attach(hDC);
printInfo.m_bDirect = TRUE;
printInfo.m_rectDraw.left = 0;
printInfo.m_rectDraw.right = dc.GetDeviceCaps(HORZRES);
printInfo.m_rectDraw.top = 0;
printInfo.m_rectDraw.bottom = dc.GetDeviceCaps(VERTRES);
draw_area = printInfo.m_rectDraw;
CString strTemp;
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_DOCNAME, fname);
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PRINTERNAME, "PDF Generator");
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PORTNAME, "");
dlgPrintStatus.UpdateWindow();
dc.StartDoc(&di);
OnPreparePrinting(&printInfo);
printInfo.m_rectDraw = draw_area;
for (printInfo.m_nCurPage = 1; printInfo.m_nCurPage <= printInfo.GetMaxPage(); printInfo.m_nCurPage++)
{
strTemp.Format("Page %1d of %1d", printInfo.m_nCurPage, printInfo.GetMaxPage());
dlgPrintStatus.SetDlgItemText(AFX_IDC_PRINT_PAGENUM, strTemp);
dlgPrintStatus.PumpMessages();
dc.StartPage();
OnPrint(&dc, &printInfo);
dc.EndPage();
printInfo.m_rectDraw = draw_area;
}
OnEndPrinting(&dc, &printInfo);
dc.EndDoc();
VERIFY(dc.DeleteDC());
}
else
{
AfxMessageBox("PDF Driver failed, unable to create DC");
}
pdfInterface.SetFileNameOptions(0);
pdfInterface.DriverEnd();
pdfInterface.DetachDispatch();
if (atoi(RegistryProfile::GetProfileStringLM("PrintSettings", "StartPDF", "1")) != 0)
{
ShellExecute(NULL, NULL, filename, NULL, NULL, SW_SHOWMAXIMIZED);
}
}
}
catch (COleDispatchException * e)
{
CString cStr("");
if (!e->m_strSource.IsEmpty())
{
cStr = e->m_strSource + " - ";
}
if (!e->m_strDescription.IsEmpty())
{
cStr += e->m_strDescription;
}
else
{
cStr += "unknown error";
}
AfxMessageBox(cStr, MB_OK, (e->m_strHelpFile.IsEmpty())? 0:e->m_dwHelpContext);
e->Delete();
}
catch (CException *e)
{
TRACE("%s(%d): OLE Execption caught: SCODE = %x", __FILE__, __LINE__, COleException::Process(e));
e->Delete();
}
dlgPrintStatus.DestroyWindow();
AfxGetMainWnd()->EnableWindow();
}
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
|
|
|
I know folks in the technology sector tend to use acronyms quite a bit, but I think this has gone a bit too far.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
|
Hello Techie's,
Can anybody tell where I will find free Tutorials from the ground to the advanced topics in VC++6.0
|
|
|
|
|
Hi,
i want to change the Font of a CRichEditCtrl into Courier, 10. Can someone tell me how ?
Thanks in advance!
|
|
|
|
|
Which part of the CRichEditCtrl::SetDefaultCharFormat() documentation is unclear?
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Thanks, for your help! But I have already tried it with SetDefaultCharFormat and it doesn't work properly! At the present time i use SetFont from CWnd. it's namely more code, but it solves the problem!
|
|
|
|
|
hph wrote:
But I have already tried it with SetDefaultCharFormat and it doesn't work properly!
So what did the code look like? Perhaps it was used incorrectly.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
I need to get the handle of the message box of the messenger service in windows 2000/XP. MSDN says that CBT hooks can be used for this. So i installed a CBT hook, check for HCBT_CREATEWND in the nCode parameter so that I can get the handle to the window in wParam. But this does not happen. Also I cannot check for HCBT_ACTIVATE because in Win 2K/XP, the message box from the messenger service does not have focus when it is created.
« Superman »
|
|
|
|
|
How can I create a control object at runtime dynamically and join it to the dialog.
eg. If I want to create many buttons at runtime after the user choosen some options(like no. of buttons he wants to use it).So what can I do.
Could anybody helps me please ?
Dr Abudawood
|
|
|
|
|
If using MFC: CButton::Create .
If using raw Win32: CreateWindowEx , passing "BUTTON" as the lpClassName parameter.
See also the Predefined User Controls[^].
|
|
|
|
|
Thank you very much MR\ Mike I will test it in MFC.
Dr Abudawood
|
|
|
|
|
Hi,
I have an option dialog which I want to use in several projects. To copy the dialog class files is not the problem but the dialog itself? I guess it must be somewhere in the ressource files.
Does anyone know how to do it?
|
|
|
|
|
Open the project you want to copy to, then click File->Open and open the .RC file that you want to copy from. Go to the ResourceView tab in the workspace, and then you can drag/drop between the the two to move resources. Hold Ctrl to copy instead.
(Note this is for VC 6, I don't use VC 7 so I've no idea if this will work in 7)
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Thanks for the quick help.
Unfortunately it does not work. I am using VC 7 and it is not possible to drag/drop a dialog between the two resources. The mouse pointer changes its state to "forbidden".
|
|
|
|
|
right click on the dialog and open binary data....copy the entire binary data......now in ur new project add a new dialog....and replace the binary data with the data copied......may not be the best way to do it but works fine with me
rIsHaBh
|
|
|
|
|
Yes, that works really well and fine for me as well.
Thanks a lot.
|
|
|
|