⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 javaloader.cpp

📁 发布java应用程序的同时发布jdk
💻 CPP
字号:
#include <afxwin.h>
int __stdcall WinMain( HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine,
    int nCmdShow )
{
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
 
    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory(&pi, sizeof(pi) );
 
    // Start the child process. 
    if( !CreateProcess( "jre\\bin\\javaw.exe",//执行的程序名
                        "jre\\bin\\javaw.exe -jar MyApp.jar", // 带参数的执行程序
            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. 
            NULL,             // Use parent's starting directory. 
            &si,              // Pointer to STARTUPINFO structure.
            &pi)             // Pointer to PROCESS_INFORMATION structure.
    ) 
    {
            //AfxMessageBox("应用程序启动失败!");
		return 0;
    }
 
    // Wait until child process exits.
    WaitForSingleObject(pi.hProcess, INFINITE );
 
    // Close process and thread handles. 
    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );
	return 0;
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -