Run another program with parameters

Hi,

how can I run another program that is in same folder with parameters? like this:

example.exe -parameter

I want to make a launcher that will run game with defined parameter, thanks!
nice, thanks, but now I have another problem, I have PowerISO, and it's opening that file in virtual mechanic, how can I make it open as normal program?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <Windows.h>
#include "resource.h"

#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

BOOL CALLBACK MainDlgProc(HWND hMain, UINT msg, WPARAM wParam, LPARAM lParam);

#define MY_WM_INITDIALOG (WM_USER + 1)

INT WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR lpCmdLine, INT nShowCmd)
{
	UNREFERENCED_PARAMETER(hPrevInst);
	UNREFERENCED_PARAMETER(lpCmdLine);

	WNDCLASSEX wClass;
	ZeroMemory(&wClass,sizeof(WNDCLASSEX));
	wClass.cbClsExtra=0;
	wClass.cbSize=sizeof(WNDCLASSEX);
	wClass.cbWndExtra=DLGWINDOWEXTRA;
	wClass.hbrBackground=(HBRUSH)(COLOR_BTNFACE + 1);
	wClass.hCursor=LoadCursor(NULL,IDC_ARROW);
	wClass.hIcon=NULL;
	wClass.hIconSm=NULL;
	wClass.hInstance=hInst;
	wClass.lpfnWndProc=(WNDPROC)MainDlgProc;
	wClass.lpszClassName="Window Class";
	wClass.lpszMenuName=NULL;
	wClass.style=CS_HREDRAW | CS_VREDRAW;

	if(!RegisterClassEx(&wClass))
	{
		int nResult = GetLastError();
		MessageBox(NULL, "Window Class Creation Failed!", NULL, MB_ICONERROR | MB_OK);
	}

	HWND hWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_CHAT1), NULL, NULL);

	if(!hWnd)
	{
		int nResult = GetLastError();
		MessageBox(NULL, "Dialog Creation Failed!", NULL, MB_ICONERROR | MB_OK);
	}

	MSG msg;
	ZeroMemory(&msg,sizeof(MSG));

	while(GetMessage(&msg, NULL, 0, 0) == TRUE)
	{
		if(!IsDialogMessage(hWnd, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	return msg.wParam;
}

BOOL CALLBACK MainDlgProc(HWND hMain, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_DESTROY:
		{
			PostQuitMessage(0);
			return 0;
		}
		break;
	case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{
			case IDC_BUTTON1:
				{
					HINSTANCE hInst = ShellExecute(0,                           
                                   "open",                      // Operation to perform
                                   "bin32\\aion.bin",  // Application name
                                   " -ip:93.99.191.224 -port:2106 -cc:1 -noauthgg -noweb -lang:enu",           // Additional parameters
                                   0,                           // Default directory
                                   SW_SHOW);
				}
			}
			break;
		}
	}
	return DefWindowProc(hMain, msg, wParam, lParam);
}
Topic archived. No new replies allowed.