1 |
joko |
1.1 |
/* $Id: prime.c,v 1.13 2006/05/13 18:53:54 joko Exp $ */ |
2 |
|
|
|
3 |
|
|
#include <stdlib.h> |
4 |
|
|
#include <errno.h> |
5 |
joko |
1.2 |
#include <windows.h> |
6 |
|
|
|
7 |
|
|
#define BOOL int |
8 |
|
|
#define TRUE 1 |
9 |
|
|
#define FALSE 0 |
10 |
joko |
1.1 |
|
11 |
|
|
int main(int argc, char * argv[]) { |
12 |
|
|
if (argc == 1) { |
13 |
joko |
1.2 |
//printf("No arguments given."); |
14 |
|
|
//exit(EXIT_FAILURE); |
15 |
|
|
char filename[255] = "abc\0"; |
16 |
|
|
BOOL background = 0; |
17 |
|
|
start_process(filename, background); |
18 |
joko |
1.1 |
} |
19 |
|
|
} |
20 |
joko |
1.2 |
|
21 |
|
|
BOOL start_process(char *filename[], BOOL background) { |
22 |
|
|
|
23 |
|
|
STARTUPINFO si; |
24 |
|
|
PROCESS_INFORMATION pi; |
25 |
|
|
|
26 |
|
|
ZeroMemory(&si,sizeof(si)); |
27 |
|
|
si.cb=sizeof(STARTUPINFO); |
28 |
|
|
|
29 |
|
|
ZeroMemory(&pi,sizeof(pi)); |
30 |
|
|
//pi.cb=sizeof(PROCESS_INFORMATION); |
31 |
|
|
|
32 |
|
|
CreateProcess( |
33 |
|
|
NULL, "notepad.exe", |
34 |
|
|
NULL, NULL, FALSE, 0, |
35 |
|
|
NULL, NULL, |
36 |
|
|
&si, |
37 |
|
|
&pi |
38 |
|
|
); |
39 |
|
|
|
40 |
|
|
} |