Archived

This topic is now archived and is closed to further replies.

App GUID and DirectPlay

This topic is 5377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I was adding DirectPlay networking to my Checkers game today and ran into the GUID thingy. Up till now I had no GUID explicitly defined. Anyway, almost all the samples in one of my books (Multiplayer Game Programming by Todd Baron) have the DP_ GUID defined with this big long compilation of numbers {...etc etc...}. I tried just copying that and putting it in a header file (tried it in a cpp file too) but then every time I compiled, it told me this GUID was already defined in the different .obj files during the Link process. So anyway, I copied one out of the sdk dplay samples and just assigned it to a global GUID variable instead of a constant and it compiles. How do other people handle this? I downloaded the guidgen.exe file I found somewhere and could use that to generate a unique guid but is it considered proper to do that and then just hardcode it as a constant or global variable in my code somewhere? I use VC6.0 and I read on the guidgen site that it was for less robust development environments and implied that more robust ones like VC6.0++ will generate GUIDs for apps. Is this true and does the generation still involve a manual operation with a utility or is the GUID for my Checkers app somehow already generated and embedded somewhere in my app?

Share this post


Link to post
Share on other sites
i generate guids with guidgen and stick their declarations in headers and definitions in source files.

you can also put guid definitions in libraries if you need to share them across projects, a-la dxguid.lib/strmiid.lib.

Share this post


Link to post
Share on other sites
You differentiate between declaration in header and definition in source. Can you elaborate? Maybe a couple sample lines of code would clear it up for me.

Share this post


Link to post
Share on other sites
I just hard-code my own (random) numbers in my global guid definition.

The chances of matching my GUID with an already defined one is like winning the lottery.

Soooo if I ever run into a situation where the guid already exists, I''m running to the store to buy Lottery tickets!!!


www.cppnow.com

Share this post


Link to post
Share on other sites