How to create a unicode window in a non-unicode application?

Recently a user asked this question in MSDN forums. He had MBCS enabled for his application and also wanted to enable unicode characters in a particular edit control. Note MFC only create unicode controls if UNICODE is defined in project settings. So in order to explicitly create controls that support UNICODE characters we use the […]
Continue reading…

 

Associate a path with a drive letter

Use SUBST command… [sourcecode language=”cpp”]SUBST [drive1: [drive2:]path] SUBST drive1: /D drive1:        Specifies a virtual drive to which you want to assign a path. [drive2:]path  Specifies a physical drive and path you want to assign to a virtual drive. /D             Deletes a substituted (virtual) drive.[/sourcecode] Type SUBST with no parameters to display a list of current […]
Continue reading…

 

How to create a choice like command in a batch file?

There used to be a windows command called choice, which takes yes or no for an answer. Recently I was making a batch file and tried the same command again but to my surprise found that it was not available. So I didn’t implement that part. But later I found out another way and probably […]
Continue reading…

 

How to generate random numbers in a batch file?

Ever wondered how we can generate random numbers in a batch file. Yes, I am talking about our good old faithful friend ‘.bat’ file. Why do I need one? You may ask! I had to generate a unique filename everytime because I had to backup a folder before I updated it. So tell us is […]
Continue reading…

 

DLL Best Practices

Following information taken from this document maintained by microsoft! An important excerpt from this document! DllMain is called while the loader-lock is held. Therefore, significant restrictions are imposed on the functions that can be called within DllMain. As such, DllMain is designed to perform minimal initialization tasks, by using a small subset of the Microsoft® […]
Continue reading…

 

Programmatically selecting a file in windows explorer!

Well while coding for process viewer I felt the need for programmatically selecting a file in windows explorer and after a short search bumped into about.com which had a code snippet in Delphi which does this. Modified a “bit” for VC++… [sourcecode language=’cpp’]// Select a file in explorer void SelectFileInExplorer( LPCTSTR lpctszFileToSelect_i ) {     […]
Continue reading…