من این رو توی یک dll استفاده کردم (dynamic) ولی موقع استفاده چیزی اجرا نمی کنه!!!! چرا؟!
#include <Windows.h>
#include <stdio.h>
void start(LPCSTR lpApplicationName,LPSTR Params)
{
// additional information
STARTUPINFOA si;
PROCESS_INFORMATION pi;
// set the size of the structures
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
// start the program up
CreateProcessA
(
lpApplicationName, // the path
Params, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
CREATE_NEW_CONSOLE, // Opens file in a separate console
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi // Pointer to PROCESS_INFORMATION structure
);
// Close process and thread handles.
// CloseHandle(pi.hProcess);
// CloseHandle(pi.hThread);
}
استفاده:
#include "Explore.h"
int main() {
start("Explorer.exe",".");
//getchar();
return 0;
}