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…

 

NDTV – ATS chief Karkare succumbs to injuries

NDTV should know that money is not everything. They should probably hire an extra editor or someone to screen/filter out garbage that they write in their website. I was reading a news page on officer Karkare from NDTV site. What a brave man to have taken three bullets on his chest and not on his […]
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…

 

Get my system’s boot mode, or is my system booted in safe mode?

Use GetSystemMetrics( SM_CLEANBOOT ), here are some inline functions, you can understand what they do from their names… [sourcecode language=’cpp’]__inline BOOL IsNormalBoot() {     return ::GetSystemMetrics(SM_CLEANBOOT) == 0; } __inline BOOL IsSafeMode() {     return ::GetSystemMetrics(SM_CLEANBOOT) == 1; } __inline BOOL IsSafeModeWithNetworkBoot() {     return ::GetSystemMetrics(SM_CLEANBOOT) == 2; }[/sourcecode]
Continue reading…

 

Is my application running on a remote session?

Is there any way to find out if our application is being run using a terminal services client session? Well what is a terminal service? It’s a program that creates a local session for a remote PC, one such terminal services application is “mstsc”. If you want to connect to a remote pc you just […]
Continue reading…

 

How to find information about mouse?

Well I’m not talking about the one that your cat runs after but the one on which your palm rests. 😉 It’s quite easy, use GetSystemMetrics and associated mouse indexes. I’ll show demos here… Is there a mouse installed? [sourcecode language=’cpp’]// Use GetSystemMetrics ::GetSystemMetrics( SM_MOUSEPRESENT );[/sourcecode] Is there a mouse wheel present? [sourcecode language=’cpp’]// Use […]
Continue reading…

 

Function for retrieving user restrictions set by an administrator

It’s quite normal that an administrator can set restrictions on certain users for security reasons, for e.g. in my company I’ve restrictions which prevents me from changing my screensaver etc, which is kinda bad in my opinion and there are other restrictions too. So the question, is there an API which helps us in finding out […]
Continue reading…

 

Debugging WM_PAINT messages

It’s always irritating to debug paint messages and sometimes expensive too. I’ve tried different methods to try debug painting issues, always ended up disappointed. Why is it such a pain to debug WM_PAINT messages? Main reason is, we are not in control. Paint messages comes via a window framework. Painting is done whenever a window […]
Continue reading…