Author Topic: API DRAWING VIEWER  (Read 2905 times)

0 Members and 1 Guest are viewing this topic.

fxcastil

  • Guest
API DRAWING VIEWER
« on: September 29, 2005, 08:44:42 PM »
I am attaching a drawing viewer written by Randall Rath, I would like to use this but I would like to understand how this works.
I am using this so I can have the same viewer for Autocad versio 2000-2006, I was using ACpreview for 2002
but i dont see this in ver 2005
I added comments for all the windows API function, I don't understand the block of code below


If Len(Dir(strFile)) > 0 Then
    lngFile = FreeFile
    Open strFile For Binary As lngFile
    Seek lngFile, 14
    Get lngFile, , lngImgLoc
    Seek lngFile, lngImgLoc + 17
    lngCurLoc = Seek(lngFile)
    Seek lngFile, lngCurLoc + 4
    Get lngFile, , bytCnt
    If bytCnt > 1 Then
      For intCnt = 1 To bytCnt
        Get lngFile, , udtRec
        If udtRec.bytType = 2 Then
       
        'All of the code preceding this Line
        'Is identical to the code in Part
        'Two of Byte By Byte.
        'Now we begin the color extraction
        'The start value is the BYTE BEFORE
        'The BMP Header data (The RGBQUAD
        'And BMP Header are contained within
        'Another structure), so move the read/
        'Write marker to the next byte...
         
          Seek lngFile, udtRec.lngStart + 1
         
          'Pull out the BMP header data...
          Get lngFile, , udtHeader
         
          'Resize the Byte buffer to the full Length of the data...
         
          ReDim bytBMPBuff(udtRec.lngLen)
         
          'Did you read Randall's article?
         
          If udtHeader.biBitCount = 8 Then
           
            'Resize the array of RGBQuads, I
            'Could also have used the biClrUsed
            'Value of the udtHeader...
           
            ReDim udtColors(256)


I would also like to understand how the size of the drawing view window is determined
see attached file for all of code.



Tom

  • Guest
Re: API DRAWING VIEWER
« Reply #1 on: September 29, 2005, 10:25:39 PM »
Its not exactly a dwg viewer.
It is the bitmap image that is stored with the dwg viewer

Draftek

  • Guest
Re: API DRAWING VIEWER
« Reply #2 on: September 30, 2005, 05:42:26 PM »
Yes, and the bitmap size is detemined by autocad. I believe it's something like 227 x 175