Here is what i did. can't figure out whats going wrong.

Code:
Dim TWnd As Long
Dim TProcess As Long
Dim pId As Long

TWnd = FindWindow(vbNullString, "Planescape: Torment"): MsgBox TWnd
If TWnd = 0 Then MsgBox "hithere1": Exit Sub
pId = GetWindowThreadProcessId(TWnd, pId): MsgBox pId
TProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pId): MsgBox TProcess
I declared everything right and looks like everything should go alright but its not grr.