|
-
Mar 10th, 2002, 04:59 AM
#1
Thread Starter
Frenzied Member
sending a picture trough WINSOCK
ok i want a program to send a screenshot of the desktop to a other computer within my network, i can astablish the connection get the screenshot and can send it.. but at arival it fails to work
i used this to send the picture :
VB Code:
Private Sub Command2_Click()
Winsock1.SendData Picture1.Picture
End Sub
and to recieve it i use:
VB Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strBuff As String
Winsock1.GetData strBuff, vbString
Picture1.Picture = strBuff
End Sub
but i gives this error : Compile error: Type mismatch
-
Mar 10th, 2002, 08:24 PM
#2
Hyperactive Member
Just A Thought
Try Changing the String That Holds The Data To A Variant.
I Can't Think Of Any Other Type that would work!
-
Mar 10th, 2002, 08:45 PM
#3
You cannot just use Winsock1.SendData Picture1.Picture.
Winsock sends out data as strings. The type returned by Picture1.Picture is a stdPicture object.
To send a picture, the easiest way is to actually send the file which the picture came from. If you don't have the picture file, you'll have to create a byte array from the picture and then paint the byte array straight back onto the other end's picturebox.
Plenty examples of both methods have been posted on the forums.
-
Mar 11th, 2002, 02:44 AM
#4
Thread Starter
Frenzied Member
errr ok the As variant thing didn't work...
and i cant find a forum topic where they really change the picture into A byte array can you tell me how it is done?
-
Mar 11th, 2002, 02:48 AM
#5
eh, isnt it easier just to save the picture first and they start sending it as a file?!!!
-
Mar 11th, 2002, 02:52 AM
#6
Thread Starter
Frenzied Member
nope i need to grab the screen of one computer and send it as fast as possible to another computer , saving would only take more time because it must have at least a refresh rate of .5 seconds or something..
on a 700 + mhz computer this might not be a problem
but on a 200 mhz computer saving would take up to much memory and time
-
Mar 11th, 2002, 03:24 AM
#7
When using:
Winsock1.SendData Picture1.Picture
you would only send the default property of the picture object, which is its handle. This handle will not be valid on another computer.
You would need to extract the actual data from the picture. Search the forum for the GetDIBits API function. I am sure you will find some code you could use.
An alternative to writing your own code, is to use a freeware program like winvnc
-
Mar 11th, 2002, 03:25 AM
#8
oh well, how about getting the color of each pixel and sending it one by one (that would probably be slower )
-
Oct 4th, 2002, 06:13 AM
#9
Addicted Member
hey sunnyl u wrote tht picture can be converted in to byte array , i want to convert a picture from picture box to byte array .. to send to other PC how i can convert it ???
-
Oct 4th, 2002, 06:32 AM
#10
Fanatic Member
UltimaSnake:
nope i need to grab the screen of one computer and send it as fast as possible to another computer , saving would only take more time because it must have at least a refresh rate of .5 seconds or something..
on a 700 + mhz computer this might not be a problem
but on a 200 mhz computer saving would take up to much memory and time
Use Video hook dont think dat's possible in VB, though
ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
Programming is fun, but only if you're not on a tight deadline 
So I consider all those working engineers sad people
VB FTP class
3 page PHP crash course
Crash Course on DX9 Managed with VB.NET covering basics till terrain creation
-
Oct 4th, 2002, 07:47 AM
#11
Lively Member
Hi,
hey sunnyl u wrote tht picture can be converted in to byte array , i want to convert a picture from picture box to byte array .. to send to other PC how i can convert it ???
I'm very interested in this, but I couldn't find any examples how to do this.
To send a picture, the easiest way is to actually send the file which the picture came from. If you don't have the picture file, you'll have to create a byte array from the picture and then paint the byte array straight back onto the other end's picturebox.
Plenty examples of both methods have been posted on the forums.
Does anyone know where I can find an example of this method?
Thanks for reading,
Fedor
-
Oct 5th, 2002, 01:44 AM
#12
Fanatic Member
I thought this might be better:
Record a series of pictures, say, for about a second.
Put them altogether in a file.
Send it to another remote pc.
The remote pc reads the file and display the series of pictures
continuously while grabbing another file.
How's that?
ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
Programming is fun, but only if you're not on a tight deadline 
So I consider all those working engineers sad people
VB FTP class
3 page PHP crash course
Crash Course on DX9 Managed with VB.NET covering basics till terrain creation
-
Oct 5th, 2002, 03:46 AM
#13
Frenzied Member
"Brothers, you asked for it."
...Francisco Domingo Carlos Andres Sebastian D'Anconia
-
Feb 6th, 2010, 05:09 AM
#14
New Member
Re: sending a picture trough WINSOCK
Hey , you have to split the file to chunks of ( i think - " 1024 " ) byte in order to send !
-
Feb 6th, 2010, 05:28 AM
#15
Re: sending a picture trough WINSOCK
This is 8 year old thread... I think there is no need of replying to this thread anymore...
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Feb 6th, 2010, 05:43 AM
#16
New Member
Re: sending a picture trough WINSOCK
oooh ,,,out of date ,, why not clean up old stuff ??
-
Feb 6th, 2010, 05:49 AM
#17
Re: sending a picture trough WINSOCK
there will be no cleaning of old stuffs... because, others can search the forum for previously asked questions.... and, if it is cleared, then no use....
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|