i'm having troble with ResetDC() and GDI+. Look at the following codes:
......; // codes to init DEVMODE
//Graphics myG(hdcPrinter);
hDC = ResetDC(hdcPrinter, pDevMode);
the ResetDC() function call will succeed in this way. But if the 2nd line is
not commented, then it will fail and return NULL.
Can anybody tell me why? THX in advance.
Bob Dong
Graphivs gr(hdc);
hdc1 = ResetDC(hdc , pdevmode);
When you call ResetDC(...) and had it been successful then Graphics object g
would be invalid because the hdc is destroyed when you call ResetDC and a
new HDC is returned.
So the above usage is wrong, so don't think of correcting with the above
sequence.
thanks
vipin
"bob dong" <don...@kingsoft.net> wrote in message
news:#tvVLmJc...@TK2MSFTNGP09.phx.gbl...
as MSDN says, ResetDC is disabled between StartPage(...) and EndPage(...).
See the following codes:
StartPage(hdcPrinter);
ResetDC(hdcPrinter, pDevMode); // which will fail
dwErr = GetLastError(); // will return 0x7a
and the following codes:
Graphivs gr(hdc);
hdc1 = ResetDC(hdc , pdevmode);
dwErr = GetLastError(); // will return 0x7a also
and 0x7a == ERROR_INSUFFICIENT_BUFFER == The data area passed to a system
call is too small. i just doubt it.
My conclusion is ResetDC(...) is also disabled after Graphivs gr(hdc);. I
want to use ResetDC(...) to change the paper size and orientation during a
print job. Now the only workaround i can think about is dividing the job
into many separated ones. that's a pity and too ugly.
"vipin" <vi...@nospam.com> wrote in message:
OF7S84Lc...@TK2MSFTNGP11.phx.gbl...
Graphics object encapsulates the hdc and you try to delete the encapsulated
HDC using ResetDC(...), this not right anyway :) Had the ResetDC been
successful, the graphics object is useless and viceversa.
But I don't know you how the sync up is happening between GDI+ object and
GDI object though. Because at GDI level you can't query a GDI+ status which
is maintained by the gdiplus dll.
thanks
vipin
"bob dong" <don...@kingsoft.net> wrote in message
news:#5rWGKSc...@TK2MSFTNGP10.phx.gbl...
"vipin" <vi...@nospam.com> 写入消息新闻
:OlsikTuc...@tk2msftngp13.phx.gbl...