Click here to Skip to main content
15,905,971 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: relative coordinates to absolute? Pin
ThinkingPrometheus10-Aug-05 1:11
ThinkingPrometheus10-Aug-05 1:11 
AnswerRe: relative coordinates to absolute? Pin
ThatsAlok10-Aug-05 1:09
ThatsAlok10-Aug-05 1:09 
QuestionHow to test my code Pin
Member 216100410-Aug-05 0:27
Member 216100410-Aug-05 0:27 
AnswerRe: How to test my code Pin
Bob Stanneveld10-Aug-05 1:03
Bob Stanneveld10-Aug-05 1:03 
AnswerRe: How to test my code Pin
toxcct10-Aug-05 1:13
toxcct10-Aug-05 1:13 
GeneralRe: How to test my code Pin
Tom Wright10-Aug-05 8:37
Tom Wright10-Aug-05 8:37 
GeneralRe: How to test my code Pin
Member 216100410-Aug-05 14:49
Member 216100410-Aug-05 14:49 
GeneralRe: How to test my code Pin
toxcct10-Aug-05 20:12
toxcct10-Aug-05 20:12 
Generalerror LNK2001 Pin
jokefake10-Aug-05 0:12
jokefake10-Aug-05 0:12 
GeneralRe: error LNK2001 Pin
Bob Stanneveld10-Aug-05 1:04
Bob Stanneveld10-Aug-05 1:04 
GeneralRe: error LNK2001 Pin
toxcct10-Aug-05 1:15
toxcct10-Aug-05 1:15 
GeneralRe: error LNK2001 Pin
David Crow10-Aug-05 3:54
David Crow10-Aug-05 3:54 
GeneralRe: error LNK2001 Pin
toxcct10-Aug-05 3:57
toxcct10-Aug-05 3:57 

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.