Mercurial > dwindows
annotate winmain.c @ 1483:73f2ad84d4ec
Fixed OS/2 windows being shown when setting position/size.
Moved the OS/2 specific DW_OS2_NEW_WINDOW flag into os2/dw.c.
Deprecated and essentially removed DW_FCF_SHELLPOSITION and
DW_FCF_NOBYTEALIGN. These were OS/2 specific and are set
automatically now... FCF_SHELLPOSITION was causing the
positioning problems that necessitated the window being shown
to set the size and position. Right now SHELLPOSITION isn't
used at all... causing shell positioning to not work.
I hope to have a way to allow shell positioning to work again
soon but the idea I had to do this did not work.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 23 Dec 2011 15:58:13 +0000 |
parents | bf42d08d72d7 |
children | 32b5fba0b00a |
rev | line source |
---|---|
3 | 1 /* Dynamic Windows stub file to allow Win32 applications |
2 * to use the main() entry point instead of WinMain(). | |
3 */ | |
4 | |
5 #include <windows.h> | |
6 #include <stdlib.h> | |
7 #include <string.h> | |
8 #include <stdio.h> | |
9 #include <process.h> | |
10 | |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
11 #ifndef NODW |
3 | 12 void Win32_Set_Instance(HINSTANCE hInstance); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
13 #endif |
3 | 14 |
15 char **_convertargs(int *count, char *start, HINSTANCE DWInstance) | |
16 { | |
17 char *tmp, *argstart, **argv; | |
18 int loc = 0, inquotes = 0; | |
19 | |
20 (*count) = 1; | |
21 | |
22 tmp = start; | |
23 | |
24 /* Count the number of entries */ | |
25 if(*start) | |
26 { | |
27 (*count)++; | |
28 | |
29 while(*tmp) | |
30 { | |
31 if(*tmp == '"' && inquotes) | |
32 inquotes = 0; | |
33 else if(*tmp == '"' && !inquotes) | |
34 inquotes = 1; | |
35 else if(*tmp == ' ' && !inquotes) | |
36 { | |
37 /* Push past any white space */ | |
38 while(*(tmp+1) == ' ') | |
39 tmp++; | |
40 /* If we aren't at the end of the command | |
41 * line increment the count. | |
42 */ | |
43 if(*(tmp+1)) | |
44 (*count)++; | |
45 } | |
46 tmp++; | |
47 } | |
48 } | |
49 | |
50 argv = (char **)malloc(sizeof(char *) * ((*count)+1)); | |
51 argv[0] = malloc(260); | |
52 GetModuleFileName(DWInstance, argv[0], 260); | |
53 | |
54 argstart = tmp = start; | |
55 | |
56 if(*start) | |
57 { | |
58 loc = 1; | |
59 | |
60 while(*tmp) | |
61 { | |
62 if(*tmp == '"' && inquotes) | |
63 { | |
64 *tmp = 0; | |
65 inquotes = 0; | |
66 } | |
67 else if(*tmp == '"' && !inquotes) | |
68 { | |
69 argstart = tmp+1; | |
70 inquotes = 1; | |
71 } | |
72 else if(*tmp == ' ' && !inquotes) | |
73 { | |
74 *tmp = 0; | |
75 argv[loc] = strdup(argstart); | |
76 | |
77 /* Push past any white space */ | |
78 while(*(tmp+1) == ' ') | |
79 tmp++; | |
80 | |
81 /* Move the start pointer */ | |
82 argstart = tmp+1; | |
83 | |
84 /* If we aren't at the end of the command | |
85 * line increment the count. | |
86 */ | |
87 if(*(tmp+1)) | |
88 loc++; | |
89 } | |
90 tmp++; | |
91 } | |
92 if(*argstart) | |
93 argv[loc] = strdup(argstart); | |
94 } | |
95 argv[loc+1] = NULL; | |
96 return argv; | |
97 } | |
98 | |
99 /* Ok this is a really big hack but what the hell ;) */ | |
100 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) | |
101 { | |
102 char **argv; | |
103 int argc; | |
104 | |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
105 #ifndef NODW |
3 | 106 Win32_Set_Instance(hInstance); |
49
bf42d08d72d7
Added font text extent querying code, and made it so winmain.c can be used
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
3
diff
changeset
|
107 #endif |
3 | 108 |
109 argv = _convertargs(&argc, lpCmdLine, hInstance); | |
110 | |
111 return main(argc, argv); | |
112 } |