Home All Groups Group Topic Archive Search About
Author
4 Mar 2009 10:33 PM
Lorin
VB6
I have six command buttons that have nice pictures on them.
Unfortunately the source of the pictures was lost in a crash right after I
put them in so I had no time to back up the pictures.
So ...
Can someone help with some code to extract the picture from the command
button and generate a file?  Not even sure how to start.

Author
4 Mar 2009 10:50 PM
Steve Easton
"Lorin" <Lo***@discussions.microsoft.com> wrote in message
news:3363A5D6-586E-47F6-A68D-DAA91745787E@microsoft.com...
> VB6
> I have six command buttons that have nice pictures on them.
> Unfortunately the source of the pictures was lost in a crash right after I
> put them in so I had no time to back up the pictures.
> So ...
> Can someone help with some code to extract the picture from the command
> button and generate a file?  Not even sure how to start.
>
Assuming you had compiled the application, download a copy
of Resource Hacker and open the file in it and you can extract the images.
http://angusj.com/resourcehacker/


--

Steve Easton
Author
4 Mar 2009 10:55 PM
Bob Butler
Show quote Hide quote
"Steve Easton" <ad***@95isalive.com> wrote in message
news:%235rgsuRnJHA.3876@TK2MSFTNGP02.phx.gbl...
>
> "Lorin" <Lo***@discussions.microsoft.com> wrote in message
> news:3363A5D6-586E-47F6-A68D-DAA91745787E@microsoft.com...
>> VB6
>> I have six command buttons that have nice pictures on them.
>> Unfortunately the source of the pictures was lost in a crash right after
>> I
>> put them in so I had no time to back up the pictures.
>> So ...
>> Can someone help with some code to extract the picture from the command
>> button and generate a file?  Not even sure how to start.
>>
> Assuming you had compiled the application, download a copy
> of Resource Hacker and open the file in it and you can extract the images.
> http://angusj.com/resourcehacker/

or a combination of PrtSrcn and MS Paint...
Author
4 Mar 2009 11:35 PM
Lorin
After struggling for a while I came up with this.
It works and can make adjustments but it seems that the expected initial
height and width is not equal.
Not sure why that is.

Maybe someone can use this too, so here it is.
Too bad we cannot post forms too.
============== live code ========================

Option Explicit

Private ctrl As CommandButton

Public lWidth As Long
Public lHeight As Long

Private sDragStartX As Single
Private sDragStartY As Single

Private Sub Form_Load()

' these are the controls I copied on to the form to extract
    Set ctrl = cmdPrevious(0)
   ' Set ctrl = cmdLoad(0)
   ' Set ctrl = cmdNext(0)
   ' Set ctrl = cmdPlay(0)
   ' Set ctrl = cmdPause(0)
   ' Set ctrl = cmdStop(0)

    Me.Caption = "Working with " & ctrl.Name

    lWidth = ctrl.Width
    imgBMP.Width = lWidth

    lHeight = ctrl.Height
    imgBMP.Height = lHeight

    imgBMP.Picture = ctrl.Picture

    Sizer

    lblSize(0).Caption = imgBMP.Height
    lblSize(1).Caption = imgBMP.Width

End Sub 'Form_Load

Private Sub cmdSave_Click()

    On Error GoTo SaveErr

    SavePicture imgBMP.Picture, "c:\Picture\" & ctrl.Name & "-x-" &
CStr(imgBMP.Width) & "-y-" & CStr(imgBMP.Height) & ".bmp"

SaveExit:
    Exit Sub

SaveErr:
    Debug.Assert False

    Debug.Print Err.Description
    Resume SaveExit

End Sub 'cmdSave_Click

Private Sub hscSize_Change()

    imgBMP.Width = lWidth + hscSize.Min - hscSize.Value
    imgBMP.Refresh
    lblSize(1).Caption = imgBMP.Width
    lblSize(1).Refresh
    Sizer

End Sub 'hscSize_Change

Private Sub lblSizer_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)

    sDragStartX = X
    sDragStartY = Y

End Sub 'lblSizer_MouseDown

Private Sub lblSizer_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
' used to visually compare a square to the current image proportions
    Select Case Button
    Case vbLeftButton
        If Me.WindowState = vbNormal Then
            'Drag the sizer only if the user holds down the mouse button
            lblSizer.Left = lblSizer.Left - (sDragStartX - X)
            lblSizer.Top = lblSizer.Top - (sDragStartY - Y)
        End If

    Case vbRightButton

    Case Else    ' always here to make me think
    End Select

End Sub 'lblSizer_MouseMove

Private Sub vscSize_Change()

    imgBMP.Height = lHeight + vscSize.Value
    imgBMP.Refresh
    lblSize(0).Caption = imgBMP.Height
    lblSize(0).Refresh
    Sizer

End Sub 'vscSize_Change

Private Sub Sizer()

    lblSizer.Height = imgBMP.Width
    lblSizer.Width = imgBMP.Width

End Sub 'Sizer


Show quoteHide quote
"Lorin" wrote:

> VB6
> I have six command buttons that have nice pictures on them.
> Unfortunately the source of the pictures was lost in a crash right after I
> put them in so I had no time to back up the pictures.
> So ...
> Can someone help with some code to extract the picture from the command
> button and generate a file?  Not even sure how to start.
>
>
Author
4 Mar 2009 11:35 PM
Karl E. Peterson
Lorin wrote:
> VB6
> I have six command buttons that have nice pictures on them.
> Unfortunately the source of the pictures was lost in a crash right after I
> put them in so I had no time to back up the pictures.
> So ...
> Can someone help with some code to extract the picture from the command
> button and generate a file?  Not even sure how to start.

Use Brad Martinez' GfxFromFrx tool: http://btmtz.mvps.org/gfxfromfrx/

(You still have the FRX file, right?)
--
..NET: It's About Trust!
http://vfred.mvps.org
Author
4 Mar 2009 11:58 PM
Lorin
Thanks for all these great tools.

Show quoteHide quote
"Karl E. Peterson" wrote:

> Lorin wrote:
> > VB6
> > I have six command buttons that have nice pictures on them.
> > Unfortunately the source of the pictures was lost in a crash right after I
> > put them in so I had no time to back up the pictures.
> > So ...
> > Can someone help with some code to extract the picture from the command
> > button and generate a file?  Not even sure how to start.
>
> Use Brad Martinez' GfxFromFrx tool: http://btmtz.mvps.org/gfxfromfrx/
>
> (You still have the FRX file, right?)
> --
> ..NET: It's About Trust!
http://vfred.mvps.org
>
>
>