|
I have a VC++ program which used to print some document...my program gives same printing quality for all printers except EPSON- ink jet printer.....is there any printer specific routine i need to write which will support for epson fonts .my understanding is fonts and their charecteristics are printer independent! still why i suppose to get hazy fonts in epson...the printer is good working with other word documents....
thanx in advance...
birajendu
CyberG India
Delhi
India
|
|
|
|
|
I saw an article I think(not sure) it was on the codeproject about set some setting for printers but I forgot its name if you search on the codeproject you can find it.
|
|
|
|
|
Mmm, I was thinking it at the beggining too. But after programming the printing part of my project... I don't believe it anymore.
I got sucess declaring the things like that:
pDC->SetMapMode (MM_LOMETRIC);
CDC dcGraphMem; dcGraphMem.CreateCompatibleDC (pDC);
CFont fontLabels; fontLabels.CreatePointFont (80, "MS Sans Serif", pDC);
CFont fontInfo; fontInfo.CreatePointFont (140, "MS Sans Serif", pDC);
double dLeftOffset = 200 - (pDC->GetDeviceCaps (PHYSICALOFFSETX) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSX);
double dTopOffset = 200 - (pDC->GetDeviceCaps (PHYSICALOFFSETY) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSY);
double dRightMargin = 2770 - (pDC->GetDeviceCaps (PHYSICALOFFSETX) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSX);
double dBottomMargin = 1950 -(pDC->GetDeviceCaps (PHYSICALOFFSETY) * 254.0) / pDC->GetDeviceCaps (LOGPIXELSY);
pInfo->m_rectDraw.left += (int) dLeftOffset;
pInfo->m_rectDraw.top += (int) dTopOffset;
pInfo->m_rectDraw.right = (int) dRightMargin;
pInfo->m_rectDraw.bottom = (int) dBottomMargin;
And then using it like that:
pDC->SelectObject (&fontLabels);
pDC->SetBkMode (TRANSPARENT);
pDC->TextOut (pInfo->m_rectDraw.left, 50 - pInfo->m_rectDraw.bottom, pDoc->GetFileName());
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hello and good day. I currently have a problem with LoadImage (i think) in my application.
The application reads a file, changes it into bitmap format, uses LoadImage to display a file,
then uses StretchBlt to resize/rotate it. The user selects the file to load and display. Now the
problem is, I tried to do a stress test for it and the LoadImage fails after around 100 tries of
loading a 2000x2000 bmp file. I checked the HBITMAP handler which receives the data from the LoadImage and it contains NULL at that time. I still am not sure if the LoadImage is really the problem, I think it may be all the memory allocations I made but I checked them again and again and they were certainly released when a new image is loaded. Can somebody please advise me and help me about this problem?
Thank you!
|
|
|
|
|
|
The code is actually too large to paste in here. I can only paste the function which displays has the LoadImage part.
<br />
void CDlg::DisplayImage()<br />
{<br />
gOtherClass.gDisplayPanelHandle = (HBITMAP)::LoadImage<br />
( <br />
0, <br />
gMapPath, <br />
IMAGE_BITMAP, <br />
gSourceSize.cx,<br />
gSourceSize.cy,<br />
LR_DEFAULTCOLOR | LR_LOADFROMFILE <br />
);<br />
<br />
if(gOtherClass.gDisplayPanelHandle == NULL)<br />
{<br />
AfxMessageBox("Error!\nUnable to load Map File");<br />
return;<br />
}<br />
<br />
gCDC.SelectObject(gOtherClass.gDisplayPanelHandle);<br />
<br />
gCDC.StretchBlt<br />
(<br />
0, <br />
0,<br />
gSourceSize.cx,<br />
gSourceSize.cy,<br />
&gCDC,<br />
0, <br />
gSourceSize.cy - 1,
gSourceSize.cx,<br />
-gSourceSize.cy,<br />
SRCCOPY<br />
);<br />
Invalidate(FALSE);<br />
}<br />
|
|
|
|
|
What is gOtherClass.gDisplayPanelHandle?
|
|
|
|
|
its a class which contains all the shared variables between other characters. I have noticed also that after around 100 times of loading a bitmap, the application's performance is starting to decline.
|
|
|
|
|
Llasus wrote: gOtherClass.gDisplayPanelHandle
Do you destroy the handle after every display?
|
|
|
|
|
yes. I made sure that it destroys the object before loading the next image.
|
|
|
|
|
When calling SelectObject , you need to store the Pointer to the old GdiObject you get from the call and re-SelectObject it after finishing work.
You are producing a so called GDI-Resource-Leak. In the ProcessExplorer, you cann swith on display of used GDI-Objects.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Thank you for the help. I will try this tomorrow. I have not encountered this GDI-Resource-Leak though. Sorry but could you please explain further what you mean by re-SelectObject after finishing the work and why I need it? Usually when loading the next image I just use the DeleteObject() to somehow release the object for next use.
|
|
|
|
|
Llasus wrote: could you please explain further what you mean by re-SelectObject after finishing the work and why I need it?
What I mean is this:
<small>CBitmap m_bmpSnapshot = ...</small>
CBitmap* pOldBmp = dcSnapshot.SelectObject(&m_bmpSnapshot);
dcSnapshot.BitBlt(0, 0, width, height, &dc, 0, 0, SRCCOPY);
dcSnapshot.SelectObject(pOldBmp);
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
I see. thank you very much for the help! I will try to test this tomorrow. Again, thank you very much for the time and help!
|
|
|
|
|
It worked! Thank you so much for your help. I was never aware of the possibility that GDI may leak if you don't save and re-select the pointer that SelectObject returned. I did past applications though without doing that. Though not as much on loading in images like this one. Again, thank you to all that helped specially jhwurmbach.
|
|
|
|
|
Hi all,
Is there a way to get the codepage of a japanese attachment with a japanese filename? What property can I use to get this?
Thanks,
Jj
|
|
|
|
|
Hi all,
I know how to create minidumps in VC++, but I tried doing the same thing using C++ Builder Professional with no luck. Message I receive is that no debug binaries were loaded. So does anybody know or have done it before in Borland?
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
hi
i have developed a GUI in which i have used static LED which is provided by Digistatic .h.i have added a combo box to it , created a member for it and executed the application.when iam closing the application assertion failed message is being displayed. this message is being display only when i try to create an object of the class to which the control belongs to ( for ex CComboBox m_cmbBaudrate).when i create a member as (string m_cmbBaudrate ) it is not giving any message.
so please can anyone help me to sort out this issue.
sathish
|
|
|
|
|
Did you use of breakpoints and debugger for see error?
|
|
|
|
|
Most probably will be a failure with your destructor. The controls need a handler to the parent window. and when you close, and the destructor o the window try to call the destructor of the control. The control has no owner and he asserts.
Is the same as if u want to load some strings in the CComboBox inside the constructor of the dialog, you will have the same assertion. You have to load the datas in OnInitDialog or OnInitialUpdate, insteads of in the constructor.
With the CString you dont have any problem because they are not having such issues.
Take a look where you use the CComboBox and try debugging step by step to find out the secuence o opening/ closing a dialog. I did that using all the messages in relation with creating/destroying a Dialog and just putting an AfxMessageBox with the name of the message calling it and some text inside
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
mosali satish wrote: i have developed a GUI in which i have used static LED which is provided by Digistatic .h.
I did this once here.
mosali satish wrote: when iam closing the application assertion failed message...
What line of what file is asserting?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
right now i am working on a project in which i am using inhouse list component which is using MFC Scrollbar . problem is that when that List is filled with around 40000 records and when i am moving Tracker of and reach to the position "32768" (tracker value) it is getting reset to first position.
this is happening beacuse the in the core file "wincore.cpp" (which is actually handling this event) getting parameter wParam (which is UINT ptr) and from this parameter it is actually retrieving Tracker value. wParam can contain max 2147483648 value.
when tracker reaches to 32768th row its holding 2147483653 , which is beyond range of integer.
Now can anyone tell me whats the solution if i have more than more than 32767 records in a single page , or is there any option in ScrollBar that can handle this situation ?
Thank You ,
Perry
|
|
|
|
|
Extract from http://msdn2.microsoft.com/en-us/library/z91cdf5a(VS.80).aspx[^]
The MFC Windows message handlers that indicate scroll bar position, CWnd::OnHScroll and CWnd::OnVScroll, provide only 16 bits of position data. GetScrollInfo and SetScrollInfo provide 32 bits of scroll bar position data. Thus, an application can call GetScrollInfo while processing either CWnd::OnHScroll or CWnd::OnVScroll to obtain 32-bit scroll bar position data.
|
|
|
|
|
Thank you Roger ..
Hope this will work ...
|
|
|
|
|
Hi,
In some of the singleton classes, I have seen that
People are keeping the destructor of singleton class in 'Public' Section of class.
Is it right to allow some one from outside to delete the singleton Object.
Thanks in advance,
Vinod.C.S
|
|
|
|