]> git.saurik.com Git - wxWidgets.git/blob - src/msw/winestub.c
Copied XPM files to new names to avoid conflict when compilign with VC++ project...
[wxWidgets.git] / src / msw / winestub.c
1 /****************************************************************************
2 * Name: winestub.cpp
3 * Purpose: wxWINE module mapping main() to WinMain()
4 * Author: Robert Roebling
5 * Created: 04/01/98
6 * RCS-ID: $Id$
7 * Copyright: (c) Robert Roebling
8 * Licence: wxWindows Licence
9 *****************************************************************************/
10
11 #include <string.h>
12 #include "winuser.h"
13 #include "xmalloc.h"
14
15 extern int PASCAL WinMain( HINSTANCE, HINSTANCE, LPSTR, int );
16 extern HINSTANCE MAIN_WinelibInit( int *argc, char *argv[] );
17
18 /* Most Windows C/C++ compilers use something like this to */
19 /* access argc and argv globally: */
20 int _ARGC;
21 char **_ARGV;
22
23 int main( int argc, char *argv [] )
24 {
25 HINSTANCE hInstance;
26 LPSTR lpszCmdParam;
27 int i, len = 0;
28 _ARGC = argc;
29 _ARGV = (char **)argv;
30
31 if (!(hInstance = MAIN_WinelibInit( &argc, argv ))) return 0;
32
33 /* Alloc szCmdParam */
34 for (i = 1; i < argc; i++) len += strlen(argv[i]) + 1;
35 lpszCmdParam = (LPSTR) xmalloc(len + 1);
36 /* Concatenate arguments */
37 if (argc > 1) strcpy(lpszCmdParam, argv[1]);
38 else lpszCmdParam[0] = '\0';
39 for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]);
40
41 return WinMain (hInstance, /* hInstance */
42 0, /* hPrevInstance */
43 lpszCmdParam, /* lpszCmdParam */
44 SW_NORMAL); /* nCmdShow */
45 }