Results 1 to 13 of 13

Thread: Sending image over winsocket without saving file.. (sending directly)

  1. #1

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172

    Sending image over winsocket without saving file.. (sending directly)

    I am trying to send images of the desktop to a remote computer for a while now... i managed to do it with bmp format but that is just to big.. i tried jpg but still isnt really fast.. is there anyway to send a part of the image without even saving the image?

    i tried sending through a long value but can't seem to set the other picture to the long i recieved :S




    btw i tried searching the board with no codes nor results answering my question :S
    Last edited by Ultimasnake; Apr 27th, 2003 at 01:51 PM.
    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I'm not sure I fully understand but do you want to just send a part of an image? Something like "I have an image that is 400x200 pixels but I only want to send one part of it that is 30x20 pixels"???

  3. #3

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172
    well not really (i want to do this later on but whatever) but i just want to send a picturebox.picture over the network.. and show it in another picture box without saving the picture on either sides....
    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

  4. #4
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    so do you mean you want to have some kind of blackboard application?
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  5. #5

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172
    I am not telling what kind of app i want.. i just want to know how to send a image to a client app without having to save the darn file and then reading everything and sending it in parts.. just want to send it directly through the winsocket :S jeez :S
    Last edited by Ultimasnake; Apr 27th, 2003 at 02:13 PM.
    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    One very simple and quick way to convert an image to a byte array is to use a PropertyBag. However that creates a little overhead:
    VB Code:
    1. Dim pb As PropertyBag
    2. Dim bArr() As Byte
    3.  
    4. Set pb = New PropertyBag
    5. pb.WriteProperty  "Image", Picture1.Picture, Nothing
    6. bArr = pb.Contents
    Another way would be to create a DIB (Device Independent Bitmap) since that will store the image directly in memory and return the address. There's an example on how to create a DIB and get it to a byte array available here:
    http://www.vbaccelerator.com/codelib/gfx/dibsect.htm

    Cheers.

  7. #7
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    You can try my control: SmartSocket, don't ask me how it works, just scroll down the page and read the descriptions for the events and functions to figure it out.

    But if you wanna do it yourself, do a search on "bitmap to byte array" or something like that... then send the byte array, then on the receiving side, you will have to do the opposite, ie: byte array to bitmap

  8. #8

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172
    i cant seem to find anything (that works) about converting the byte array back to the bitmap.. any help would be great thanks
    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    If you use my PropBag example above it's very simple:
    VB Code:
    1. 'assumes the bytes are stored in a byte array named bArr()
    2. Set pb = New PropertyBag
    3. pb.Contents = bArr
    4. Picture1.Picture = pb.ReadProperty("Image", Nothing)
    Of corse to save a few bytes you don't have to store the property as "Image"... you could use a shorter name

  10. #10
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196
    I can't get to your website. Has the URL changed? I'd love to try out your smartsocket.

    Brandon

    Originally posted by CVMichael
    You can try my control: SmartSocket, don't ask me how it works, just scroll down the page and read the descriptions for the events and functions to figure it out.

    But if you wanna do it yourself, do a search on "bitmap to byte array" or something like that... then send the byte array, then on the receiving side, you will have to do the opposite, ie: byte array to bitmap
    Brandon S Davids

  11. #11
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    I'm having problem with my computer, it stops responding and then shuts off by itself. I have my website on my own computer, so untill I fix my computer, the web-site will be off too. Right now i'm writing from my laptop, but on it I don't have enough room to install all the neccessary stuff to run the web-site.

  12. #12
    Addicted Member
    Join Date
    Dec 2002
    Posts
    196
    Sounds like the MSBlaster worm to me.

    How large is the .OCX?

    Perhaps you can email it to me?

    -Brandon-
    Brandon S Davids

  13. #13
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    PM me with your e-mail, and I'll send it to you when I have time... the file is ~ 180KBytes

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