Save BitBlt image

Can someone tell me how to save an image from a picture box that i have loaded into it using bitblt,i then need to UDP the data to another application which will then load up the pictuure,providing a screen shot of the clients computer,so i also need to know how so read and write files using the binary method as this never seems to work for me even though i have no problems with input and append.
LVL 13
crazymanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
Use:
Set Picture1.Picture = Picture1.Image
SavePicture Picture1.Picture, "c:\pic.bmp"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Erick37Commented:
You also have to set the AutoRedraw property of the picture box to True.
0
crazymanAuthor Commented:
That works great but how do i then break down the file and send it using UDP?
I can never seem to get the binary method to work.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Erick37Commented:
Please post a snippet of the code you are using to send and receive the file.
0
crazymanAuthor Commented:
This is what i was using but i seem to have solved the binary dillemma now so thanks for your help.



Private Sub CmdScreenShot_Click()
Dim wScreen As Long
Dim hScreen As Long
Dim w As Long
Dim h As Long
Dim a As Long
Dim intFile As Integer
Dim strFileLocation As String
Dim clpData As Clipboard
Dim bData() As Variant
    PicScreen.AutoRedraw = True
    strFileLocation = app.path & "\Pic.bmp"
    PicScreen.Cls
    wScreen = Screen.Width \ Screen.TwipsPerPixelX
    hScreen = Screen.Height \ Screen.TwipsPerPixelY
    Picture1.ScaleMode = vbPixels
    w = Picture1.ScaleWidth
    h = Picture1.ScaleHeight
    hdcScreen = GetDC(0)
     StretchBlt PicScreen.hdc, 0, 0, w, h, hdcScreen, 0, 0, wScreen, hScreen, vbSrcCopy
    PicScreen.Picture = PicScreen.Image
    SavePicture PicScreen.Picture, strFileLocation
    PicScreen.AutoRedraw = False
    intFile = FreeFile
    ReDim bData(1 To 2)
    Open strFileLocation For Binary Access Read As #intFile
        Do While Not EOF(intFile)
            ReDim Preserve bData(LBound(bData) To UBound(bData) + 1)
            bData(UBound(bData)) = InputB(LOF(ntFile), intFile)
            DoEvents
            Debug.Print bData(UBound(bData))
        Loop
    Close #intFile
End Sub
0
Erick37Commented:
Great!
Glad to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.