| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Mon Mar 07, 2005 2:21 pm Post subject: How to generate GUID number within an BCB6 build apps? |
|
|
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
|
Posted: Mon Mar 07, 2005 5:23 pm Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
<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
|
Posted: Mon Mar 07, 2005 5:56 pm Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
#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
|
Posted: Mon Mar 07, 2005 7:17 pm Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
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
|
Posted: Tue Mar 08, 2005 6:41 am Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
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
|
Posted: Tue Mar 08, 2005 7:19 pm Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
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
|
Posted: Wed Mar 09, 2005 4:17 pm Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
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:
The header name:
| Quote: | Module Name:
rpcdce.h
|
"Extra" c in there.....
|
|
| Back to top |
|
 |
Michel Leunen Guest
|
Posted: Wed Mar 09, 2005 7:23 pm Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
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
|
Posted: Thu Mar 10, 2005 3:37 pm Post subject: Re: How to generate GUID number within an BCB6 build apps? |
|
|
yet another method ..
#include <ComObj.Hpp>
AnsiString szGuid = CreateClassID();
see other GUID functions in comobj.
|
|
| Back to top |
|
 |
|