Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default Windows Printer (Strange problem)
Message
 
To
11/09/2000 06:22:01
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00414797
Message ID:
00414826
Views:
17
>Hello.
>I write code for Set default windows printer
>I have strange problem. When I place MSGBOX("Run") in method.. I see.. Default printer was set. But If I rem MSGBOX() the old printer stay as default.
>Can you explain that?
>Thank you
>
>Here code:
>
> Dim x As Printer
> i = 0
> For Each x In Printers
> If x.DeviceName = "Office eBiz Fax" Then
>
> MsgBox ("Set Office eBiz Fax as Active printer")
> szPrinter = Printers(i).DeviceName & "," & Printers(i).DriverName & "," & Printers(i).Port
> l = WriteProfileString("Windows", "Device", szPrinter)
> l = SendNotifyMessage(HWND_BROADCAST, WM_WININICHANGE, 0, "Device")
> l = SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, "windows")
>
> End If
> i = i + 1
> Next

Place a DoEvents instead of your msgbox.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform