@@ -3,7 +3,10 @@
#include "Function.h"
//Send
-bool SendCommand(WCHAR command)
+bool SendCommand(const char* command)
{
- return false;
+ DWORD written;
+ if (WriteFile(UIw_key, command, strlen(command), &written, NULL) != 0)
+ return true;
+ else return false;
}
@@ -24,7 +24,12 @@ int Err(LPCTSTR title, LPCTSTR message)
if (GetLastError() != 0)
- MessageBox(NULL, message, title, MB_ICONERROR);
+ DWORD error = GetLastError();
+ LPWSTR errorMsg = (LPWSTR)"unknown";
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL, error, 0, errorMsg, 256, NULL);
+ MessageBox(NULL, message, errorMsg, MB_ICONERROR);
return 1;
return 0;
@@ -41,14 +41,8 @@ void StartBDS()
L"bedrock_server.exe",
NULL, NULL, NULL, TRUE, NULL, NULL, NULL, &si, &pi))
- hBDS = NULL;
- Err(hBDS, TITLE,
- _T("Failed to find BDS window"));
- while (bool condition=0)
- {
- }
else {
Err(TITLE, _T("Failed to send command to BDS!"));
CloseHandle();