winzip icon

CoCreateGuid Example

Submitted on: 10/1/2019 11:37:56 PM
By: Nicholas Forystek  
Level: Advanced
User Rating: Unrated
Compatibility: VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 12374
author picture
     Globally Unique Identifier generate function as well as a IsGuid() function to test if the GUID is a string representation seemingly of one. I found some other examples of using CoCreateGuid, however, in repeating the call I was not satisfied with the unique random display, some have portions that repeat, some didn't seem to fill the hex values or that is they could possibly return more then one leading zero. So after some attempts, I arrived at this conclusion that in repeat debug satisfies GIUD requirements (while the CoCreateGuid returns a unique Guid, in structure, the text representation I believe in Visual Basic because of it's strings is especially indifferent to be true in view, and the Co in CoCreateGuid, being the cooperative mention, not fully platform independent).
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Other 33 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

10/3/2019 6:09:26 PMBonnie West

Here's a better way of generating a GUID:

Smallest but fastest GUID generator function (using API) cripts/ShowCode.asp?txtCodeId=74588&lngWId=1

(If this comment was disrespectful, please report it.)

10/3/2019 6:14:01 PMBonnie West

For some reason, PSC corrupted my link above (/scripts/ became /s cripts/). I'll try it again: m/vb/scripts/ShowCode.asp?txtCodeId=74588&lngWId=1

(If this comment was disrespectful, please report it.)

10/3/2019 6:19:08 PMBonnie West

Well, PSC screwed up again (this time, .com/ became .co m/). I give up. Just manually fix the broken links above if you're interested in checking them out.

(If this comment was disrespectful, please report it.)


Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.