A round dialog box!

Ever wondered how those cute little round dialog boxes are created. I too wondered for some time. But let me tell you it is easy, take a look: Do this from OnInitDialog! [sourcecode language=’cpp’]//Create a region object globally. CRgn m_EllipticRegion; //a rect object CRect crDialogRect; //get your dialog size this->GetClientRect(crDialogRect); //Now create the elliptic region […]
Continue reading…

 

How to convert ANSI string to UNICODE string and vice versa?

Well quite simple,ย  but still quite frequently asked in forums… ๐Ÿ™‚ There are two macros that does this for us. They are as follows. Note: You must include atlconv.h A2W – ANSI to UNICODE W2A – UNICODE to ANSI Before using these two macros you have to use this macro too… USES_CONVERSION Here is a […]
Continue reading…

 

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…

 

Replacement for CString::Format in standard C++

std::stringstream can be used as a replacement for CString::Format, if you are using CString just for the sake of Format, caveat being that it could be slow, I’ve heard a user mentioning this but not sure, I haven’t tested it out, but should be definitely better that using CString::Format and then assigning to std::string. [sourcecode […]
Continue reading…