CreateRemoteComObject + username/password

Posted on 2007-07-30
Last Modified: 2009-12-16
I have a Delphi 6 app that attaches to an OPC server via CreateRemoteComObject it works fine as long as the server has been configured to allow access to EVERYONE via DCOMCNFG on the remote machine. I now have a customer who is complaining that they don't want to open up access to EVERYONE for security purposes. My question is: is there a way to include a user name/password in the CreateRemoteComObject function call? I seem to remember something about appending a username/password to the MachineName parameter, but I'm having no luck re-discovering that info via Google.
Question by:BradKilmer
    LVL 21

    Expert Comment

    the best and easiest way is to run your app as user that has granted access to DCOM server


    Author Comment

    Yeah, that was my first thought, but I still would like to know if there is any way to embed to login into my app just in case the customer has some other security reservation. Like I said initially, I thought that I saw a method for doing this by adding the user name/password to the MachineName parameter in the CreateRemoteComObject function call. Am I remembering incorrectly?
    LVL 26

    Expert Comment

    by:Russell Libby

    You are remembering incorrectly, as CreateRemoteComObject does not let you do this. The following link will give you info on the COM security calls (which are not trivial to use):

    As ziolko indicated, you should be using dcomcnfg to specify the clients that are allowed to connect and launch the OPC server.

    LVL 21

    Accepted Solution

    COM/DCOM is based on windows security mechanism so using user credentials is natural, you can of course try to impersonate your app as other user.
    Other way, if you know name and pass of user that is allowed to access remote object, you can create small app that will launch DCOM client with CreateProcessAsUser().


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now