CDCOP
asked on
Winsock Problems
I have some code that feteches an IP address using winsock component from VB6. It runs fine on my comp. but when i try from another workstation (doesnt have VB6) it give me a "Class not registered. Looking for object with CLSID:...."
I have tried to copy the component ocx file from my sys32 to the other machine and then register it and it says it registers fine. But i still get the error message!
HELP!
I have tried to copy the component ocx file from my sys32 to the other machine and then register it and it says it registers fine. But i still get the error message!
HELP!
ASKER
Still no luck Mikal613
for winsock don't you need mswinsck.ocx registered?
the OCX must be registered with a development license in order to work properly, and most installers can't manage this.
But - add the Winsock control as a reference to your project, not a component. Then, call CreateObject to create an instance.
But - add the Winsock control as a reference to your project, not a component. Then, call CreateObject to create an instance.
You may also want to use the package deployment wizard to create an
installation for the other machine(s). This will ensure that ALL necessary
components get installed and registered on the other computer. Many
times the first install will cause you to reboot as it will update all necessary
components..then continue the install once reboot is completed.
installation for the other machine(s). This will ensure that ALL necessary
components get installed and registered on the other computer. Many
times the first install will cause you to reboot as it will update all necessary
components..then continue the install once reboot is completed.
ASKER
Ok I have it in as a reference but how do I call it?
ASKER
Here is the code in use:
txt_ip.Text = Winsock.LocalIP
txt_ip.Text = Winsock.LocalIP
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry Ignore last post
Private SckCommand as Winsock
Private Sub Initialize()
Set SckCommand = New Winsock
SckCommand = CreateObject("MSWinsock.Wi nsock")
End Sub
Private SckCommand as Winsock
Private Sub Initialize()
Set SckCommand = New Winsock
SckCommand = CreateObject("MSWinsock.Wi
End Sub
ASKER
Do i need to change my variable name?
txt_ip.Text = Winsock.LocalIP
to
txt_ip.Text = MSWinsock.Winsock.LocalIP
?
It still does not work
txt_ip.Text = Winsock.LocalIP
to
txt_ip.Text = MSWinsock.Winsock.LocalIP
?
It still does not work
Dim objSocket
Set objSocket = CreateObject("MSWinsock.Wi nsock")
MsgBox objSocket.localip
error message?
Set objSocket = CreateObject("MSWinsock.Wi
MsgBox objSocket.localip
error message?
Just a comment:
'=========Late binding! Error will occure due to license issue==========
Dim objSocket
Set objSocket = CreateObject("MSWinsock.Wi nsock")
MsgBox objSocket.localip
========================== ========== ========== =====
'============Early binding - no error===================== ===
Dim objSocket As New Winsock
'or, better
'Dim objSocket As Winsock
'Set objSocket = New Winsock
MsgBox objSocket.localip
========================== ========== ========== =====
'=========Late binding! Error will occure due to license issue==========
Dim objSocket
Set objSocket = CreateObject("MSWinsock.Wi
MsgBox objSocket.localip
==========================
'============Early binding - no error=====================
Dim objSocket As New Winsock
'or, better
'Dim objSocket As Winsock
'Set objSocket = New Winsock
MsgBox objSocket.localip
==========================
FYI, the Winsock component does NOT need a development license. According to the VB documentation, the only component distributed with VB that requires a license is the data-bound grid (at least I think so.. it's a data-bound something anyway).
What are you using to distribute your program? VB Package and Deploy Wizard? Inno Setup? InstallShield?
What are you using to distribute your program? VB Package and Deploy Wizard? Inno Setup? InstallShield?
ASKER
Mikal,
It does work now. Thanks, but I am still getting the error on other machines. Is it winsock that has the problems or something else?
Here is the code:
************************** ******
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6390
ClientLeft = 60
ClientTop = 345
ClientWidth = 3660
LinkTopic = "Form1"
ScaleHeight = 6390
ScaleWidth = 3660
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame2
Caption = "Problem"
Height = 1935
Left = 0
TabIndex = 6
Top = 1920
Width = 3615
Begin VB.TextBox txt_problem
DataField = "Problem"
DataSource = "data"
Height = 1575
Left = 120
TabIndex = 8
Top = 240
Width = 3375
End
Begin VB.Frame frame_exit
Height = 1935
Left = 0
TabIndex = 7
Top = 0
Width = 3615
End
End
Begin VB.CommandButton cmd_send
Caption = "Send Request"
Default = -1 'True
Height = 255
Left = 2400
TabIndex = 5
Top = 3960
Width = 1215
End
Begin VB.Data data
BOFAction = 1 'BOF
Caption = "Record"
Connect = "Access"
DatabaseName = "G:\reporting_97.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
EOFAction = 2 'Add New
Exclusive = 0 'False
Height = 345
Left = 120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "UserInfo"
Top = 4320
Width = 3420
End
Begin VB.TextBox txt_compname
Height = 285
Left = 120
TabIndex = 4
Text = "Computer Name"
Top = 4680
Width = 3375
End
Begin VB.TextBox txt_ip
DataField = "IP Address"
DataSource = "data"
Height = 285
Left = 120
TabIndex = 3
Text = "IP Address"
Top = 5040
Width = 3375
End
Begin VB.CommandButton cmd_begin
Caption = "Report Problem"
Height = 1575
Left = 0
TabIndex = 2
Top = 240
Width = 3615
End
Begin VB.TextBox txt_date
DataField = "Date"
DataSource = "data"
Height = 285
Left = 120
TabIndex = 1
Text = "Date"
Top = 5400
Width = 3375
End
Begin VB.TextBox txt_time
DataField = "Time"
DataSource = "data"
Height = 285
Left = 120
TabIndex = 0
Text = "Time"
Top = 5400
Width = 3375
End
Begin VB.Frame Frame1
Caption = "User Information"
Height = 1575
Left = 0
TabIndex = 9
Top = 240
Width = 3615
Begin VB.TextBox txt_name
DataField = "Name"
DataSource = "data"
Height = 285
Left = 1320
TabIndex = 11
Top = 360
Width = 2175
End
Begin VB.TextBox txt_location
DataField = "Location"
DataSource = "data"
Height = 285
Left = 1320
TabIndex = 10
Top = 720
Width = 2175
End
Begin VB.Label Label1
Caption = "Name:"
Height = 255
Left = 120
TabIndex = 13
Top = 360
Width = 495
End
Begin VB.Label Label2
Caption = "Location:"
Height = 255
Left = 120
TabIndex = 12
Top = 720
Width = 855
End
End
Begin VB.Label lbl_date
Caption = "Label4"
Height = 255
Left = 0
TabIndex = 18
Top = 3960
Width = 855
End
Begin VB.Label lbl_time
Caption = "Label4"
DataField = "Time"
DataSource = "data"
Height = 255
Left = 600
TabIndex = 17
Top = 3960
Width = 735
End
Begin VB.Label lbl_cname
Caption = "CName"
DataField = "Computer Name"
DataSource = "data"
Height = 255
Left = 2880
TabIndex = 16
Top = 5400
Width = 615
End
Begin VB.Label Label3
Caption = "Created by: X"
Height = 255
Left = 0
TabIndex = 15
Top = 3840
Width = 2055
End
Begin VB.Label Label4
Caption = "Ver. 1.1"
Height = 255
Left = 0
TabIndex = 14
Top = 4080
Width = 1815
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 Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As _
Long) As Long
Private Function ComputerName() As String
Dim sBuffer As String
Dim lAns As Long
sBuffer = Space$(255)
lAns = GetComputerName(sBuffer, 255)
If lAns <> 0 Then
'read from beginning of string to null-terminator
ComputerName = Left$(sBuffer, InStr(sBuffer, Chr(0)) - 1)
Else
Err.Raise Err.LastDllError, , _
"A system call returned an error code of " _
& Err.LastDllError
End If
End Function
Private Sub About_Click()
End Sub
Private Sub cmd_begin_Click()
data.Recordset.AddNew
cmd_begin.Visible = False
frame_exit.Visible = False
Dim objSocket
Set objSocket = CreateObject("MSWinsock.Wi nsock")
txt_ip.Text = objSocket.LocalIP
lbl_cname = txt_compname.Text
txt_date.Text = lbl_date
txt_time.Text = Time
Form1.Height = 4695
End Sub
Private Sub Command1_Click()
data.Recordset.AddNew
End Sub
Private Sub cmd_send_Click()
data.UpdateRecord
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub List1_Click()
End Sub
Private Sub File_Click()
End Sub
Private Sub Form_Load()
'Change to recordset
'Change to recordset
txt_compname.Text = ComputerName
lbl_date = Date
lbl_date.Visible = False
lbl_time = Time
lbl_time.Visible = False
End Sub
Private Sub Help_Click()
End Sub
Private Sub txt_compname_Change()
'txt_compname.Text = ComputerName
'txt_ipaddress.text =
End Sub
It does work now. Thanks, but I am still getting the error on other machines. Is it winsock that has the problems or something else?
Here is the code:
**************************
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6390
ClientLeft = 60
ClientTop = 345
ClientWidth = 3660
LinkTopic = "Form1"
ScaleHeight = 6390
ScaleWidth = 3660
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame2
Caption = "Problem"
Height = 1935
Left = 0
TabIndex = 6
Top = 1920
Width = 3615
Begin VB.TextBox txt_problem
DataField = "Problem"
DataSource = "data"
Height = 1575
Left = 120
TabIndex = 8
Top = 240
Width = 3375
End
Begin VB.Frame frame_exit
Height = 1935
Left = 0
TabIndex = 7
Top = 0
Width = 3615
End
End
Begin VB.CommandButton cmd_send
Caption = "Send Request"
Default = -1 'True
Height = 255
Left = 2400
TabIndex = 5
Top = 3960
Width = 1215
End
Begin VB.Data data
BOFAction = 1 'BOF
Caption = "Record"
Connect = "Access"
DatabaseName = "G:\reporting_97.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
EOFAction = 2 'Add New
Exclusive = 0 'False
Height = 345
Left = 120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "UserInfo"
Top = 4320
Width = 3420
End
Begin VB.TextBox txt_compname
Height = 285
Left = 120
TabIndex = 4
Text = "Computer Name"
Top = 4680
Width = 3375
End
Begin VB.TextBox txt_ip
DataField = "IP Address"
DataSource = "data"
Height = 285
Left = 120
TabIndex = 3
Text = "IP Address"
Top = 5040
Width = 3375
End
Begin VB.CommandButton cmd_begin
Caption = "Report Problem"
Height = 1575
Left = 0
TabIndex = 2
Top = 240
Width = 3615
End
Begin VB.TextBox txt_date
DataField = "Date"
DataSource = "data"
Height = 285
Left = 120
TabIndex = 1
Text = "Date"
Top = 5400
Width = 3375
End
Begin VB.TextBox txt_time
DataField = "Time"
DataSource = "data"
Height = 285
Left = 120
TabIndex = 0
Text = "Time"
Top = 5400
Width = 3375
End
Begin VB.Frame Frame1
Caption = "User Information"
Height = 1575
Left = 0
TabIndex = 9
Top = 240
Width = 3615
Begin VB.TextBox txt_name
DataField = "Name"
DataSource = "data"
Height = 285
Left = 1320
TabIndex = 11
Top = 360
Width = 2175
End
Begin VB.TextBox txt_location
DataField = "Location"
DataSource = "data"
Height = 285
Left = 1320
TabIndex = 10
Top = 720
Width = 2175
End
Begin VB.Label Label1
Caption = "Name:"
Height = 255
Left = 120
TabIndex = 13
Top = 360
Width = 495
End
Begin VB.Label Label2
Caption = "Location:"
Height = 255
Left = 120
TabIndex = 12
Top = 720
Width = 855
End
End
Begin VB.Label lbl_date
Caption = "Label4"
Height = 255
Left = 0
TabIndex = 18
Top = 3960
Width = 855
End
Begin VB.Label lbl_time
Caption = "Label4"
DataField = "Time"
DataSource = "data"
Height = 255
Left = 600
TabIndex = 17
Top = 3960
Width = 735
End
Begin VB.Label lbl_cname
Caption = "CName"
DataField = "Computer Name"
DataSource = "data"
Height = 255
Left = 2880
TabIndex = 16
Top = 5400
Width = 615
End
Begin VB.Label Label3
Caption = "Created by: X"
Height = 255
Left = 0
TabIndex = 15
Top = 3840
Width = 2055
End
Begin VB.Label Label4
Caption = "Ver. 1.1"
Height = 255
Left = 0
TabIndex = 14
Top = 4080
Width = 1815
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 Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As _
Long) As Long
Private Function ComputerName() As String
Dim sBuffer As String
Dim lAns As Long
sBuffer = Space$(255)
lAns = GetComputerName(sBuffer, 255)
If lAns <> 0 Then
'read from beginning of string to null-terminator
ComputerName = Left$(sBuffer, InStr(sBuffer, Chr(0)) - 1)
Else
Err.Raise Err.LastDllError, , _
"A system call returned an error code of " _
& Err.LastDllError
End If
End Function
Private Sub About_Click()
End Sub
Private Sub cmd_begin_Click()
data.Recordset.AddNew
cmd_begin.Visible = False
frame_exit.Visible = False
Dim objSocket
Set objSocket = CreateObject("MSWinsock.Wi
txt_ip.Text = objSocket.LocalIP
lbl_cname = txt_compname.Text
txt_date.Text = lbl_date
txt_time.Text = Time
Form1.Height = 4695
End Sub
Private Sub Command1_Click()
data.Recordset.AddNew
End Sub
Private Sub cmd_send_Click()
data.UpdateRecord
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub List1_Click()
End Sub
Private Sub File_Click()
End Sub
Private Sub Form_Load()
'Change to recordset
'Change to recordset
txt_compname.Text = ComputerName
lbl_date = Date
lbl_date.Visible = False
lbl_time = Time
lbl_time.Visible = False
End Sub
Private Sub Help_Click()
End Sub
Private Sub txt_compname_Change()
'txt_compname.Text = ComputerName
'txt_ipaddress.text =
End Sub
ASKER
I know its not very neat ;)
Did you test on the Other MAchines
IF they a) have mswinsck.ocx
b) that its registered
??
IF they a) have mswinsck.ocx
b) that its registered
??
ASKER
Yes that is what im having problems with is on other machines. Yes i did copy my mswinsck.ocx to theirs and registered it and still no go. Still gives me:
"Class not registered.
Looking for object with CLSID:{00000010-0000-0010- 8000-00AA0 06D2EA4}"
"Class not registered.
Looking for object with CLSID:{00000010-0000-0010-
That means those machines
Need to update MDAC
http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&DisplayLang=en
Need to update MDAC
http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&DisplayLang=en
What Database ar eyou Using?
ASKER
Is there anyway I can do a silent install?
ASKER
MS Access, it has been converted to 97 format
Is it possible that those machines dont have access to change the registry?
"This problem is related to not being able to update the Windows Registry with the database driver information due to a conflict"
"This problem is related to not being able to update the Windows Registry with the database driver information due to a conflict"
ASKER
No the users have admin access.
I installed the update and it still gave me the error :(
I installed the update and it still gave me the error :(
are you using dao?
ASKER
What is DAO?
how are you connecting to the Database?
Dao.Recordset
ado.Recordset??
Dao.Recordset
ado.Recordset??
ASKER
Hmm...i didnt put any code in, just used VB to link txt boxes to fields and source data etc.
http://members.w-link.net/~jsss/vb6.htm
click the vb link