Storing settings of COM-server

Hi there!

I wrote an inprocess-server with ATL. This server is added as a component on a
transaction-server. Remote clients can easily create an instance of this
server and use it.

My problem: The server needs some settings. These settings should be stored on the machine where the transaction-server runs. If I access the registry from the inprocess-server (with CRegKey) I always access the registry of the client-machine!
How can I access the registry of the transaction-server-machine? Is the
registry the right place to store such information?

Greetings
Gottfried
joker1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
Storing the settings in the registry is a good idea - however, if you want to store the settings on the server machine, you'll have to use 'RegConnectRegistry()' first, e.g.:

    CRegKey     cRegKey;
    HKEY        hRemoteHKLM;
    HKEY        hKey;
    LONG        lnResult;

    if  (   ERROR_SUCCESS   !=  (   lnResult    =   RegConnectRegistry  (   "\\\\myserver",
                                                                            HKEY_LOCAL_MACHINE,
                                                                            &hRemoteHKLM
                                                                        )
                                )
        )
        {
            //  error
        }


    cRegKey.Attach  (   hRemoteHKLM);


Feel free to ask if you need more information!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
joker1Author Commented:
I don't know why, but the problem doesn't exist anymore.
If I query settings from the registry I access the right machine. I think I shouldn't work for a long time :-)

However, thanks for your answer.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.