Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


DCOM, no domain, named IP address

Posted on 2003-02-20
Medium Priority
Last Modified: 2008-02-01
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?
Question by:Belazir
  • 5
  • 3
  • 2
  • +2
LVL 16

Expert Comment

ID: 7988111
Domain is not a problem, are they at the same WORKgroup?

Author Comment

ID: 7989183
Yes - or at least, they both have the same workgroup specified in their network properties.
LVL 16

Expert Comment

ID: 8001881
Then, should not be a problem.
Well, how are they connected? UTP?, if so, the cable is crossed?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 8007293
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...
LVL 16

Expert Comment

ID: 8008105
I was thinking in a connection problem. Sorry, i couldn't helñp you further. :(
Good luck.

Author Comment

ID: 8016749
Thanks anyway Richie

Points upped, I could do with an answer swiftly

Expert Comment

ID: 8257381
'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

  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
      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(ERROR_INVALID_PARAMETER)
            Exit Function
           '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(.sServerName, _
                                              .sSendTo, _
                                              .sSendFrom, _
                                              .sMessage, _
                                              ByVal Len(.sMessage))
               Screen.MousePointer = vbNormal
               NetSendMessage = GetNetSendMessageStatus(success)
            End If 'If Len(.sMessage)
         End If  'If .sSendTo
      End With  'With msgData
   End If  'If IsWinNT
End Function

Private Function GetNetSendMessageStatus(nError 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

Author Comment

ID: 8259603
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...


Author Comment

ID: 8293019
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?


Expert Comment

ID: 8324244
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

Expert Comment

ID: 8580338
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.

E-E Admin

Accepted Solution

Chmod earned 0 total points
ID: 8623759
PAQ'd & points refunded

Community Support Moderator @Experts Exchange

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question