Sign in to follow this  
Followers 0
DJ VenGenCe

ActiveX inside a GUI

5 posts in this topic

#1 ·  Posted (edited)

Width the help of Lod3n, I have finally got it to work!

Requires you to Download and Register VNCX.dll from this site:

VNCX

Start up a VNC Test Server (Tested with Real VNC) with no user authentication.

To do:

Authentication Prompts

Suggestions ?

#include <GUIConstants.au3>
;Example of Embedding VNCX Viewer into Auto It Script.
;Big thanks to lod3n for the Base Code.  I added Zoom.  And a Sleep of 2500 for the connection to work on my end.  Added some new events.
;Coding comments to come.


$VNCViewer1 = ObjCreate("VNCX.VNCViewer")
$zoom_value = "100"
Global $vncxScrollbarNone = 0;
Global $vncxScrollbarHorizontal = 1;
Global $vncxScrollbarVertical = 2;
Global $vncxScrollbarBoth = 3;
$vncxWarningHandshakeAuthCancelled = 0x2ff;
; Create Gui



$handle = GUICreate ( "Embedded VNCX Control Test", 810, 768, (@DesktopWidth) / (@DesktopWidth), (@DesktopHeight) / (@DesktopHeight), $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$size = WinGetClientSize("")

$GUIActiveX = GUICtrlCreateObj($VNCViewer1, 5, 20, 800,675);,  ($size[0] - 50))
$GUI_Input = GUICtrlCreateInput ( "", 10, 700, 100,  20)
$GUI_Button_Connect = GuiCtrlCreateButton   ("Connect", 120, 700, 100,  20)
$GUI_Checkbox_SendMouse =  GUICtrlCreateCheckbox ("SendMouse", 230, 700, 100,  30)
$GUI_Checkbox_SendKeys =  GUICtrlCreateCheckbox ("SendKeys", 330, 700, 100,  30)
$GUI_Button_Disconnect  = GuiCtrlCreateButton   ("Disonnect",  430, 700, 100,  20)
$zoom_Drop = GUICtrlCreateCombo ("10", 550,700, 100, 20); create first item
GUICtrlSetData(-1,"10|20|30|40|50|60|80|100|150|200","100"); add other item snd set a new default

GUISetState ()   ;Show GUI

While 1
    $msg = GUIGetMsg()
   
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Connect
            connect()
        case $msg = $GUI_Button_Disconnect
            disconnect()
        case $msg = $zoom_Drop
             zoom_onpropertychange()
        Case $msg = $GUI_EVENT_RESIZED
             zoom_onpropertychange()
            $arr = WinGetClientSize($handle);
            $arr[0] = $arr[0] - "100"
            $arr[1] = $arr[1] - "100"
            $result = GUICtrlSetPos($GUIActiveX, 5, 20, $arr[0], $arr[1])
    EndSelect

        

Wend
GUIDelete ()

Exit


func connect()
    $VNCViewer1.RelayKeys = guictrlread($GUI_Checkbox_SendKeys)
    $VNCViewer1.RelayMouse = guictrlread($GUI_Checkbox_SendMouse)
    $VNCViewer1.Alignment = 16
    $VNCViewer1.Stretch = true
    $VNCViewer1.Display = 0
    $VNCViewer1.Connect(guictrlread($GUI_Input), "","","")
    Start_Session()

EndFunc
Func Start_Session()
    SLEEP(2500)
    $VNCViewer1.Start;
    zoom_onpropertychange()
        
EndFunc
func disconnect()
    $VNCViewer1.Stop()
EndFunc
Func zoom_onpropertychange()
    $zoom = GUICtrlRead($zoom_Drop)
    $VNCViewer1.StretchX($zoom / 10, 10);
    $VNCViewer1.StretchY($zoom / 10, 10);
EndFunc
Edited by DJ VenGenCe

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well, without getting my feet wet, why not just uncomment your first $oIE.Navigate, and make it go to "http://www.veridicus.com/tummy/programming/vncx/examples/html/vncx_ie.htm"

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Okay, feet wet, but I don't have a VNC server to test this on:

;commented out by request of original poster. Please see his modified code in the first post.

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

Hello all! Sorry to bump this thread 6 years later ;) I am currently creating a bot for a video game and am using VNC to accomplish this. I was wondering if there is an option to update the whole screen and I would also like to do 256 colors for speed :) Anyone been messing with this and figured out howto utilize these options? I checked the DLL it has a refresh function but when I call it, it just closes connection and I have to reconnect.

Share this post


Link to post
Share on other sites

PWProphets,

Welcome to the AutoIt forum. :)

Obviously you did not bother to read the Forum Rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. ;)

You might also like to note that we take a very dim view of necro-posting because AutoIt has changed enormously over the years and it is very unlikely the problem and/or code are still relevant today. ;)

Make sure you read those rules before posting again. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0