C++ to Delphi, Values/GUIDs

I need 2 Functions, Rater simple i guess.. if you know how that is :)

1. Convert String with '0x0300' type values into the Format we use in Delphi.

2. Convert GUIDs from C++ Headers into GUID Format we use in Delphi.
i found 2 kinds in the headers :
First: {e436eb78-524f-11ce-9f53-0020af0ba770}
Second: 0xe436eb78, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70

Not very familiar with those things yet.. so i hope u guys could introduce me to the devils..
LVL 2
brainwareAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
duno much about guids but you can use something like below :

 
const

  First : TGUID = '{3F5A62E2-51F2-11D3-A075-CC7364CAE42B}';

 Second : TGUID = (
    D1:$0000010B;D2:$0000;D3:$0000;D4:($C0,$00,$00,$00,$00,$00,$00,$46));

do you know about guidtostring(TGuid) defined in comobj.
and cocreateguid(tguid) in activex unit.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brainwareAuthor Commented:
Well i kinda need to convert the format of the Hmm STRINGS/GUIDS whatever u wanna call them, Into Delphi Working Values.. at first the MOST Imp is the 0x0300  i checked delphi source and noticed some values i could not see any compare between the values here and the once in the Windows SDK (c++)
Noticed some ppl to like
MyConst = (1 shr 2) insted of such value .... Im only getting more confused.. :(
0
brainwareAuthor Commented:
i have been awake for 4 days now (in a row), But anyhows.. a page with bad english i bet, http://www.bw-soft.com
bwDelphi-Kit, Getting Developed by me and several of others, No freeware tho.. Not when it is as big as its going to be shortly..

Just if a pro like u had any interests in it..

Kinda Amature page right now.. but no time for Fancy html, Can't u see we are coding :)
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

simonetCommented:
>1. Convert String with '0x0300' type values into the
>Format we use in Delphi.

That's an hexadecimal value. To convert it to an integer, do the following:

function CHexToDInt(CHex : string) : longint;
begin
   Delete(CHex, 1, 2);   // 0x0300 -> 0300
   Result := StrToInt('$'+CHex);  // 0300 -> $0300 -> longint
end;

Yours,

Alex


0
MadshiCommented:
Hehe, this one is faster...   :-))

function CHexToDInt(CHex : string) : longint;
begin
   Delete(CHex, 1, 1);   // 0x0300 -> 0300
   CHex[1] := '$';
   Result := StrToInt(CHex);  // 0300 -> $0300 -> longint
end;

(-:

Regards, Madshi.
0
brainwareAuthor Commented:
hehe.. Well i learned that it was HEX yeah.. but what about the GUID Crap..
0
MadshiCommented:
Michael, do you want to convert the GUID strings with a program or simply manually? If manually, look at Barry's comment.
0
brainwareAuthor Commented:
Well i just need to write a small app that i give a C++ GUID and it gives me Delphi version of it...
becuse i want to port a few things of the DirectMedia SDK..
0
brainwareAuthor Commented:
the functions u refered me too was oki.. figured the rest out too..
thanks..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.