dev c++

This is a discussion on dev c++ within the Windows Programming forums, part of the Platform Specific Boards category; I want to start creating a application for windows with dev c++ 5 beta (I think its 4.992). I went ...

  1. #1
    Registered User code2d's Avatar
    Join Date
    Nov 2006
    Location
    Canada
    Posts
    87

    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.
    Code:
    #include <windows.h>
    
    LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
    
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        PSTR szCmdLine, int iCmdShow)
    {
    static TCHAR szAppName[] = TEXT ("HelloWin") ;
    HWND hwnd ;
    MSG msg ;
    WNDCLASS wndclass ;
    wndclass.style = CS_HREDRAW | CS_VREDRAW ;
    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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    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"
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    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, 12:05 AM
  3. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 07: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, 06:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21