Thread: dev c++

  1. #1
    Registered User code2d's Avatar
    Join Date
    Nov 2006

    dev c++

    I want to start creating a application for windows with dev c++ 5 beta (I think its 4.992). I went into charles petzold and went to the first windows program.
    #include <windows.h>
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        PSTR szCmdLine, int iCmdShow)
    static TCHAR szAppName[] = TEXT ("HelloWin") ;
    HWND hwnd ;
    MSG msg ;
    wndclass.lpfnWndProc = WndProc ;
    wndclass.cbClsExtra = 0 ;
    wndclass.cbWndExtra = 0 ;
    wndclass.hInstance = hInstance ;
    wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
    wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
    wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
    wndclass.lpszMenuName = NULL ;
    wndclass.lpszClassName = szAppName ;
    if (!RegisterClass (&wndclass))
            MessageBox (NULL, TEXT ("This program requires Windows NT!"),
                                  szAppName, MB_ICONERROR) ;
    return 0 ;
    hwnd = CreateWindow (szAppName, // window class name
                                          TEXT ("The Hello Program"), // window caption
                                          WS_OVERLAPPEDWINDOW, // window style
                                          CW_USEDEFAULT, // initial x position
                                          CW_USEDEFAULT, // initial y position
                                          CW_USEDEFAULT, // initial x size
                                          CW_USEDEFAULT, // initial y size
                                          NULL, // parent window handle
                                          NULL, // window menu handle
                                          hInstance, // program instance handle
                                          NULL) ; // creation parameters
    ShowWindow (hwnd, iCmdShow) ;
    UpdateWindow (hwnd) ;
    while (GetMessage (&msg, NULL, 0, 0))
               TranslateMessage (&msg) ;
               DispatchMessage (&msg) ;
    return msg.wParam ;
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,  LP   ARAM lParam)
            HDC hdc ;
            PAINTSTRUCT ps ;
    This code I have no idea how to get working.... I put it into a console app and it just gave me errors. What do i do to get this code working.
    thanks for any help.

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    it is NOT a console application.
    Choose another project type - don;t have a dev-c++ so cannot say how exactly they called it
    It should be someething like "Win32 Application"
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Boston, Massachusetts
    Yes, you need to select the Win32 project option.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Whats better, C-Free or Dev C++??
    By i_can_do_this in forum Tech Board
    Replies: 10
    Last Post: 07-07-2006, 04:34 AM
  2. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  3. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  4. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 07:42 PM