Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
viusal basic 6.0 use RDPCOMAPILIBCtl com component, rdpviewer connect prompts syntax error
RDPCOMAPILibCtl.RDPViewer


VB
RDPViewer.Connect(Text1.Text,"administrator","1234")


What I have tried:

form1.frm
VERSION 5.00
Object = "{CC802D05-AE07-4C15-B496-DB9D22AA0A84}#1.0#0"; "rdpencom.dll"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   9450
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   17265
   LinkTopic       =   "Form1"
   ScaleHeight     =   9450
   ScaleWidth      =   17265
   StartUpPosition =   3  
   Begin VB.CommandButton Button_test 
      Caption         =   "Button_test"
      Height          =   795
      Left            =   14070
      TabIndex        =   2
      Top             =   150
      Width           =   1845
   End
   Begin VB.TextBox Text1 
      Height          =   8985
      Left            =   9720
      MultiLine       =   -1  'True
      TabIndex        =   1
      Text            =   "Form1.frx":0000
      Top             =   150
      Width           =   4095
   End
   Begin RDPCOMAPILibCtl.RDPViewer RDPViewer1 
      Height          =   9255
      Left            =   90
      OleObjectBlob   =   "Form1.frx":0006
      TabIndex        =   0
      Top             =   90
      Width           =   9465
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Button_test_Click()
    RDPViewer1.SmartSizing = True
    RDPViewer1.Connect(Text1.Text, "administrator", "1234")
    RDPViewer1.RequestControl (CTRL_LEVEL_MAX)

End Sub

Private Sub Form_Load()
    Dim r As New RDPSession
    Debug.Print Screen.Width / Screen.TwipsPerPixelX & "," & Screen.Height / Screen.TwipsPerPixelY
    r.Open
    Dim rdpinv As RDPSRAPIInvitation
    Set rdpinv = r.Invitations.CreateInvitation("baseAuth", "groupName", "1234", 64)
    Debug.Print rdpinv.ConnectionString
    'r.Close
    Text1.Text = rdpinv.ConnectionString
    'Text1.Text = Text1.Text + vbCrLf + rdpinv.ConnectionString
End Sub


ttt.vbp
Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\Windows\SysWOW64\stdole2.tlb#OLE Automation
Object={CC802D05-AE07-4C15-B496-DB9D22AA0A84}#1.0#0; rdpencom.dll
Startup="Form1"
Command32=""
Name="ttt"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="Microsoft"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
Posted
Updated 15-Feb-23 19:41pm
v3
Comments
CHill60 15-Feb-23 3:06am    
What is the error?
Dave Kreskowiak 15-Feb-23 7:42am    
Don't post single lines like that. Copy and paste the EXACT code throwing the error.

The line "RDPCOMAPILibCtl.RDPViewer" isn't correct VB6 code, but I have no idea if that's the actual code you're trying to use.
landv li 15-Feb-23 22:56pm    
Private Sub Command1_Click()
RDPViewer.SmartSizing = True
RDPViewer.Connect(Text1.Text, "administrator", "1234")
'RDPViewer.RequestControl (CTRL_LEVEL_MAX)

End Sub
Dave Kreskowiak 15-Feb-23 23:35pm    
Well, I have no way of testing this as I haven't used VB6 since 2001. It's been a dead language for the last 20 years.

The code you've posted looks OK, though I have never heard of a "language error", so you'll have to supply the EXACT error message and the line it shows up on.
landv li 16-Feb-23 1:13am    
Thank you very much for your answer.
vb6 is indeed outdated for a long time, it seems that it can only be written in vc++ or C#

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900