[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference abbott::visual_basic

Title:Microsoft Visual Basic
Moderator:TAMARA::DFEDOR::fedor
Created:Thu May 02 1991
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2565
Total number of notes:10453

2512.0. "Change default printer under '95 via Registry ?" by FUTURS::MARSHALL1 () Mon Mar 10 1997 05:01

    
    Folks,
    
    	I have searched this conference for the answer to this, but all of
    the notes and/or replies that appear to be relevant refer only to
    Windows 3.1 and WIN.INI situations. I am working under Windows 95 with
    the System Registry.
    
    I am trying to change the default printer from code (a continuation of
    the problem I had a couple of weeks back with Crystal Reports). I have
    successfully updated the setting for registry value:
    
    HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\Print\Printers\Default
    
    with the printer that is required, but this has had no effect on
    Crystal Reports, which ignores the fact that things have changed and
    still prints to the 'old' default printer. The printers window is also
    unaffected by this change to the registy with the old printer still
    being 'Set As Default'.
    
    I then tried a different tack and changed the setting of:
    
    [windows]
    Device=...
    
    for the printer in WIN.INI	This seemed to change the printer that
    Crystal reports prints to, but the printer window still shows the old
    printer as 'Set As Default'.
    
    Has anyone changed the default printer successfully/completely under
    WIndows 95. I have spent a while digging through the registry, but
    there is so much c%^p in there it will take for ever and a day to track
    things down.
    
    Does anyone have details of precisely what needs to be set in the
    registry to change the default printer ?  Does anyone know if Crystal
    Reports determines it's default printer from WIN.INI rather than
    settings in the Registry ? It appears to, but I cannot find it
    documented anywhere ...
    
    I can get round Crystal Reports for the moment with the change to
    WIN.INI, but I am not 100% happy that this is the correct way to do
    this.
    
    	Steve
    
T.RTitleUserPersonal
Name
DateLines
2512.1Would SetPrinterData API do it?MRSERV::PETERSMon Mar 10 1997 18:154
    It looks like what you need to do is call the SetPrinterData API,
    described on page 952 of the Visual Basic Programmer's Guide to the
    Win32 API, by Daniel Appleman.
    
2512.2Broadcast messageFUTURS::MARSHALL1Wed Apr 09 1997 07:308
    
    I ended up calling Microsoft, and what they said was to update the
    WIN.INI and then issue a broadcast message to notify existing
    applications that the WIN.INI file has changed. Any applications that
    preload the WIN.INI file shoul then reload.
    
    	Steve