You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcObjects Mapping forum

Imapdocument quirks   Eric O'Neal Mar 15, 2007
Re: Imapdocument quirks   Julie Guillory Jan 11, 2010
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Imapdocument quirks 
Author Eric O'Neal 
Date Mar 15, 2007 
Message I'm trying to do a simple export of a layout in VB6 (bleh) using 'Imapdocument'. I put the code below in to a simple For-Next loop for testing purposes and with every other run thru the loop, the mapscale zooms in a bit. I ran the same code inside of Arcmap and this does not happen. What gives?

Also I'm having problems changing the document scale, same as in this thread: http://forums.esri.com/Thread.asp?c=93&f=993&t=197685&mc=5#msgid591861

GetDesktopWindow returns long, but pActiveview.Activate requires an integer so it always bombs out on me.

 
 
Private Sub Command2_Click()

Dim x As Integer
For x = 1 To 10
ExportActiveView "C:\temp\vb6rainmovie\data\" & x & ".jpg"
Next
End Sub

Private Sub ExportActiveView(filename As String)

    
    Dim playout As IActiveView
    Set playout = mapdoc.PageLayout
    
    Dim rectOut As tagRECT
    rectOut = playout.ExportFrame

    Dim pEnv As IEnvelope
    Set pEnv = New Envelope
    pEnv.PutCoords rectOut.left, rectOut.top, rectOut.right, rectOut.bottom

    Dim pExporter As IExporter
    Set pExporter = New JpegExporter

    pExporter.ExportFileName = filename
    pExporter.PixelBounds = pEnv
    pExporter.Resolution = 96
    'Recalc the export frame to handle the increased number of pixels
    Set pEnv = pExporter.PixelBounds

    Dim xMin As Double, yMin As Double
    Dim xMax As Double, yMax As Double
    pEnv.QueryCoords xMin, yMin, xMax, yMax

    rectOut.left = xMin
    rectOut.top = yMin
    rectOut.right = xMax
    rectOut.bottom = yMax
    
    'Do the export
    Dim hDc As Long
    hDc = pExporter.StartExporting

    playout.Output hDc, pExporter.Resolution, rectOut, Nothing, Nothing
    pExporter.FinishExporting
    
  
End Sub
 
  ----------------------
Eric O'Neal
Louisville MSD
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Imapdocument quirks 
Author Julie Guillory 
Date Jan 11, 2010 
Message Just dealt with this and couldn't find answer anywhere, so thought I would post in case anyone else runs into this. Should declare GetDesktopWindow as Integer for VB .Net. 
 
Private Declare Function GetDesktopWindow Lib "user32" () As Integer