Starting command prompt in a particular directory

What I mean is, if we type ‘Start->Run->Cmd.exe’ then command prompt directory is our user directory, for e.g. ‘c:Documents and settingsNibu’. So how can we do this through code is the question? Directory that we see when command prompt starts up is called working directory. Every executable in windows has a working directory which is […]
Continue reading…

 

How to identify a stale handle?

Lets suppose you are keeping handles of all processes running in a system using OpenProcess, now it’s just normal that some processes may exit, but since you have a valid handle there is no way to tell whether the process is still running or whether it has exited. You cannot check for NULL since the […]
Continue reading…

 

How to start a process hidden!

I’ve seen people asking this question number of times, so for those people here is the answer… When creating a process via CreateProcess we’ve got to give a STARTUPINFO structure as a parameter which specifies startup options for a process. Set dwFlags member to STARTF_USESHOWWINDOW to indicate that we will be using wShowWindow member of STARTUPINFO. Then set wShowWindow to […]
Continue reading…