Good day,

I am currently facing a problem with my VB6 program. I would like to send a form activated from the program of one pc to another pc linked together which doesn't have the same program. How can I do that?

I only need to send the form to the pc. It's alright if it's a printscreen of the form. Can somebody provide me a simple program code that enables me to do so? Thanks in advance!


To capture the image of the form, try this, Create two forms.. Form1 and Form2. Place a commandbutton in form1 and picturebox control in form2.

Code for Form1

Option Explicit

Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" _
(ByVal wCode As Long, ByVal wMapType As Long) As Long

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const VK_MENU = &H12
Private Const VK_SNAPSHOT = &H2C
Private Const KEYEVENTF_KEYUP = &H2

Private Sub Command1_Click()
    #Const WINDOWS_VERSION = "Windows2000"

    Dim alt_key As Long, frm As New Form2

    '~~> Capture image of form in clipboard.
    alt_key = MapVirtualKey(VK_MENU, 0)
    keybd_event VK_MENU, alt_key, 0, 0

    #If WINDOWS_VERSION = "Windows2000" Then
        keybd_event VK_SNAPSHOT, 0, 0, 0
        keybd_event VK_SNAPSHOT, 1, 0, 0
    #End If

    keybd_event VK_MENU, alt_key, KEYEVENTF_KEYUP, 0

    frm.Picture1.Picture = Clipboard.GetData(vbCFBitmap)
End Sub

Code for Form2

Option Explicit

Private Sub Form_Resize()
    Picture1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub

After this, if you want you can export the image from picture1 to harddisk and send it to the next pc....

Hope this helps...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.