Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InkPicture (export byte array to GIF) 1

Status
Not open for further replies.

snyperx3

Programmer
May 31, 2005
467
US
This post is related to but since it was starred and such, i figured it wouldnt get as much attention.

To expand on the previous topic. If anyone has used this i have another question.

I have placed an InkPicture control on my form. I creatively named it inkPicture. When you save an InkPicture you can only save it as an array of bytes, but you can specify what type of file can be made with the bytes. (confusing?...yes)

My code right now:
Code:
Private Sub cmdAccept_Click()
    Dim theSavedInk() As Byte
    theSavedInk = inkPicture.Ink.Save(2)
    
    Dim FileHandle As Integer
    FileHandle = FreeFile
    Open "c:\omg.gif" For Output As #FileHandle
    Write #FileHandle, theSavedInk
    Close #FileHandle
End Sub
Now this does everything its supposed to be. The only problem is, the file that it created will not open with any image applications. Paint, IE, Microsoft Image Preview...so on. Paint generates the error "Paint cannot read this file". IE generates a broken image icon.

Am i writing it to the file wrong? Any ideas on how to export a byte array to a gif image?

-Pete
 
You may try this:
Open "c:\omg.gif" For Binary As #FileHandle
Put #FileHandle, , theSavedInk

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for your reply PHV, but with that line I'm getting the error "Bad File Mode.". When I press debug it highlights the "Put" line.

-Pete
 
I'm so sorry. I didn't notice your first line to open for binary instead of for output. Thanks so much for your help. It worked perfectly.

-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top