Hi,
Do you know if there is any equivalent of the function "uuidof" for Purebasic?
It is used on an interface.
Thanks !
uuidof
Re: uuidof
I think you can use this:
not tested, only to illustrate
greetings
Thomas
Code: Select all
Procedure StringToBStr(string.s)
Protected *Buffer = AllocateMemory(StringByteLength(string, #PB_Unicode) + 2)
Protected bstr_string.i
If *Buffer
PokeS(*Buffer, string, -1, #PB_Unicode)
bstr_string = SysAllocString_(*Buffer)
FreeMemory(*Buffer)
EndIf
ProcedureReturn bstr_string
EndProcedure
Define.GUID UUID
uidstr.i = StringToBStr("{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}")
CLSIDFromString_(uidstr, @UUID)
SysFreeString_(uidstr)
Debug UUID
greetings
Thomas
Re: uuidof
You might also want to look at the function COMate_GetIIDFromName() from the COMatePLUS source which will search your registry for an interface's 'friendly name' (e.g. iUnknown) and, if found, will return the appropriate GUID etc.
I may look like a mule, but I'm not a complete ass.
Re: uuidof
Thanks a lot for the quick replies, I will try what you suggested!
Re: uuidof
After testing this was exactly what I needed, thank you Thomas!ts-soft wrote:I think you can use this:not tested, only to illustrateCode: Select all
Procedure StringToBStr(string.s) Protected *Buffer = AllocateMemory(StringByteLength(string, #PB_Unicode) + 2) Protected bstr_string.i If *Buffer PokeS(*Buffer, string, -1, #PB_Unicode) bstr_string = SysAllocString_(*Buffer) FreeMemory(*Buffer) EndIf ProcedureReturn bstr_string EndProcedure Define.GUID UUID uidstr.i = StringToBStr("{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}") CLSIDFromString_(uidstr, @UUID) SysFreeString_(uidstr) Debug UUID
greetings
Thomas


