Welcome! Log In Create A New Profile

Advanced

GetGUID (by Guenter)

Posted by Michael Drechsel 
Michael Drechsel
GetGUID (by Guenter)
May 24, 2009 05:25PM
// Summary: <specify the procedure action>
// Syntax:
//[ <Result> = ] GetGUID ()
//
// Parameters:
//	None
// Return Value:
// 	string: // 	None
//
// For instance:
// Indicate an example.
//
PROCEDURE GetGUID() 

GUID is TO structure
	Data1 is int on 4 bytes
	Data2 is int on 2 bytes
	Data3 is int on 2 bytes
	Data4 is fixed array of 8 unsigned int on 1 byte
END 

LOCAL
	i is int on 4 bytes
	udtGuid is GUID
	s is string
	g is string 
	
i=CallDLL32("OLE32.DLL","CoCreateGuid",&udtGuid) 

IF i = 0 THEN
	s = NumToString(udtGuidgrinning smileyata1, "08X")+NumToString(udtGuidgrinning smileyata2, "04X")+...
	NumToString(udtGuidgrinning smileyata3, "04X")
	IF udtGuidgrinning smileyata4[1] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[1],"X")
	IF udtGuidgrinning smileyata4[2] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[2],"X")
	IF udtGuidgrinning smileyata4[3] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[3],"X")
	IF udtGuidgrinning smileyata4[4] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[4],"X")
	IF udtGuidgrinning smileyata4[5] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[5],"X")
	IF udtGuidgrinning smileyata4[6] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[6],"X")
	IF udtGuidgrinning smileyata4[7] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[7],"X")
	IF udtGuidgrinning smileyata4[8] < 0x10 THEN
		s=s+"0"
	END
	s=s+NumToString(udtGuidgrinning smileyata4[8],"X")
END 

RESULT s




Edited 1 time(s). Last edit at 05/25/2009 02:15AM by Jimbo.
Ruben Sanchez Peña
Re: GetGUID (by Guenter)
September 27, 2009 08:18PM
Thank you. Very useful code. I am using your code to generate the socket identifier for use with threads.



Rubén Sánchez Peña
Jimbo
Re: GetGUID (by Guenter)
December 10, 2009 05:19PM

Hi Michael, thank you! Since the code is distorted by smilies and we cannot extinct them in this place, you can copy the code for the GetGUID() function from the WinDev.at web site:
[www.windev.at]

Kind Regards,
Guenter
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: