Click here to Skip to main content
16,020,714 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can GDI and RichEdit share the WindowClient (and live together) Pin
ForNow28-Nov-21 8:33
ForNow28-Nov-21 8:33 
QuestionPlease give me explanation to this code.Explain me the second line of code. What will be the output? Pin
poojitha0822-Nov-21 19:04
poojitha0822-Nov-21 19:04 
AnswerRe: Please give me explanation to this code.Explain me the second line of code. What will be the output? Pin
Victor Nijegorodov22-Nov-21 20:31
Victor Nijegorodov22-Nov-21 20:31 
Rant[REPOST] Please give me explanation to this code.Explain me the second line of code. What will be the output? Pin
Richard Deeming22-Nov-21 21:31
mveRichard Deeming22-Nov-21 21:31 
QuestionCPrintDialog default printer. Pin
Maximilien18-Nov-21 3:40
Maximilien18-Nov-21 3:40 
AnswerRe: CPrintDialog default printer. Pin
Victor Nijegorodov18-Nov-21 7:17
Victor Nijegorodov18-Nov-21 7:17 
GeneralRe: CPrintDialog default printer. Pin
Maximilien19-Nov-21 5:00
Maximilien19-Nov-21 5:00 
GeneralRe: CPrintDialog default printer. Pin
Randor 19-Nov-21 12:34
professional Randor 19-Nov-21 12:34 
Max,

The default constructor is in the documentation[^]:
C++
CPrintDialog(
    BOOL bPrintSetupOnly,
    DWORD dwFlags = PD_ALLPAGES | PD_USEDEVMODECOPIES | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE | PD_NOSELECTION,
    CWnd* pParentWnd = NULL);

The default constructor does not contain PD_RETURNDEFAULT. You will need to use the PD_RETURNDEFAULT flag[^] to get the CPrintDialog class to simply return the default printer. In fact by using this flag the DoModal(); function won't even open a window.

C++
CPrintDialog dlg(FALSE,PD_RETURNDEFAULT,NULL);
dlg.DoModal();
LPDEVMODE lpdev = dlg.GetDevMode();
MessageBox(lpdev->dmDeviceName,0,0);

Windows 10 makes decisions for the novice users. So Windows 10 will sometimes decide which printer to use and override the user choice. To disable this programmatically you could set the HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\LegacyDefaultPrinterMode to TRUE.

Best Wishes,
-David Delaune
GeneralRe: CPrintDialog default printer. Pin
Maximilien22-Nov-21 1:48
Maximilien22-Nov-21 1:48 
PraiseRe: CPrintDialog default printer. Pin
Randor 22-Nov-21 2:45
professional Randor 22-Nov-21 2:45 
Question++ operator in the case of pointers Pin
Calin Negru15-Nov-21 5:32
Calin Negru15-Nov-21 5:32 
AnswerRe: ++ operator in the case of pointers Pin
Richard MacCutchan15-Nov-21 6:20
mveRichard MacCutchan15-Nov-21 6:20 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru15-Nov-21 7:10
Calin Negru15-Nov-21 7:10 
GeneralRe: ++ operator in the case of pointers Pin
Richard Andrew x6415-Nov-21 7:26
professionalRichard Andrew x6415-Nov-21 7:26 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru15-Nov-21 7:38
Calin Negru15-Nov-21 7:38 
AnswerRe: ++ operator in the case of pointers Pin
k505415-Nov-21 11:37
mvek505415-Nov-21 11:37 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru16-Nov-21 2:55
Calin Negru16-Nov-21 2:55 
GeneralRe: ++ operator in the case of pointers Pin
Richard MacCutchan17-Nov-21 3:02
mveRichard MacCutchan17-Nov-21 3:02 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru17-Nov-21 6:10
Calin Negru17-Nov-21 6:10 
GeneralRe: ++ operator in the case of pointers Pin
jsc4217-Nov-21 4:58
jsc4217-Nov-21 4:58 
GeneralRe: ++ operator in the case of pointers Pin
k505417-Nov-21 5:20
mvek505417-Nov-21 5:20 
Questionc++ code interpreter/debugging tool Pin
Calin Negru10-Nov-21 1:40
Calin Negru10-Nov-21 1:40 
AnswerRe: c++ code interpreter/debugging tool Pin
jeron110-Nov-21 6:09
jeron110-Nov-21 6:09 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru10-Nov-21 7:36
Calin Negru10-Nov-21 7:36 
GeneralRe: c++ code interpreter/debugging tool Pin
jeron110-Nov-21 7:47
jeron110-Nov-21 7:47 

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.