Follow this Tutorial: http://villavu.com/vb/showthread.php?t=47141
But instead, use the following code for Simba:
C++ Code:
#include <Windows.h>#include <iostream>#include <vector>#include <sstream>std
::string FormTitle
= "Notepad"; //Change this to your Form Name.std
::string SimbaPath
= "Simba/Simba.exe";std
::string ScriptPath
= "ScriptToRun.simba"; //Change this.DWORD FormProcessID
= 0; //Do not touch this variable.template
<typename T
> inline std
::string ToString
(T Type
){std
::stringstream SS
; SS
<<Type
; return SS.
str();}std
::string CreateCommandLine
(std
::string SimbaPath
, std
::string ScriptPath
){ return SimbaPath
+ " -o " + "\"" + ScriptPath
+ "\" -r";}int Pos
(std
::string Needle
, std
::string Haystack
, int StartPos
){ return Haystack.
find(Needle
, StartPos
);}std
::string LowerCase
(std
::string Str
){ for (size_t I
= 0; I
< Str.
length(); I
++) { Str
[I
] = tolower(Str
[I
]); } return Str
;}bool RunApplication
(std
::string ApplicationName
, std
::string ApplicationArguments
, bool WaitInputIdle
){ bool Result
= false; STARTUPINFO siStartupInfo
; PROCESS_INFORMATION piProcessInfo
; std
::vector<char
> Arguments
(ApplicationArguments.
begin(), ApplicationArguments.
end() + 1); //strcpy(Arguments, ApplicationArguments.c_str()); memset(&siStartupInfo
, 0, sizeof(siStartupInfo
)); memset(&piProcessInfo
, 0, sizeof(piProcessInfo
)); if (CreateProcess
(ApplicationName.
empty() ? NULL
: ApplicationName.
c_str(), &Arguments
[0], 0, 0, false, CREATE_DEFAULT_ERROR_MODE
, 0, 0, &siStartupInfo
, &piProcessInfo
) != false) Result
= true; FormProcessID
= piProcessInfo.
dwProcessId; if (WaitInputIdle
) { Result
= false; if (WaitForInputIdle
(piProcessInfo.
hProcess, 10000) == 0) Result
= true; } CloseHandle
(piProcessInfo.
hThread); CloseHandle
(piProcessInfo.
hProcess); return Result
;}BOOL CALLBACK WorkerProc
(HWND Hwnd
, LPARAM lParam
){ char Buffer
[256] = {0}; GetWindowText
(Hwnd
, Buffer
, 256); if(Pos
(LowerCase
(FormTitle
), LowerCase
(Buffer
), 0) != -1) { *(reinterpret_cast
<HWND
*>(lParam
)) = Hwnd
; return FALSE
; } return TRUE
;}bool HideIDE
(void){ HWND Blank
= 0; HWND
* Hwnd
= &Blank
; EnumWindows
(&WorkerProc
, reinterpret_cast
<LPARAM
>(Hwnd
)); return ShowWindow
(*Hwnd
, SW_HIDE
);}bool FindForm
(){ HWND Blank
= 0; HWND
* Hwnd
= &Blank
; EnumWindows
(&WorkerProc
, reinterpret_cast
<LPARAM
>(Hwnd
)); return (*Hwnd
!= 0);}int main
(){ RunApplication
(std
::string(), CreateCommandLine
(SimbaPath.
c_str(), ScriptPath.
c_str()), true); while(!HideIDE
()) { Sleep
(2); } while (FindForm
()) { Sleep
(2000); } std
::string KillPIDInfo
= "TASKKILL /PID " + ToString
(FormProcessID
) + " /T"; system(KillPIDInfo.
c_str());}