Can someone explain why it wont find the window?? I did everything right, Im pretty sure of it :S Yet it just wont find it.
EDIT: Admin delete.. I think I just figured it out..
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
Form1::Visible = false;
Query ^ F = gcnew Query(); //<-- Form2
//F->Show();
F->ShowDialog();
System::String^ StringF = F->textBox1->Text;
IntPtr ptr2 = System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(StringF);
HWND Simba = FindWindowW(0, (LPCWSTR)ptr2.ToPointer());
if(Simba != NULL)
{
MessageBox::Show("Found Script");
}
else
{
MessageBox::Show("Cannot Find Window");
}
System::Runtime::InteropServices::Marshal::FreeHGlobal(ptr2);
EDIT (MY FIX):
HWND Simba = FindWindowW(0, (LPCWSTR)ptr2.ToPointer());
//changed to
HWND Simba = FindWindow(0, (LPCSTR)ptr2.ToPointer());