WINBLOWS.CPP 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #define WIN32_LEAN_AND_MEAN
  19. #include <windows.h>
  20. #include <windowsx.h>
  21. #include <stdlib.h>
  22. #include <stdio.h>
  23. #include <stdarg.h>
  24. #include "winblows.h"
  25. HINSTANCE Global_instance;
  26. LPSTR Global_commandline;
  27. int Global_commandshow;
  28. /*
  29. * WinMain - initialization, message loop
  30. */
  31. int PASCAL WinMain( HINSTANCE instance, HINSTANCE, char *command_line, int command_show)
  32. {
  33. //////MSG msg;
  34. Global_instance = instance;
  35. Global_commandline = command_line;
  36. Global_commandshow = command_show;
  37. int argc;
  38. char *argv[64];
  39. char path_to_exe[512];
  40. GetModuleFileName(instance,(char *)&path_to_exe,512);
  41. argc=1;
  42. argv[0]=path_to_exe;
  43. int command_scan=0;
  44. char command_char;
  45. do
  46. {
  47. /*
  48. ** Scan for non-space character on command line
  49. */
  50. do
  51. {
  52. command_char = *( command_line+command_scan++ );
  53. } while ( command_char==' ' );
  54. if ( command_char!=0 && command_char != 13 )
  55. {
  56. argv[argc++]=command_line+command_scan-1;
  57. /*
  58. ** Scan for space character on command line
  59. */
  60. do
  61. {
  62. command_char = *( command_line+command_scan++ );
  63. } while ( command_char!=' ' && command_char != 0 && command_char!=13);
  64. *( command_line+command_scan-1 ) = 0;
  65. }
  66. } while ( command_char != 0 && command_char != 13 && argc<20 );
  67. return(main(argc,argv));
  68. } /* WinMain */
  69. int Print_WM(UINT message,char *out)
  70. {
  71. switch(message)
  72. {
  73. case WM_NULL:
  74. sprintf(out,"WM_NULL");
  75. break;
  76. case WM_CREATE:
  77. sprintf(out,"WM_CREATE");
  78. break;
  79. case WM_DESTROY:
  80. sprintf(out,"WM_DESTROY");
  81. break;
  82. case WM_CANCELMODE:
  83. sprintf(out,"WM_CANCELMODE");
  84. break;
  85. case WM_ERASEBKGND:
  86. sprintf(out,"WM_ERASEBKGND");
  87. break;
  88. case WM_GETTEXT:
  89. sprintf(out,"WM_GETTEXT");
  90. break;
  91. case WM_QUERYOPEN:
  92. sprintf(out,"WM_QUERYOPEN");
  93. break;
  94. case WM_MOVE:
  95. sprintf(out,"WM_MOVE");
  96. break;
  97. case WM_SIZE:
  98. sprintf(out,"WM_SIZE");
  99. break;
  100. case WM_ACTIVATE:
  101. sprintf(out,"WM_ACTIVATE");
  102. break;
  103. case WM_SETFOCUS:
  104. sprintf(out,"WM_SETFOCUS");
  105. break;
  106. case WM_KILLFOCUS:
  107. sprintf(out,"WM_KILLFOCUS");
  108. break;
  109. case WM_ENABLE:
  110. sprintf(out,"WM_ENABLE");
  111. break;
  112. case WM_SETREDRAW:
  113. sprintf(out,"WM_REDRAW");
  114. break;
  115. case WM_PAINT:
  116. sprintf(out,"WM_PAINT");
  117. break;
  118. case WM_CLOSE:
  119. sprintf(out,"WM_CLOSE");
  120. break;
  121. case WM_QUIT:
  122. sprintf(out,"WM_QUIT");
  123. break;
  124. case WM_ACTIVATEAPP:
  125. sprintf(out,"WM_ACTIVATEAPP");
  126. break;
  127. case WM_SETCURSOR:
  128. sprintf(out,"WM_SETCURSOR");
  129. break;
  130. case WM_KEYDOWN:
  131. sprintf(out,"WM_KEYDOWN");
  132. break;
  133. case WM_MOUSEMOVE:
  134. sprintf(out,"WM_MOUSEMOVE");
  135. break;
  136. case WM_WINDOWPOSCHANGING:
  137. sprintf(out,"WM_WINDOWPOSCHANGING");
  138. break;
  139. case WM_WINDOWPOSCHANGED:
  140. sprintf(out,"WM_WINDOWPOSCHANGED");
  141. break;
  142. case WM_DISPLAYCHANGE:
  143. sprintf(out,"WM_DISPLAYCHANGE");
  144. break;
  145. case WM_NCPAINT:
  146. sprintf(out,"WM_NCPAINT");
  147. break;
  148. case WM_PALETTEISCHANGING:
  149. sprintf(out,"WM_PALETTEISCHANGING");
  150. break;
  151. case WM_PALETTECHANGED:
  152. sprintf(out,"WM_PALETTECHANGED");
  153. break;
  154. case WM_NCACTIVATE:
  155. sprintf(out,"WM_NCACTIVATE");
  156. break;
  157. case WM_NCCALCSIZE:
  158. sprintf(out,"WM_NCCALCSIZE");
  159. break;
  160. case WM_SYSCOMMAND:
  161. sprintf(out,"WM_SYSCOMMAND");
  162. break;
  163. default:
  164. sprintf(out,"? UNKNOWN ?");
  165. return(-1);
  166. }
  167. return(0);
  168. }