[CODERS ONLY] Fix for game not found

Posts 1–4 of 4 · Page 1 of 1
[CODERS ONLY] Fix for game not found
FOR HACK CREATORS ONLY

Hi guys! I got idea this morning, so I decided to search trough my source codes and I found this .
This is fix for "game not found" error.
This error usually gets reported by users that use Nosteam BO2 version.
This is universal way that will work for any BO2 version.


C#:
Code:
        public bool HandleMeJorni(string ProcessWindowName) //lolol
        {

            try
            {
                Process[] ProcList = Process.GetProcesses();
                foreach (Process proc in ProcList)
                {
                    if (proc.MainWindowTitle.Contains(ProcessWindowName))
                    {
                        pHandel = proc.Handle;
                        return true;
                    }
                }
                return false;
            
            }			
            catch (Exception ex)
            { Console.Beep(); Console.WriteLine("Window_Handle - " + ex.Message); return false; }
        }
VB.NET:
Code:
  
    Public Function Window_Handle(ProcessWindowName As String) As Boolean

	Try
		Dim ProcList As Process() = Process.GetProcesses()
		For Each proc As Process In ProcList
			If proc.MainWindowTitle.Contains(ProcessWindowName) Then
				pHandel = proc.Handle
				Return True
			End If
		Next

		Return False
	Catch ex As Exception
		Console.Beep()
		Console.WriteLine("Window_Handle - " + ex.Message)
		Return False
	End Try
End Function
This is made to be used with @Jorndel's memory class.
Thanks goes to Jorn for his memory class & original process handle.

Usage:
Code:
If(Window_Handle(---BO2 Window Name----))
{
}
Code:
If Window_Handle(---BO2 Window Name----)Then

End If

Yep. I added nice Anti C&P .
To improve your code it would be wise to do something like:
Code:
public bool HandleMeJorni(string ProcessWindowName) //lolol
        {

            try
            {
                Process[] ProcList = Process.GetProcesses();
                foreach (Process proc in ProcList)
                {
                    if (proc.MainWindowTitle.Contains(ProcessWindowName))
                    {
                        pHandel = proc.Handle;
                        return true;
                    }
                }
                return false;
            
            }			
            catch (Exception ex)
            { Console.Beep(); Console.WriteLine("Window_Handle - " + ex.Message); return false; }
        }
Just to avoid spelling and you'll have a way better chance of selecting your window without having the copyright marks etc
Quote Originally Posted by Jorndel View Post
To improve your code it would be wise to do something like:
Code:
public bool HandleMeJorni(string ProcessWindowName) //lolol
        {

            try
            {
                Process[] ProcList = Process.GetProcesses();
                foreach (Process proc in ProcList)
                {
                    if (proc.MainWindowTitle.Contains(ProcessWindowName))
                    {
                        pHandel = proc.Handle;
                        return true;
                    }
                }
                return false;
            
            }			
            catch (Exception ex)
            { Console.Beep(); Console.WriteLine("Window_Handle - " + ex.Message); return false; }
        }
Just to avoid spelling and you'll have a way better chance of selecting your window without having the copyright marks etc
Oh, thanks!
This is old code I took from "my CE".
I didn't read it or did anything to improve it, I only C&P-ed it here .
Fixed
Bump,bump, guys use this!
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us