Belazir
asked on
DCOM, no domain, named IP address
I'm trying to set up a DCOM arrangement between two computers that have a TCP/IP link but have no domain server, so there is no "network neighbourhood". I have followed all the usual steps: DCOMcnfg on the server, Clireg32 on the client, with an IP address rather than a named machine as the /s parameter. It's not working though, which I expected, but I need to get some idea how to get around it. Now, I know DCOM can work over an internet, so there must be a way of getting it to function without having to add specified users to the share permissions of the drive where the server component sits.
Any ideas?
Any ideas?
Domain is not a problem, are they at the same WORKgroup?
ASKER
Yes - or at least, they both have the same workgroup specified in their network properties.
Then, should not be a problem.
Well, how are they connected? UTP?, if so, the cable is crossed?
Well, how are they connected? UTP?, if so, the cable is crossed?
ASKER
They are both connected to an ethernet switch, along with five or six other computers. There is no problem with the connections themselves, as I log into a Windows Terminal Server on the same network and use PC Anywhere with a fixed IP address to access the PCs, two of which are the server and client computers here.
I'd appreciate it if you could spell out the setup procedure, make sure I've got that much right, so I can rule out setup issues...
I'd appreciate it if you could spell out the setup procedure, make sure I've got that much right, so I can rule out setup issues...
I was thinking in a connection problem. Sorry, i couldn't helñp you further. :(
Good luck.
Good luck.
ASKER
Thanks anyway Richie
Points upped, I could do with an answer swiftly
Points upped, I could do with an answer swiftly
'this might work if im understanding wot you want to properly i designed it 2day.
'i got the code from another website then modified it abit
'i got it from vb.net i think
'you need 4 textboxes,1 command butten,1 label(you dont name them)
Private Const ERROR_ACCESS_DENIED As Long = 5
Private Const ERROR_BAD_NETPATH As Long = 53
Private Const ERROR_INVALID_PARAMETER As Long = 87
Private Const ERROR_NOT_SUPPORTED As Long = 50
Private Const ERROR_INVALID_NAME As Long = 123
Private Const NERR_BASE As Long = 2100
Private Const NERR_SUCCESS As Long = 0
Private Const NERR_NetworkError As Long = (NERR_BASE + 36)
Private Const NERR_NameNotFound As Long = (NERR_BASE + 173)
Private Const NERR_UseNotFound As Long = (NERR_BASE + 150)
Private Const MAX_COMPUTERNAME As Long = 15
Private Const VER_PLATFORM_WIN32s As Long = 0
Private Const VER_PLATFORM_WIN32_WINDOWS As Long = 1
Private Const VER_PLATFORM_WIN32_NT As Long = 2
Private Type OSVERSIONINFO
OSVSize As Long
dwVerMajor As Long
dwVerMinor As Long
dwBuildNumber As Long
PlatformID As Long
szCSDVersion As String * 128
End Type
'User-defined type for passing
'the data to the Send function
Private Type NetMessageData
sServerName As String
sSendTo As String
sSendFrom As String
sMessage As String
End Type
'NetMessageBufferSend parameters:
'servername: Unicode string specifying the name of the
' remote server on which the function is to
' execute. If this parameter is vbNullString,
' the local computer is used.
'
'msgname: Unicode string specifying the message alias to
' which the message buffer should be sent.
'
'fromname: Unicode string specifying who the message is from.
' This parameter is required to send interrupting messages
' from the computer name. If this parameter is NULL, the
' message is sent from the logged-on user.
'
'msgbuf: Unicode string containing the message to send.
'
'msgbuflen: value that contains the length, in bytes, of
' the message text pointed to by the msgbuf parameter.
Private Declare Function NetMessageBufferSend Lib "netapi32" _
(ByVal servername As String, _
ByVal msgname As String, _
ByVal fromname As String, _
ByVal msgbuf As String, _
ByRef msgbuflen As Long) As Long
Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long
Private Declare Function GetVersionEx Lib "kernel32" _
Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Private Sub Form_Load()
Dim tmp As String
'pre-load the text boxes with
'the local computer name for testing
tmp = Space$(MAX_COMPUTERNAME + 1)
Call GetComputerName(tmp, Len(tmp))
Text1.Text = TrimNull(tmp)
Text2.Text = "enter the ip address of the pc you are seding the message to"
Text3.Text = TrimNull(tmp)
Text3.Text = "enter the ip address of the pc you are sending the message from"
End Sub
Private Sub Command1_Click()
Dim msgData As NetMessageData
Dim sSuccess As String
With msgData
.sServerName = Text1.Text
.sSendTo = Text2.Text
.sSendFrom = Text3.Text
.sMessage = Text4.Text
End With
sSuccess = NetSendMessage(msgData)
Label1.Caption = sSuccess
End Sub
Private Function IsWinNT() As Boolean
'returns True if running WinNT/Win2000/WinXP
#If Win32 Then
Dim OSV As OSVERSIONINFO
OSV.OSVSize = Len(OSV)
If GetVersionEx(OSV) = 1 Then
'PlatformId contains a value representing the OS.
IsWinNT = (OSV.PlatformID = VER_PLATFORM_WIN32_NT)
End If
#End If
End Function
Private Function NetSendMessage(msgData As NetMessageData) As String
Dim success As Long
'assure that the OS is NT ..
'NetMessageBufferSend can not
'be called on Win9x
If IsWinNT() Then
With msgData
'if To name omitted return error and exit
If .sSendTo = "" Then
NetSendMessage = GetNetSendMessageStatus(ER ROR_INVALI D_PARAMETE R)
Exit Function
Else
'if there is a message
If Len(.sMessage) Then
'convert the strings to unicode
.sSendTo = StrConv(.sSendTo, vbUnicode)
.sMessage = StrConv(.sMessage, vbUnicode)
'Note that the API could be called passing
'vbNullString as the SendFrom and sServerName
'strings. This would generate the message on
'the sending machine.
If Len(.sServerName) > 0 Then
.sServerName = StrConv(.sServerName, vbUnicode)
Else: .sServerName = vbNullString
End If
If Len(.sSendFrom) > 0 Then
.sSendFrom = StrConv(.sSendFrom, vbUnicode)
Else: .sSendFrom = vbNullString
End If
'change the cursor and show. Control won't return
'until the call has completed.
Screen.MousePointer = vbHourglass
success = NetMessageBufferSend(.sSer verName, _
.sSendTo, _
.sSendFrom, _
.sMessage, _
ByVal Len(.sMessage))
Screen.MousePointer = vbNormal
NetSendMessage = GetNetSendMessageStatus(su ccess)
End If 'If Len(.sMessage)
End If 'If .sSendTo
End With 'With msgData
End If 'If IsWinNT
End Function
Private Function GetNetSendMessageStatus(nE rror As Long) As String
Dim msg As String
Select Case nError
Case NERR_SUCCESS: msg = "The message was successfully sent"
Case NERR_NameNotFound: msg = "Send To not found"
Case NERR_NetworkError: msg = "General network error occurred"
Case NERR_UseNotFound: msg = "Network connection not found"
Case ERROR_ACCESS_DENIED: msg = "Access to computer denied"
Case ERROR_BAD_NETPATH: msg = "Sent From server name not found."
Case ERROR_INVALID_PARAMETER: msg = "Invalid parameter(s) specified."
Case ERROR_NOT_SUPPORTED: msg = "Network request not supported."
Case ERROR_INVALID_NAME: msg = "Illegal character or malformed name."
Case Else: msg = "Unknown error executing command."
End Select
GetNetSendMessageStatus = msg
End Function
Private Function TrimNull(item As String)
'return string before the terminating null
Dim pos As Integer
pos = InStr(item, Chr$(0))
If pos Then
TrimNull = Left$(item, pos - 1)
Else: TrimNull = item
End If
End Function
'Hope this helps Jy
'i got the code from another website then modified it abit
'i got it from vb.net i think
'you need 4 textboxes,1 command butten,1 label(you dont name them)
Private Const ERROR_ACCESS_DENIED As Long = 5
Private Const ERROR_BAD_NETPATH As Long = 53
Private Const ERROR_INVALID_PARAMETER As Long = 87
Private Const ERROR_NOT_SUPPORTED As Long = 50
Private Const ERROR_INVALID_NAME As Long = 123
Private Const NERR_BASE As Long = 2100
Private Const NERR_SUCCESS As Long = 0
Private Const NERR_NetworkError As Long = (NERR_BASE + 36)
Private Const NERR_NameNotFound As Long = (NERR_BASE + 173)
Private Const NERR_UseNotFound As Long = (NERR_BASE + 150)
Private Const MAX_COMPUTERNAME As Long = 15
Private Const VER_PLATFORM_WIN32s As Long = 0
Private Const VER_PLATFORM_WIN32_WINDOWS
Private Const VER_PLATFORM_WIN32_NT As Long = 2
Private Type OSVERSIONINFO
OSVSize As Long
dwVerMajor As Long
dwVerMinor As Long
dwBuildNumber As Long
PlatformID As Long
szCSDVersion As String * 128
End Type
'User-defined type for passing
'the data to the Send function
Private Type NetMessageData
sServerName As String
sSendTo As String
sSendFrom As String
sMessage As String
End Type
'NetMessageBufferSend parameters:
'servername: Unicode string specifying the name of the
' remote server on which the function is to
' execute. If this parameter is vbNullString,
' the local computer is used.
'
'msgname: Unicode string specifying the message alias to
' which the message buffer should be sent.
'
'fromname: Unicode string specifying who the message is from.
' This parameter is required to send interrupting messages
' from the computer name. If this parameter is NULL, the
' message is sent from the logged-on user.
'
'msgbuf: Unicode string containing the message to send.
'
'msgbuflen: value that contains the length, in bytes, of
' the message text pointed to by the msgbuf parameter.
Private Declare Function NetMessageBufferSend Lib "netapi32" _
(ByVal servername As String, _
ByVal msgname As String, _
ByVal fromname As String, _
ByVal msgbuf As String, _
ByRef msgbuflen As Long) As Long
Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" _
(ByVal lpBuffer As String, _
nSize As Long) As Long
Private Declare Function GetVersionEx Lib "kernel32" _
Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Private Sub Form_Load()
Dim tmp As String
'pre-load the text boxes with
'the local computer name for testing
tmp = Space$(MAX_COMPUTERNAME + 1)
Call GetComputerName(tmp, Len(tmp))
Text1.Text = TrimNull(tmp)
Text2.Text = "enter the ip address of the pc you are seding the message to"
Text3.Text = TrimNull(tmp)
Text3.Text = "enter the ip address of the pc you are sending the message from"
End Sub
Private Sub Command1_Click()
Dim msgData As NetMessageData
Dim sSuccess As String
With msgData
.sServerName = Text1.Text
.sSendTo = Text2.Text
.sSendFrom = Text3.Text
.sMessage = Text4.Text
End With
sSuccess = NetSendMessage(msgData)
Label1.Caption = sSuccess
End Sub
Private Function IsWinNT() As Boolean
'returns True if running WinNT/Win2000/WinXP
#If Win32 Then
Dim OSV As OSVERSIONINFO
OSV.OSVSize = Len(OSV)
If GetVersionEx(OSV) = 1 Then
'PlatformId contains a value representing the OS.
IsWinNT = (OSV.PlatformID = VER_PLATFORM_WIN32_NT)
End If
#End If
End Function
Private Function NetSendMessage(msgData As NetMessageData) As String
Dim success As Long
'assure that the OS is NT ..
'NetMessageBufferSend can not
'be called on Win9x
If IsWinNT() Then
With msgData
'if To name omitted return error and exit
If .sSendTo = "" Then
NetSendMessage = GetNetSendMessageStatus(ER
Exit Function
Else
'if there is a message
If Len(.sMessage) Then
'convert the strings to unicode
.sSendTo = StrConv(.sSendTo, vbUnicode)
.sMessage = StrConv(.sMessage, vbUnicode)
'Note that the API could be called passing
'vbNullString as the SendFrom and sServerName
'strings. This would generate the message on
'the sending machine.
If Len(.sServerName) > 0 Then
.sServerName = StrConv(.sServerName, vbUnicode)
Else: .sServerName = vbNullString
End If
If Len(.sSendFrom) > 0 Then
.sSendFrom = StrConv(.sSendFrom, vbUnicode)
Else: .sSendFrom = vbNullString
End If
'change the cursor and show. Control won't return
'until the call has completed.
Screen.MousePointer = vbHourglass
success = NetMessageBufferSend(.sSer
.sSendTo, _
.sSendFrom, _
.sMessage, _
ByVal Len(.sMessage))
Screen.MousePointer = vbNormal
NetSendMessage = GetNetSendMessageStatus(su
End If 'If Len(.sMessage)
End If 'If .sSendTo
End With 'With msgData
End If 'If IsWinNT
End Function
Private Function GetNetSendMessageStatus(nE
Dim msg As String
Select Case nError
Case NERR_SUCCESS: msg = "The message was successfully sent"
Case NERR_NameNotFound: msg = "Send To not found"
Case NERR_NetworkError: msg = "General network error occurred"
Case NERR_UseNotFound: msg = "Network connection not found"
Case ERROR_ACCESS_DENIED: msg = "Access to computer denied"
Case ERROR_BAD_NETPATH: msg = "Sent From server name not found."
Case ERROR_INVALID_PARAMETER: msg = "Invalid parameter(s) specified."
Case ERROR_NOT_SUPPORTED: msg = "Network request not supported."
Case ERROR_INVALID_NAME: msg = "Illegal character or malformed name."
Case Else: msg = "Unknown error executing command."
End Select
GetNetSendMessageStatus = msg
End Function
Private Function TrimNull(item As String)
'return string before the terminating null
Dim pos As Integer
pos = InStr(item, Chr$(0))
If pos Then
TrimNull = Left$(item, pos - 1)
Else: TrimNull = item
End If
End Function
'Hope this helps Jy
ASKER
Jy, this'll obviously take me a while to interpret - I'll sift through it shortly and let you know whether it's what I'm looking for...
B
B
ASKER
Jy, my machine is Win98 at the moment, I will need to test this on a later machine. In the mean time though, can you give me a synposis of exactly what this code does? I can see it sends a message of some form to a machine with a given IP address, but does it not need permissions to be specified on the destination machine - and does it just send a message? I need to be able to call an activex EXE on the remote machine, like in DCOM - how does this help?
Cheers
B
Cheers
B
mines winxp, ive tested this only a few times, it works only works some times though (i think if yours and/or the other pc u are sending it to) has a firewall it doesn't work. im not sure why. err. there has been other programs like this.
eg. if u go to ween.co.uk and go to the bit where it says"If you are looking for our freeware programs they are here"
then go to the prgrams bit, there is a program called ip messenger plus. this program above is very similar.
at the moment yes it does just only send a message, but the program from Ween, is a bit closer to calling an exe.
ill do some research for you an dfind out if i can modify it. and ill post my finding asap
jy
eg. if u go to ween.co.uk and go to the bit where it says"If you are looking for our freeware programs they are here"
then go to the prgrams bit, there is a program called ip messenger plus. this program above is very similar.
at the moment yes it does just only send a message, but the program from Ween, is a bit closer to calling an exe.
ill do some research for you an dfind out if i can modify it. and ill post my finding asap
jy
A request for deletion or PAQ has been made. If no response or you feel this is in error, comment. If no objection, I or another Moderator will handle this question in three days.
Computer101
E-E Admin
Computer101
E-E Admin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.