>I am writing a MSVC++ process that uses WinExec() and a "macro" to
>print some forms. I need to print the form with both gl2 graphics and
>raster graphics, and I am using WriteProfileString() to change the
>printer profile in the win.ini file.
>Problem: The profile is not changing!
>Wrong Solution: If I re-boot windows between prints, the new profile
>changes take effect. Needless to say, this defeats the purpose of
>automating the process.
>HELP: As I understand it, Microsoft is now caching the printer
>profiles seperately since windows 3.1. How do I force windows, and the
>printer drivers, to re-read the .ini file? Or, is there another method
>of changing the printer profiles under program control?
>Thanks for any help I can get :-)
I am not exactly sure what you mean by WinExec() & a 'macro',
but here is some general information about accessing printer
Your application should NOT change the printer settings in
win.ini. Try this. Start up notepad, switch to a printer other than
the default printer and print something. Now shut it down and
start it up again. Check the default printer - it hasn't changed,
has it? No, that's because the application didn't modify the
win.ini file. It used the selected printer as a 'local' setting
and discarded it when it terminated. This is the way all apps
I get *really* annoyed at applications which change my default
printer settings, so that I have go back to control panel
and reset them. I think an older version of PaintShop Pro
Your application should allow the user to select a printer for
the purpose of printing from that application only, but it should
not change the default printer setting. The old way to get
printer info was to 'read' win.ini. The modern way is to call
the COMMDLG.DLL PrintDlg() function. You can call it with
PD_RETURNDC to return an HDC to you and/or you can call it
in a non-interactive way with PD_RETURNDEFAULT.
Geological Survey of Canada, Ottawa