MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




TIP: Printing to other than default printer

This is a discussion on TIP: Printing to other than default printer within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I was able to print my MapPoint control's map to any desired printer from VB6 with a common dialog control ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-23-2002
Junior Member
White Belt
 
Join Date: Aug 2002
Posts: 3
TIP: Printing to other than default printer

I was able to print my MapPoint control's map to any desired printer from VB6 with a common dialog control and a couple API calls. Any suggestions/comments are welcome.

Use at your own risk, not the views of my company, blah, blah.

Public Const WM_SETTINGCHANGE As Long = &H1A
Public Const HWND_TOPMOST = -1

Public Declare Function GetProfileString Lib "kernel32" _
Alias "GetProfileStringA" _
(ByVal lpAppName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long) As Long

Public Declare Function WriteProfileString Lib "kernel32" _
Alias "WriteProfileStringA" _
(ByVal lpszSection As String, _
ByVal lpszKeyName As String, _
ByVal lpszString As String) As Long

Declare Function PostMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lparam As String) As Long

'*************************************
Private Sub PrintMapPointControl(asTitle As String, abIncludeLegend As Boolean, abIncludeOverview As Boolean, abFaxable As Boolean)
Dim sDefaultPrinter As String
Dim nSize As Long
Dim lRet As Long

'save the original default printer
nSize = 256
sDefaultPrinter = Space$(nSize)
lRet = GetProfileString("windows", "device", "", sDefaultPrinter, nSize)
sDefaultPrinter = Left$(sDefaultPrinter, lRet)

'*** Use common dialog control to prompt user for desired printer
CommonDialog1.PrinterDefault = True
CommonDialog1.CancelError = True

On Error GoTo PRINT_CANCEL
CommonDialog1.ShowPrinter
On Error GoTo 0

'*** tell the MapPoint control where to print to
m_oMap.Application.ActivePrinter = Printer.DeviceName

'*** print the current map
On Error GoTo RESET_DEFAULT_PRINTER
m_oMap.PrintOut , asTitle, CommonDialog1.Copies, geoPrintMap, geoPrintQualityPresentation, geoPrintAuto, False, abIncludeLegend, abIncludeOverview, abFaxable

RESET_DEFAULT_PRINTER:
'*** reset the original default printer
WriteProfileString "windows", "device", sDefaultPrinter

'*** flush any cached settings
WriteProfileString vbNullString, vbNullString, vbNullString

'*** tell other apps that default printer has changed
lRet = PostMessage(HWND_TOPMOST, WM_SETTINGCHANGE, 0&, StrPtr("windows"))

PRINT_CANCEL:
'*** user pressed cancel on common dialog

End Sub
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
default, printer, printing, tip


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Getting MapPoint to recognize the new default printer BobFromBoston MapPoint 2006/2009 Discussion 2 02-26-2006 05:30 AM
Trying to print detail maps on a strip printer BobFromBoston MapPoint 2006/2009 Discussion 4 01-02-2006 03:52 AM
Default Value in Find Anonymous MapPoint 2006/2009 Discussion 1 03-01-2004 12:25 PM
Printer Error with Trial Version Anonymous MapPoint 2006/2009 Discussion 0 09-03-2003 09:24 PM
Change default country Anonymous MapPoint 2006/2009 Discussion 1 12-30-2002 02:27 PM


All times are GMT -5. The time now is 01:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Florida Holiday
Book your Florida holiday through UlookUbook and save cash!



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59