How to create a GUID programmatically?

Do the following… [sourcecode language=’cpp’]GUID guId = { 0 }; CoCreateGuid( &guId ); // or UUID uid = { 0 }; UuidCreate( &uid );[/sourcecode] For converting to string use… [sourcecode language=’cpp’]PUCHAR pChar = 0; // Convert to string UuidToString( &uid, &pChar ); MessageBox( NULL, (char*)pChar, NULL, MB_OK ); //Don’t forget to free allocated string RpcStringFree( […]
Continue reading…

 

A printf type of MessageBox function which takes variable arguments!

It’s a hard chore for a programmer to display string and integers in a message box, mainly because they have to use CString or sprintf to get these integers in formatted manner… For eg: [sourcecode language=’cpp’]int nAge = 27, nSal=100; CString csStr; csStr.Format( _T( “Age: %d, nSal: %d” ), nAge, nSal ); AfxMessageBox( csStr );[/sourcecode] […]
Continue reading…