Click here to Skip to main content
15,923,051 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to get total height and width of the screen ? Pin
Ravi Bhavnani10-Aug-05 8:48
professionalRavi Bhavnani10-Aug-05 8:48 
AnswerRe: How to get total height and width of the screen ? Pin
ThatsAlok10-Aug-05 17:44
ThatsAlok10-Aug-05 17:44 
QuestionWhat is: FONT 8, "MS Sans Serif", 0, 0, 0x1 Pin
[d3m0n]10-Aug-05 2:53
[d3m0n]10-Aug-05 2:53 
AnswerRe: What is: FONT 8, "MS Sans Serif", 0, 0, 0x1 Pin
David Crow10-Aug-05 3:45
David Crow10-Aug-05 3:45 
GeneralRe: What is: FONT 8, "MS Sans Serif", 0, 0, 0x1 Pin
[d3m0n]10-Aug-05 23:45
[d3m0n]10-Aug-05 23:45 
GeneralRe: What is: FONT 8, "MS Sans Serif", 0, 0, 0x1 Pin
David Crow11-Aug-05 2:30
David Crow11-Aug-05 2:30 
GeneralLooking for a file Pin
Halawlaws10-Aug-05 2:53
Halawlaws10-Aug-05 2:53 
GeneralRe: Looking for a file Pin
BlackDice10-Aug-05 2:57
BlackDice10-Aug-05 2:57 
GeneralRe: Looking for a file Pin
Halawlaws10-Aug-05 3:40
Halawlaws10-Aug-05 3:40 
GeneralRe: Looking for a file Pin
Jose Lamas Rios10-Aug-05 3:06
Jose Lamas Rios10-Aug-05 3:06 
GeneralRe: Looking for a file Pin
Halawlaws10-Aug-05 3:40
Halawlaws10-Aug-05 3:40 
GeneralRe: Looking for a file Pin
Marc Soleda10-Aug-05 3:20
Marc Soleda10-Aug-05 3:20 
GeneralRe: Looking for a file Pin
Halawlaws10-Aug-05 3:38
Halawlaws10-Aug-05 3:38 
GeneralRe: Looking for a file Pin
Roland Pibinger10-Aug-05 6:17
Roland Pibinger10-Aug-05 6:17 
GeneralOne More My Fav :) Pin
ThatsAlok10-Aug-05 17:40
ThatsAlok10-Aug-05 17:40 
QuestionHow to show static control (label) at desired postion dynamically ? Pin
Amarelia10-Aug-05 2:48
Amarelia10-Aug-05 2:48 
AnswerRe: How to show static control (label) at desired postion dynamically ? Pin
David Crow10-Aug-05 3:46
David Crow10-Aug-05 3:46 
GeneralMFC: Modeless Child Dialog Minimize Behavior Pin
garkhov_major10-Aug-05 2:43
garkhov_major10-Aug-05 2:43 
GeneralAbout printing margin Pin
a_du10-Aug-05 2:11
a_du10-Aug-05 2:11 
GeneralAlogorithm for graphical time display in scheduling application Pin
Alexandar Kolaric10-Aug-05 2:08
Alexandar Kolaric10-Aug-05 2:08 
GeneralProblem in using API "DocumentProperties()" Pin
Kevin Bao10-Aug-05 1:25
Kevin Bao10-Aug-05 1:25 
When I use the API in a DLL project, I got an error:

HANDLE hPrinter = NULL;<br />
PDEVMODE pDevMode = NULL;<br />
char szPrinter = {"HP LaserJet 9050 PCL 6"};<br />
<br />
BOOL bOpen = ::OpenPrinter(szPrinter, &hPrinter, NULL);<br />
if (!bOpen || hPrinter == NULL) return;<br />
<br />
long nSize = ::DocumentProperties(NULL, hPrinter, szPrinter, NULL, NULL, 0);	// ERROR<br />
DWORD dwErr = GetLastError();<br />
if (nSize < 0)<br />
{<br />
    ::ClosePrinter(hPrinter);<br />
    return;<br />
}<br />
<br />
pDevMode = (PDEVMODE)new char[nSize];<br />
if (pBuffer == NULL)<br />
{<br />
    ::ClosePrinter(hPrinter);<br />
    return;<br />
}<br />
<br />
// Get printer info<br />
memset(pBuffer, 0, LENGTH_DEVMODE);<br />
long nReturn = ::DocumentProperties(NULL, hPrinter, szPrinter, pDevMode, NULL, DM_OUT_BUFFER);<br />
::ClosePrinter(hPrinter);<br />
if (nReturn < 0)	// Failed to retrieve printer information<br />
    return;


1.On Windows XP system:
if nSize = 6132, the last error will be 0, and print will succeed.
if nSize = -1, the last error will be 1114, and print will fail.

After "DocumentProperties()", the last error maybe 0 and sometimes maybe 1114. 0 means success while 1114 means "A dynamic link library (DLL) initialization routine failed".

2.On Windows 2000 professional I never got the error.

How can I avoid to fail to print?
GeneralRe: Problem in using API &quot;DocumentProperties()&quot; Pin
David Crow10-Aug-05 3:49
David Crow10-Aug-05 3:49 
GeneralYes, I have done so. After &quot;DocumentProperties()&quot;, the last error maybe 0 and sometimes maybe 1114. Pin
Kevin Bao10-Aug-05 15:58
Kevin Bao10-Aug-05 15:58 
Questionrelative coordinates to absolute? Pin
ThinkingPrometheus10-Aug-05 0:38
ThinkingPrometheus10-Aug-05 0:38 
AnswerRe: relative coordinates to absolute? Pin
icabod10-Aug-05 1:09
icabod10-Aug-05 1:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.