title: Getting a different address from a HANDLE in C++ every time I re-compile and run the program?
body: <p>I'm trying to get the starting address of a process in C++ by getting the handle and printing its value. I tried getting the starting address of Spider Solitaire through Cheat Engine and it gives me "300905A4D" (currently that is). I try </p>
  
  <pre><code>HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid) 
  </code></pre>
  
  <p>and it gives me a different number/address every time I restart my C++ program. I keep Spider solitaire running at all times, and cheat engine keeps giving me the same starting address, but when I print </p>
  
  <pre><code>cout &lt;&lt; &amp;pHandle; 
  </code></pre>
  
  <p>my c++ program gives me a different number every time. What am I doing wrong here? Also, my C++ code works fine. I can write to memory and all that, I just wonder why I'm not getting the same address Cheat Engine is giving me, and why it's a different one every time. </p>