Results 1 to 3 of 3

Thread: [RESOLVED] .frx/.frm to .bmp - urgent and stuck!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Location
    Melbourne, Australia
    Posts
    92

    Resolved [RESOLVED] .frx/.frm to .bmp - urgent and stuck!

    I am basically screwed at the moment... I was previously working on my VB6 project at work, and the company closed down 3 weeks ago. I thought I had backed up everything I needed, but it seems I missed one folder that contained some vital information. One file I'm in need of is an image, which currently sits in a PictureBox (Pic1) on Form1. I can go into VB6 and View Object and can see the image there, but I can't find a way to save the image to my hard drive.

    Due to the specific nature of the project, the form size is 37200 twips wide x 52620 twips high (2480 x 3508 pixels, equivalent to an A4 size sheet at 300dpi), so I can't simply screen capture it.

    Is there some way I can convert the entire form to a .bmp file, remembering it is about 3 times the size of my screen's display resolution? My entire project is stuck until I can get this image back... any help please..?

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Sep 2010
    Location
    Melbourne, Australia
    Posts
    92

    Re: .frx/.frm to .bmp - urgent and stuck!

    Nevermind, answered my own question ... here's coding for anyone else who runs into this situation:

    Code:
    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    
    Private Const WM_PAINT = &HF
    Private Const WM_PRINT = &H317
    Private Const PRF_CLIENT = &H4&    ' Draw the window's client area
    Private Const PRF_CHILDREN = &H10& ' Draw all visible child
    Private Const PRF_OWNED = &H20&    ' Draw all owned windows
    
    Public Sub SavePictureBox(PicBox As PictureBox, FileName As String)
    Dim rv As Long
    Dim ar As Boolean
      
        With PicBox
            'Save ReDraw value
            ar = .AutoRedraw
      
            .AutoRedraw = True
        
            'Draw controls to picture box
            rv = SendMessage(.hWnd, WM_PAINT, .hDC, 0)
            rv = SendMessage(.hWnd, WM_PRINT, .hDC, _
                PRF_CHILDREN Or PRF_CLIENT Or PRF_OWNED)
        
            'save picture box
            SavePicture .Image, FileName
            
            .Cls
    
            'Restore ReDraw
            .AutoRedraw = ar
        End With
    End Sub
    
    Private Sub Form_Load()
        SavePictureBox Picture1, "C:\<folder>\Picture.bmp"     ' Export image
        Unload Me
        End
    End Sub

  3. #3
    gibra
    Guest

    Re: [RESOLVED] .frx/.frm to .bmp - urgent and stuck!

    Caution, FRX can contains many image formats
    - with no transparency (BMP and JPG)
    - with transaprency (GIF and ICO)
    - metafile (WMF, EMF)
    therefore save a image always as bitmap maybe not correct.

    Instead, you can extract images in their original format.
    See this useful utility from Brad Martinez (with source code):
    http://btmtz.mvps.org/gfxfromfrx/



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width