Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.02.03;
Скачать: CL | DM;

Вниз

Как получить GUID?   Найти похожие ветки 

 
Pan   (2002-12-17 09:19) [0]

Какую функцию нужно вызывать, чтобы получить GUID?


 
Vasily Terekhov   (2002-12-17 09:21) [1]

А Ctrl+Shift+G в дельфях нажать не достаточно?


 
Pan   (2002-12-17 09:23) [2]

А как дельфи то его берут?


 
MBo ©   (2002-12-17 09:30) [3]

CoCreateGuid


 
Jeer ©   (2002-12-17 23:45) [4]

GUID - Globally Unique Identifier

typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;

Канонический вид
{5E4526AA-4DD1-D111-342D-00C04FC964FF}



 
Anatoly Podgoretsky ©   (2002-12-18 00:17) [5]

Pan (17.12.02 09:23)
Ну ты какой любопытный, ну какая разница откуда, не пишут об этом


 
C2H5OH   (2002-12-18 19:38) [6]

алгоритм вычисления guid разработан Open Software Foundation (кажется так называется эта контора). вычисляется на основе уникального номера сетевой карты, текущего времени. содержит 16 байт, шо обеспечивает ~10е27 различных нумеров, много больше чем звезд в нашей галактике, правда меньше, чем масса Юпитера в килограммах. о, как!


 
Morfein ©   (2002-12-18 21:34) [7]

Насчёт уникального номера сетевой карты, это ты загнул...
У меня вот нет сетевой карты, но никто же не скажет, что у меня винда не работает...


 
kig ©   (2002-12-19 00:22) [8]

2Morfein © (18.12.02 21:34)

Винда то без сетевухи работает, но вот только при генерации гуида:

MSDN
UuidCreate

...

In Windows NT 4.0, Windows 95, DCOM release, and Windows 98, UuidCreate returns RPC_S_UUID_LOCAL_ONLY when the originating computer does not have an ethernet/token ring (IEEE 802.x) address. In this case, the generated UUID is a valid identifier, and is guaranteed to be unique among all UUIDs generated on the computer. However, the possibility exists that another computer without an ethernet/token ring address generated the identical UUID. Therefore you should never use this UUID to identify an object that is not strictly local to your computer. Computers with ethernet/token ring addresses generate UUIDs that are guaranteed to be globally unique.


MSDN
UuidCreateSequential


For security reasons, UuidCreate was modified so that it no longer uses a machine"s MAC address to generate UUIDs. UuidCreateSequential was introduced to allow creation of UUIDs using the MAC address of a machine"s Ethernet card.

In Windows XP/2000, UuidCreateSequential returns RPC_S_UUID_LOCAL_ONLY when the originating computer does not have an ethernet/token ring (IEEE 802.x) address. In this case, the generated UUID is a valid identifier, and is guaranteed to be unique among all UUIDs generated on the computer. However, the possibility exists that another computer without an ethernet/token ring address generated the identical UUID. Therefore you should never use this UUID to identify an object that is not strictly local to your computer. Computers with ethernet/token ring addresses generate UUIDs that are guaranteed to be globally unique.



 
Pan   (2002-12-19 14:10) [9]

А кто-нибудь сможет это грамотно перевести
на "Дельфийский" язык?

......

HRESULT CoCreateGuid
(
GUID *pguid // указатель на структуру GUID
);

Вот пример:

#include "stdafx.h"
#include "objbase.h"
#include "iostream.h"

void main()
{
HRESULT hr;
GUID guid;
hr=CoCreateGuid(&guid);
if (!FAILED(hr))
{
LPOLESTR szGUID = new WCHAR [39];
StringFromGUID2(guid,szGUID,39);
wprintf(L"Inherited ObjectType GUID: %s\n",szGUID);
}
else cout << "Error create Guid" << endl;
}

В результате в окне Вы увиде сформированный GUID:

Inherited ObjectType GUID: {75A73880-02BF-11D5-B4A9-E0034BC10000}
Press any key to continue

Только сам GUID будет другим, ведь он же уникальный.


 
kig ©   (2002-12-19 16:38) [10]

2Pan (19.12.02 14:10)

Найдите поиском по CoCreateGUID в дельфийских текстах ф-ции, которые ее пользуют. И выбирайте себе по вкусу.



Страницы: 1 вся ветка

Текущий архив: 2003.02.03;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.013 c
4-5334
Sodom
2002-12-14 10:29
2003.02.03
Защита от TerminateProcess


1-5013
bor
2003-01-23 16:07
2003.02.03
Термины


14-5261
zzet
2003-01-16 18:44
2003.02.03
Гы..


6-5121
Neo_c
2002-12-06 14:09
2003.02.03
Нужна помощь


3-4760
User_OKA
2003-01-16 10:40
2003.02.03
экспорт в Excel