Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Convert string to GUID structure`


5 replies to this topic

bogdan.carjac

bogdan.carjac
  • Full Members
  • 24 posts

Posted 05 March 2007 - 17:31

Hello,

I have a guid as string like "DB087CCC-AF2C-431d-84A3-25291FF089D5", and I need to convert them in a structure like
typedef struct _GUID {
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[ 8 ];
} GUID;
(typical Microsoft GUID structure).

In Installshield (11) I've defined a structure like:

typedef GUID
begin
LONG Data1;
SHORT Data2;
SHORT Data3;
CHAR Data4(8);
end;

Any idea how to populate the GUID defined structure from my string in Installshield 11 ?
Is there a function which is predefined, and already does this?

Thanks.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 March 2007 - 18:29

Da gibt es glaube ich nichts vordefiniertes. Am besten nimmst du die String-Funktionen (StrFind usw.)

bogdan.carjac

bogdan.carjac
  • Full Members
  • 24 posts

Posted 06 March 2007 - 08:57

Thank you, I appreciate your answer, even if my German is not so good.

But I think it's not a metter of Substrings. It's more an issue of converting a GUID string into GUID structure, so what i need is an algorithm, IF Installshield doesn't have a predefined function which does something similar (as I understood from your German explanation).
And if Installshield doesn't support that... it will be my job to think about an algorithm.

Best regards,
Bogdan.

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 06 March 2007 - 14:31

Maybe u can use this Win32. rpc api function:
http://msdn2.microso...y/aa379336.aspx
Regards
-Stein Åsmul

bogdan.carjac

bogdan.carjac
  • Full Members
  • 24 posts

Posted 07 March 2007 - 11:47

Hello,

I solved the problem and I used CLSIDFromString method from Ole32.dll.
I presume it's similar with what you've described. But there is a problem, and i think it's an installShield 11 problem.
The DLL's method is expecting an UNICODE string:

HRESULT CLSIDFromString(
LPOLESTR lpsz,
LPCLSID pclsid
);

In Installshield I placed a STRING variable, and I checked! is not working!
So STRING variable I think it is MBCS!
I checked in Installshield documentation and it says STRING type is unicode, which I think is wrong. In order to make it work I used WSTRING !

http://www.installsh...Pro7Excerpt.pdf

I guess that's interesting to know... anyway in my case I was able to call the DLL's method only with WSTRING !

Best regards,
Bogdan.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 08 March 2007 - 17:51

QUOTE (bogdan.carjac @ 2007-03-06 09:57)
Thank you, I appreciate your answer, even if my German is not so good.

Apologies for that. To much jumping between the English and the German section of this forum.