Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Automatically Generate a GUID

Posted on 2001-07-16
6
Medium Priority
?
2,870 Views
Last Modified: 2009-07-02
Is there any way to automatically generate a GUID programatically ?  If so how ?

I would be grateful for all advice offered.

Thanks in advance

John
0
Comment
Question by:johnclarke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6286659
Use the CreateClassID function and add ComObj to the uses clause.
0
 
LVL 3

Expert Comment

by:vladh
ID: 6286976
listening...
0
 
LVL 17

Accepted Solution

by:
inthe earned 150 total points
ID: 6287009
or coCreateGuid from ole32.dll :

Uses comobj;//for GuidToString function

function CoCreateGuid(out guid: TGUID): HResult; stdcall;
  external 'ole32.dll' name 'CoCreateGuid';

procedure TForm1.Button1Click(Sender: TObject);
var
  G : TGUID;
  S : string;
begin
  coCreateGuid(G);
  S := GuidToString(G);
  form1.caption := S
end;
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:johnclarke
ID: 6288957
Thanks for your help!

John
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6288990
Huh? What's wrong with CreateClassID?
0
 
LVL 1

Expert Comment

by:jeboersema
ID: 23773540
Hi

What is interesting here is that CoCreateGUID does not seem to work on Windows 2003 Server R2 whereas CreateClassID does.

Thought you might find this interesting.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question