Générateur de code API windows

Générateur de code API windows - C++ - Programmation

Marsh Posté le 18-01-2004 à 23:28:48    

Bonjour
 
Je ne me suis remis qu'au C/C++ que recemment et je me retrouve un peu newb.
 
je voudrais savoir si il exites des programmes d'édition de fenetre windows genre borland c++ builder qui génerent le code des fenetres windows, mais gratuit et 100% à la norme de sorte que je puisse l'utiliser avec Dev C++.
 
Ce serait mieux pour moi je n'ai pas trop envie de d'apprendre ou de réapprendre comment on édite une fenetre en C++ et ça me permettrai de + me concentrer sur l'apprentissage d'OpenGL
 
d'avance, merci.

Reply

Marsh Posté le 18-01-2004 à 23:28:48   

Reply

Marsh Posté le 19-01-2004 à 00:14:46    

j'avais fait ça à l'époque si ça peut t'aider.
 

Code :
  1. //---------------------------------------------------------------------------
  2. #include <windows.h>
  3. #pragma hdrstop
  4. //---------------------------------------------------------------------------
  5. #define CLASS_NAME  "zMaPremiereWinAppNative"
  6. #define WINDOW_NAME "Ma Premiere Application Windows Native"
  7. #define TOP          0
  8. #define LEFT         0
  9. #define WIDTH        640
  10. #define HEIGHT       480
  11. HINSTANCE hInst ;
  12. HWND hwndMain ;
  13. LRESULT CALLBACK WndProcMain(HWND hwnd, // handle of window
  14.                             UINT uMsg, // message identifier
  15.                             WPARAM wParam, // first message parameter
  16.                             LPARAM lParam)
  17.     {
  18.     switch (uMsg)
  19.         {
  20.         case WM_COMMAND:
  21.             break ;
  22.         case WM_CREATE:
  23.             break ;
  24.         case WM_DESTROY :
  25.               PostQuitMessage(0);
  26.               break;
  27.       default :
  28.             return( DefWindowProc( hwnd, uMsg, wParam, lParam ) );
  29.         }
  30.     return 0L ;
  31.     }
  32. #pragma argsused
  33. WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  34.     {
  35.     LPVOID errMsg ;
  36.     WNDCLASS wc ;
  37.     MSG msg;
  38.     if (!hPrevInstance)
  39.         {
  40.         wc.style = 0 ;
  41.         wc.lpfnWndProc = ( WNDPROC ) WndProcMain ;
  42.         wc.cbClsExtra = 0;
  43.         wc.cbWndExtra = 0;
  44.         wc.hInstance = hInstance;
  45.         wc.hIcon = LoadIcon((HINSTANCE) NULL,
  46.             IDI_APPLICATION);
  47.         wc.hCursor = LoadCursor((HINSTANCE) NULL,
  48.             IDC_ARROW);
  49.         wc.hbrBackground = GetStockObject(WHITE_BRUSH);
  50.         wc.lpszClassName = CLASS_NAME ;
  51.         if (!RegisterClass(&wc))
  52.             return FALSE;
  53.     }
  54.     hInst = hInstance ;
  55.     hwndMain = CreateWindow(CLASS_NAME,
  56.                             WINDOW_NAME,
  57.                             WS_OVERLAPPEDWINDOW,
  58.                             TOP,    // CW_USEDEFAULT
  59.                             LEFT,   // 0
  60.                             WIDTH,  // CW_USEDEFAULT
  61.                             HEIGHT, // 0
  62.                             NULL,
  63.                             NULL,
  64.                             hInst,
  65.                             NULL) ;
  66.     if (!hwndMain)
  67.         {
  68.         FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
  69.                        NULL,
  70.                        GetLastError(),
  71.                        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
  72.                        (LPTSTR) &errMsg,
  73.                        0,
  74.                        NULL);
  75.         MessageBox( NULL, errMsg, "GetLastError", MB_OK|MB_ICONINFORMATION );
  76.         LocalFree( errMsg );
  77.         }
  78.     ShowWindow(hwndMain, nCmdShow) ;
  79.     UpdateWindow(hwndMain) ;
  80.     while (GetMessage(&msg, NULL, 0, 0))
  81.         {
  82.         TranslateMessage(&msg);
  83.         DispatchMessage(&msg);
  84.         }
  85.     return msg.wParam ;
  86.     }

Reply

Marsh Posté le 19-01-2004 à 00:59:35    

merci :)
 
Je vais essayer de me faire la main avec.

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed