Thread: Vb Problems!!! Help!

  1. #1
    Registered User CumQuaT's Avatar
    Join Date
    Sep 2001
    Posts
    73

    Unhappy Vb Problems!!! Help!

    I'm trying to write a set of programs - that is, a client and a server version of the same program - that works kinda like this:

    It is, in essence, the opposite of the VnC program if you've ever used it. (Please tell me it's possible in VB!!!)
    The client version just runs at startup and is unseen by the user, while the server version is always visible. Now, the clients of the program can't see or do anything with their program but the server can. Now when the server clicks the "ON" button, i guess you could call it, all of the client's programs will suddenly become maximized with a borderstyle of 0, filling the entire screen including the start menu. After this has happened, the server computer's program becomes invisible and keeps sending a screenshot of whatever is displayed on their screen (kinda like a print screen function or something) to all of the client programs. That screenshot is then placed on the client user's screens and stretched to fit, etc. Now this would only happen every 1 second or something, so I'm guessing a Timer control or a DELAY command or something, but what I'm trying to get to work is the whole "capture the screen of the server and send it to the clients" thing. It's also nasty because I also need the mouse to be captured. To use keystrokes to capture the screen WITH the mouse you have to press the little WINDOWS button + PRINT SCREEN. I've tried using the SENDKEYS command and can't seem to get it to work.
    Why? The often unanswerable question. If it is unanswerable, why answer it?

    Join the Cult of Sheograth, it's the place to be!

    http://cultosheogorath.proboards16.com

    Lord, we know what we are, yet we know not what we may be... Who wrote that anyway? If you know, E-Mail me. [email protected]

    Joy to all the fishes...

    **infected by frenchfry164**

  2. #2
    Wen Resu
    Join Date
    May 2003
    Posts
    219
    try a vb board.

  3. #3
    Registered User CumQuaT's Avatar
    Join Date
    Sep 2001
    Posts
    73

    Angry reply

    This is a windows programming board. I'm not in the C++ section so you can't get much more VB than that.
    Why? The often unanswerable question. If it is unanswerable, why answer it?

    Join the Cult of Sheograth, it's the place to be!

    http://cultosheogorath.proboards16.com

    Lord, we know what we are, yet we know not what we may be... Who wrote that anyway? If you know, E-Mail me. [email protected]

    Joy to all the fishes...

    **infected by frenchfry164**

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: reply

    Originally posted by CumQuaT
    This is a windows programming board. I'm not in the C++ section so you can't get much more VB than that.
    Nope...this is a windows board on Cprogramming.com "Your resource for C and C++"

    As to the question, your asking a hell of a lot.....and I guess you could do it in VB (via winsock), but you would be better to do it in a leaner language like C++.

    Also, have you considered programs like PC anywhere?

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    If you really want help on this you will need to break down the application into several tasks. Then, the ones you can not get Google to help you with you can ask here.

    Example:
    1. How do I take a screen shot?
    2. How do I get the mouse postion?
    3. How do I get the mouse cursor?
    4. How do I draw the mouse cursor on the captured image?
    5. How do I compress the image?
    6. How do I send the image over the network to multiple clients?
    7. How do I display the image in fullscreen on the client?
    8. How do I do this every second?

    Code for most of these is readily available on the web so you should search before asking. As this forum is largely frequented by C/C++ coders you are unlikely to get VB source code, but you may get pointers to which apis to use.

    Good luck.

  6. #6
    Registered User CumQuaT's Avatar
    Join Date
    Sep 2001
    Posts
    73

    reply

    cheers, I've actually got most of it down pat without too much trouble.

    Just need to send the contents of an image control via winsock. Any ideas.

    (PS, I did all the rest of it in 24 hours. really easy :-P I'm only doing it because I need to make a customized applications that only projects the servers screen. Nothing else. Other programs give the server control of the client computers, etc. I don't want that.)

  7. #7
    Registered User MicroFiend's Avatar
    Join Date
    Nov 2002
    Posts
    80
    hey ive made the same app as this when i used to program in vb, its a very simple program, the way in vb for it to be done easiest is to

    1) use the send keys command to capture to clipboard
    2) use the Clipboard.GeTdata command and set a picture box's piucture to the return value
    3) save the picture using the savepicture command (save as jpg)
    4) just use a binary read transmit write method using the ms winsock control

    and thats it, nice and easy, but no way near as efficient a end result when compared with doing it in c++, if i ws u id learn it, btw if u need ne help in either vb or c just ask

    hope it helps

  8. #8
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Assuming the clients are on the same network you probably want to send the data via broadcast datagram rather than a TCP stream to avoid swamping the network.

    You will need to reassemble the packets at each client before displaying the picture.

    Example:

    Code:
    Type PacketHeader
         ImageID as Integer
         TotalFileSize as Long
         DataOffset as Long
    End Type
    
    Dim byImageBuffer() as byte
    
    Function ReceivePacket(byPacket)
    
    Dim PackHeader as PacketHeader
    
    ' Get Packet header from packet into PackHeader
    CopyMemory(PackHeader, byPacket, len(PackHeader))
    
    ' If first packet in image allocate buffer to correct size
    if (isFirstPacket)  ReDim byImageBuffer(PackHeader.TotalFileSize)
    
    'Copy data into buffer at correct position
    CopyMemory(VarPtr(byImageBuffer) + PackHeader.DataOffset, VarPtr(byPacket) + len(PackHeader), len(byPacket) - len(PackHeader))
    
    End Function

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading a file written by VB
    By nemaroller in forum C++ Programming
    Replies: 8
    Last Post: 07-12-2002, 11:17 PM
  2. Calling C++ DLL from Excel VB...!
    By Tony in forum Windows Programming
    Replies: 0
    Last Post: 06-26-2002, 08:07 AM
  3. VB Calling Convention?!
    By minime6696 in forum Windows Programming
    Replies: 6
    Last Post: 03-27-2002, 04:39 PM
  4. Help a vb Programmer with some directshow code?
    By CliffRichard in forum C++ Programming
    Replies: 4
    Last Post: 12-05-2001, 07:34 PM
  5. CE and VB... oh the horror..
    By ober in forum Windows Programming
    Replies: 2
    Last Post: 08-30-2001, 07:20 PM