BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to generate GUID number within an BCB6 build apps?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Mar 07, 2005 2:21 pm    Post subject: How to generate GUID number within an BCB6 build apps? Reply with quote



How can I generate Globally Unique IDentifier (GUID) number in my
application? Is there any API for this? Any example?.


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Mar 07, 2005 5:23 pm    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote




<Lee> wrote


Quote:
How can I generate Globally Unique IDentifier (GUID) number
in my application?

Look at CoCreateGuid().


Gambit



Back to top
Sam S. Firouz
Guest





PostPosted: Mon Mar 07, 2005 5:56 pm    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote



#include <ComObj.hpp>
AnsiString __fastcall GetAGuid (void)
{
System::TGUID g;

OleCheck (CoCreateGuid (&g));
return (Sysutils::GUIDToString (g));
}

Sam

<Lee> wrote

Quote:
How can I generate Globally Unique IDentifier (GUID) number in my
application? Is there any API for this? Any example?.




Back to top
Michel Leunen
Guest





PostPosted: Mon Mar 07, 2005 7:17 pm    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote

Lee wrote:

Quote:
How can I generate Globally Unique IDentifier (GUID) number in my
application? Is there any API for this? Any example?.

Another way :

#include <rpcde.h>

UUID uuid;
HRESULT hr = UuidCreateSequential(&uuid);
if (hr == RPC_S_OK)
{
unsigned char *buf;
hr = UuidToString(&uuid, &buf);
if (hr == RPC_S_OK)
{
std::cout< RpcStringFree(&buf);
}
}

Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------

Back to top
Guest






PostPosted: Tue Mar 08, 2005 6:41 am    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote

It seems to be tht I do not have the header file "rpcde.h" .
Where from I should get it ?

Quote:
How can I generate Globally Unique IDentifier (GUID) number in my
application? Is there any API for this? Any example?.

Another way :

#include
UUID uuid;
HRESULT hr = UuidCreateSequential(&uuid);
if (hr == RPC_S_OK)
{
unsigned char *buf;
hr = UuidToString(&uuid, &buf);
if (hr == RPC_S_OK)
{
std::cout< RpcStringFree(&buf);
}
}

Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------



Back to top
Michel Leunen
Guest





PostPosted: Tue Mar 08, 2005 7:19 pm    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote

Lee wrote:
Quote:
It seems to be tht I do not have the header file "rpcde.h" .
Where from I should get it ?

Hmm, it's in the include directory of the commandline tools (bcc5.5.1. I
don't have Builder installed on this machine so I can't test) and seems
to be a Microsoft header :

Copyright (c) 1991-1999 Microsoft Corporation
Module Name:
rpcdce.h
Abstract:
This module contains the DCE RPC runtime APIs.

But I can't find any reference to it in MSDN, though.

Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------

Back to top
Bob Gonder
Guest





PostPosted: Wed Mar 09, 2005 4:17 pm    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote

Michel Leunen wrote:

Quote:
Lee wrote:
It seems to be tht I do not have the header file "rpcde.h" .
Where from I should get it ?

Hmm, it's in the include directory of the commandline tools (bcc5.5.1. I
don't have Builder installed on this machine so I can't test) and seems
to be a Microsoft header :

Ummm.. that's a "different" header.

The code you posted:
Quote:
#include

The header name:

Quote:
Module Name:
rpcdce.h

"Extra" c in there.....





Back to top
Michel Leunen
Guest





PostPosted: Wed Mar 09, 2005 7:23 pm    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote

Bob Gonder wrote:

Quote:
Module Name:
rpcdce.h
"Extra" c in there.....

Oops, you're right.

Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------

Back to top
Mike Harris
Guest





PostPosted: Thu Mar 10, 2005 3:37 pm    Post subject: Re: How to generate GUID number within an BCB6 build apps? Reply with quote


yet another method ..

#include <ComObj.Hpp>
AnsiString szGuid = CreateClassID();

see other GUID functions in comobj.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.