From 6f52482f5fdef4f4a9021cfc4e68480fc5068941 Mon Sep 17 00:00:00 2001 From: Nicco Kunzmann Date: Thu, 26 Mar 2015 20:33:39 +0100 Subject: [PATCH] added exe cpp file to generate standalone --- .gitignore | 2 ++ standalone/DHCPGui.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 standalone/DHCPGui.cpp diff --git a/.gitignore b/.gitignore index b40bdc1..d3d5e4d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,5 @@ Temporary Items *.pyc __pycache__ ips.csv +/releases +/standalone/DHCPGui.exe diff --git a/standalone/DHCPGui.cpp b/standalone/DHCPGui.cpp new file mode 100644 index 0000000..0f4804a --- /dev/null +++ b/standalone/DHCPGui.cpp @@ -0,0 +1,44 @@ + +// based on https://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx + +#include +#include +#include + +int _tmain( int argc, TCHAR *argv[] ) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + TCHAR command[] = "\"Portable Python 3\\App\\pythonw.exe\" \"dhcpgui.pyw\""; + TCHAR directory[] = "server"; + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + + // Start the child process. + if( !CreateProcess( NULL, // No module name (use command line) + command, // Command line + NULL, // Process handle not inheritable + NULL, // Thread handle not inheritable + FALSE, // Set handle inheritance to FALSE + 0, // No creation flags + NULL, // Use parent's environment block + directory, // Use parent's starting directory + &si, // Pointer to STARTUPINFO structure + &pi ) // Pointer to PROCESS_INFORMATION structure + ) + { + printf( "CreateProcess failed (%d).\n", GetLastError() ); + return 1; + } +/* + // Wait until child process exits. + WaitForSingleObject( pi.hProcess, INFINITE ); + + // Close process and thread handles. + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); +*/ + return 0; +}