Click here to Skip to main content
15,907,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Embed Exectuable Pin
David Crow6-May-05 4:12
David Crow6-May-05 4:12 
GeneralRe: Embed Exectuable Pin
zx2c46-May-05 14:55
zx2c46-May-05 14:55 
GeneralConvert a CStringArray member to char[49] Pin
Member 6674685-May-05 14:19
Member 6674685-May-05 14:19 
GeneralRe: Convert a CStringArray member to char[49] Pin
Arsalan Malik5-May-05 18:21
Arsalan Malik5-May-05 18:21 
GeneralPlease help in getting Unicode Filenames into a file Pin
stvprg5-May-05 11:52
stvprg5-May-05 11:52 
GeneralSaving printer options Pin
crowbarcberg5-May-05 11:09
crowbarcberg5-May-05 11:09 
GeneralRe: Saving printer options Pin
PJ Arends5-May-05 12:25
professionalPJ Arends5-May-05 12:25 
GeneralRe: Saving printer options Pin
crowbarcberg5-May-05 17:27
crowbarcberg5-May-05 17:27 
Ok so I have the following code to save the printer options:
CPrintDialog pd(TRUE);<br />
pd.DoModal();<br />
DEVMODE *dm=pd.GetDevMode();<br />
theApp.WriteProfileBinary("CheckPrinter", "DevMode",  (LPBYTE)&dm, sizeof(dm));<br />
theApp.WriteProfileString("CheckPrinter", "DeviceName",  (LPCTSTR) pd.GetDeviceName());<br />
theApp.WriteProfileString("CheckPrinter", "PortName",  (LPCTSTR) pd.GetPortName());<br />
theApp.WriteProfileString("CheckPrinter", "DriverName",  (LPCTSTR) pd.GetDriverName());


Then to read it back:
DEVMODE *hDevMode;<br />
UINT nl;<br />
CString csDeviceName, csPortName, csDriverName;<br />
theApp.GetProfileBinary("CheckPrinter", "DevMode",  (LPBYTE*)&hDevMode, &nl);<br />
theApp.GetProfileString("CheckPrinter", "DeviceName",  csDeviceName);<br />
theApp.GetProfileString("CheckPrinter", "PortName",  csPortName);<br />
theApp.GetProfileString("CheckPrinter", "DriverName",  csDriverName);<br />
<br />
CDC* pDC=new CDC();<br />
pDC->CreateDC(csDriverName, csDeviceName, csPortName, hDevMode);


Does this look right? I am not familar with the Get/WriteProfileBinary functions and it didn't look like it was retreiving the information correctly when I debugged it.

Also how would I get the same options back into a CPrintDialog object so that a user could change the options?

And finally where should I call the CDC::CreateDC() function from the view class so that the CPrintDialog dialog won't be displayed again? Currently I have OnPreparePrinting(), OnBeginPrinting(), OnEndPrinting(), and OnPrint() functions extended in my view class.

Thanks,
Chad
GeneralRe: Saving printer options Pin
Ryan Binns5-May-05 18:09
Ryan Binns5-May-05 18:09 
GeneralRe: Saving printer options Pin
crowbarcberg6-May-05 2:44
crowbarcberg6-May-05 2:44 
GeneralRe: Saving printer options Pin
PJ Arends6-May-05 5:47
professionalPJ Arends6-May-05 5:47 
GeneralRe: Saving printer options Pin
PJ Arends6-May-05 6:45
professionalPJ Arends6-May-05 6:45 
GeneralRe: Saving printer options Pin
crowbarcberg6-May-05 9:14
crowbarcberg6-May-05 9:14 
GeneralRe: Saving printer options Pin
PJ Arends6-May-05 10:59
professionalPJ Arends6-May-05 10:59 
GeneralRe: Saving printer options Pin
crowbarcberg6-May-05 11:15
crowbarcberg6-May-05 11:15 
GeneralRe: Saving printer options Pin
PJ Arends6-May-05 13:46
professionalPJ Arends6-May-05 13:46 
GeneralRe: Saving printer options Pin
crowbarcberg6-May-05 15:31
crowbarcberg6-May-05 15:31 
GeneralRe: Saving printer options Pin
crowbarcberg13-May-05 6:22
crowbarcberg13-May-05 6:22 
GeneralRe: Saving printer options Pin
crowbarcberg13-May-05 6:30
crowbarcberg13-May-05 6:30 
GeneralRe: Saving printer options Pin
PJ Arends13-May-05 9:11
professionalPJ Arends13-May-05 9:11 
GeneralVS 6.0 - service pack info Pin
john john mackey5-May-05 10:23
john john mackey5-May-05 10:23 
GeneralRe: VS 6.0 - service pack info Pin
Kevin McFarlane5-May-05 10:30
Kevin McFarlane5-May-05 10:30 
GeneralRe: VS 6.0 - service pack info Pin
Anonymous5-May-05 10:43
Anonymous5-May-05 10:43 
GeneralRe: VS 6.0 - service pack info Pin
Kevin McFarlane5-May-05 12:05
Kevin McFarlane5-May-05 12:05 
GeneralRe: VS 6.0 - service pack info Pin
David Crow6-May-05 4:25
David Crow6-May-05 4:25 

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.