Sure. Simple is Simple. Either you haven't installed Direct X SDK or you have not added it as a reference.
You want to kill me
You look at these photos. A problem there.
I chose the wrong of reference
Now what do you think
You never assigned a value to the integer "ProcessId" in this section of the code:
[php]
Dim hWnd As Object, processHandle As IntPtr, processId As Integer
hWnd = FindWindow(vbNullString, "Call of Duty 4")
If (hWnd = 0) Then
MsgBox("Call of Duty 4! Not Found!", MsgBoxStyle.OkOnly, "Erorr!")
End
End If
GetWindowThreadProcessId(hWnd, processId)
processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId)
Dim Dev As Direct3D.Device = New Direct3D.Device(processHandle)
CaptureScreenshot(Dev, "c:\Screenshott1.jpg", ImageFileFormat.Jpg)
CloseHandle(processHandle)
End Sub
[/php]
You declared processID but never got the value for it.
Try adding this function to your code
[php]
Private Function GetPID(ByVal ProcName As String)
If ProcName.Contains(".") Then
ProcName = ProcName.Substring(0, ProcName.LastIndexOf("."))
End If
Dim PID As Integer = 0
For Each p As Process In Process.GetProcesses(My.Computer.Name)
If p.ProcessName = ProcName Then
PID = p.Id
End If
Next
Return PID
End Function
[/php]
and then change the original code to:
[php]
Dim hWnd As Integer, processHandle As IntPtr, processId As Integer
ProcessID = GetPID("CoD process name as seen in task manager without .exe")
hWnd = FindWindow(vbNullString, "Call of Duty 4")
If (hWnd = 0) Then
MsgBox("Call of Duty 4! Not Found!", MsgBoxStyle.OkOnly, "Erorr!")
End
End If
GetWindowThreadProcessId(hWnd, processId)
processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId)
Dim Dev As Direct3D.Device = New Direct3D.Device(processHandle)
CaptureScreenshot(Dev, "c:\Screenshott1.jpg", ImageFileFormat.Jpg)
CloseHandle(processHandle)
[/php]
I dunno if that will fix your problem seeing as I've never really worked with DirectX, but not assigning the ProcessID any value doesn't seem like a good start -.-
You'll need to change this line here:
[php]
ProcessID = GetPID("CoD process name as seen in task manager without .exe")
[/php]
Where i've put "CoD process name as seen in task manager without .exe" you'll need to do just that, I didn't know the CoD process name. Example would be for Combat Arms, the process name is "Engine" (note, don't include the exe)
You never assigned a value to the integer "ProcessId" in this section of the code:
[php]
Dim hWnd As Object, processHandle As IntPtr, processId As Integer
hWnd = FindWindow(vbNullString, "Call of Duty 4")
If (hWnd = 0) Then
MsgBox("Call of Duty 4! Not Found!", MsgBoxStyle.OkOnly, "Erorr!")
End
End If
GetWindowThreadProcessId(hWnd, processId)
processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId)
Dim Dev As Direct3D.Device = New Direct3D.Device(processHandle)
CaptureScreenshot(Dev, "c:\Screenshott1.jpg", ImageFileFormat.Jpg)
CloseHandle(processHandle)
End Sub
[/php]
You declared processID but never got the value for it.
Try adding this function to your code
[php]
Private Function GetPID(ByVal ProcName As String)
If ProcName.Contains(".") Then
ProcName = ProcName.Substring(0, ProcName.LastIndexOf("."))
End If
Dim PID As Integer = 0
For Each p As Process In Process.GetProcesses(My.Computer.Name)
If p.ProcessName = ProcName Then
PID = p.Id
End If
Next
Return PID
End Function
[/php]
and then change the original code to:
[php]
Dim hWnd As Integer, processHandle As IntPtr, processId As Integer
ProcessID = GetPID("CoD process name as seen in task manager without .exe")
hWnd = FindWindow(vbNullString, "Call of Duty 4")
If (hWnd = 0) Then
MsgBox("Call of Duty 4! Not Found!", MsgBoxStyle.OkOnly, "Erorr!")
End
End If
GetWindowThreadProcessId(hWnd, processId)
processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, processId)
Dim Dev As Direct3D.Device = New Direct3D.Device(processHandle)
CaptureScreenshot(Dev, "c:\Screenshott1.jpg", ImageFileFormat.Jpg)
CloseHandle(processHandle)
[/php]
I dunno if that will fix your problem seeing as I've never really worked with DirectX, but not assigning the ProcessID any value doesn't seem like a good start -.-
You'll need to change this line here:
[php]
ProcessID = GetPID("CoD process name as seen in task manager without .exe")
[/php]
Where i've put "CoD process name as seen in task manager without .exe" you'll need to do just that, I didn't know the CoD process name. Example would be for Combat Arms, the process name is "Engine" (note, don't include the exe)
Tell me if that changes anything.
Thank you, but it also did not answer
Someone fix my code s
Originally Posted by HeadHunter666
Thank you, but it also did not answer
Someone fix my code s
Post your button1_click sub procedure as it is now.
What about you start learning vb first so you can fix errors on your own?
Originally Posted by Blubb1337
What about you start learning vb first so you can fix errors on your own?
Originally Posted by HeadHunter666
Fucking stop spamming and answer my goddam question.
Originally Posted by J-Deezy
Fucking stop spamming and answer my goddam question.