?
Solved

DCOM, no domain, named IP address

Posted on 2003-02-20
12
Medium Priority
?
226 Views
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?
0
Comment
Question by:Belazir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
12 Comments
 
LVL 16

Expert Comment

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

Author Comment

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

Expert Comment

by:Richie_Simonetti
ID: 8001881
Then, should not be a problem.
Well, how are they connected? UTP?, if so, the cable is crossed?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Belazir
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...
0
 
LVL 16

Expert Comment

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

Author Comment

by:Belazir
ID: 8016749
Thanks anyway Richie

Points upped, I could do with an answer swiftly
0
 

Expert Comment

by:Jy
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

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(ERROR_INVALID_PARAMETER)
            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(.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
0
 

Author Comment

by:Belazir
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...

B
0
 

Author Comment

by:Belazir
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?

Cheers
B
0
 

Expert Comment

by:Jy
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
  jy  
0
 
LVL 1

Expert Comment

by:Computer101
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.

Computer101
E-E Admin
0
 

Accepted Solution

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

Chmod
Community Support Moderator @Experts Exchange
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

764 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