First of all
if (is32bit = false)
is both buggy (should be '=='; comparison, not assignment you wrote) and silly, because
is32bit
is already Boolean. Should be:
if (is32bit)
Also, you should not open the process to get a handle. Instead, use
currentProcess.Handle
:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.handle%28v=vs.110%29.aspx[
^].
Probably you need to show both
Handle
and
Id
, or, even better,
Id
only, because
Handle
is nearly useless to from the user's standpoint. Only the
Id
is good for using in different processes; this is the process-independent (system-wide) ID of a process. Handles of the same process obtained in the address spaces of different application domains will be different numerical values.
—SA