new to windows programming

This is a discussion on new to windows programming within the Windows Programming forums, part of the Platform Specific Boards category; hi everyone, i'm new to this and i got a question which of the 3 options should i choose in ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    479

    new to windows programming

    hi everyone, i'm new to this and i got a question

    which of the 3 options should i choose in msvc++
    after i 've chosen new/win32 application.

    should i choose

    "an emty project"
    "simple win32 application"
    or "typical hello world" what's this #%&%#

    i'm back in stone age!!???? aplication.

    i've tried them all and get the following error

    fatal error C1010: unexpected end of file while looking for precompiled header directive

    thanx.

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    in the menu go to Project -> Settings -> click on the C/C++ tab -> in Catagory Select 'Precompiled Headers', click the 'automatic use of precompiled headers' or 'not using precompiled headers' radio button.

    and the error will be gone.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    thanks no-one the error was fixed but i got 2 other ones

    i'll show u the code so u can see whats going on


    Code:
    #include <windows.h>
    
    
    LRESULT CALLBACK WindowProcedure
        (HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam);
    
    class WinClass
    {
    public:
        WinClass (WNDPROC winProc, char const * className, HINSTANCE hInst);
        void Register ()
        {
            ::RegisterClass (&_class);
        }
    private:
        WNDCLASS _class;
    };
    
    WinClass::WinClass
        (WNDPROC winProc, char const * className, HINSTANCE hInst)
    {
        _class.style = 0;
        _class.lpfnWndProc = winProc; // window procedure: mandatory
        _class.cbClsExtra = 0;
        _class.cbWndExtra = 0;
        _class.hInstance = hInst;         // owner of the class: mandatory
        _class.hIcon = 0;
        _class.hCursor = ::LoadCursor (0, IDC_ARROW); // optional
        _class.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); // optional
        _class.lpszMenuName = 0;
        _class.lpszClassName = className; // mandatory
    }
    
    
    
    class WinMaker
    {
    public:
        WinMaker (): _hwnd (0) {}
        WinMaker (char const * caption, 
                  char const * className,
                  HINSTANCE hInstance);
        void Show (int cmdShow)
        {
            ::ShowWindow (_hwnd, cmdShow);
            ::UpdateWindow (_hwnd);
        }
    protected:
        HWND _hwnd;
    };
    
    WinMaker::WinMaker (char const * caption, 
                        char const * className,
                        HINSTANCE hInstance)
    {
        _hwnd = ::CreateWindow (
            className,            // name of a registered window class
            caption,              // window caption
            WS_OVERLAPPEDWINDOW,  // window style
            CW_USEDEFAULT,        // x position
            CW_USEDEFAULT,        // y position
            CW_USEDEFAULT,        // witdh
            CW_USEDEFAULT,        // height
            0,                    // handle to parent window
            0,                    // handle to menu
            hInstance,            // application instance
            0);                   // window creation data
    }
    
    
    int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
                char * cmdParam, int cmdShow)
    {
        char className [] = "Winnie";
    
        WinClass winClass (WindowProcedure, className, hInst);
        winClass.Register ();
    
        WinMaker win ("Hello Windows!", className, hInst);
        win.Show (cmdShow);
    
        MSG  msg;
        int status;
    
        while ((status = ::GetMessage (& msg, 0, 0, 0)) != 0)
        {
            if (status == -1)
                return -1;
            ::DispatchMessage (& msg);
        }
    
        return msg.wParam;
    }
    also must i do that thing with the precompilers everytime
    i want to do something like this?

    here are the new errors:

    oooo.obj : error LNK2001: unresolved external symbol "long __stdcall WindowProcedure(struct HWND__ *,unsigned int,unsigned int,long)" (?WindowProcedure@@YGJPAUHWND__@@IIJ@Z)

    and

    oooo.exe : fatal error LNK1120: 1 unresolved externals
    error executing link.exe.



    thanks in advance
    Last edited by pode; 08-01-2002 at 05:27 PM.

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    i've seen that code somewhere before. did you download that off a website?
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    no i copied it from the site (its a tutorial site)
    here it is www.relisoft.com/win32/winnie.html

    why?

    do u see any errors?

  6. #6
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    you never defined WindowProcedure()

    add this to the bottom of the source.

    Code:
    LRESULT CALLBACK WindowProcedure(HWND hwnd, unsigned int message, WPARAM wParam, LPARAM lParam)
    {
        switch(message)
        {
            // handle messages here.
    
        }
        return DefWindowProc(hwnd,message,wParam,lParam);
    }
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    i'm so stupid


    thanx again no-one!

    btw u did'nt answer my question about if i must do the thing in settings with the precompilers

  8. #8
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    >u did'nt answer my question about if i must do the thing in settings with the precompilers

    you mean turning off the precompiled headers?

    as far as i know you have to do it every time...
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  9. #9
    Registered User
    Join Date
    Jul 2002
    Posts
    273
    with the "empty project" option you don't need to turn them off. For some reason, procompiled header files are not a default option for that. go figure
    always looking, make an offer. get me out of this place.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows 98/2000 programming in Windows XP
    By Bill83 in forum Windows Programming
    Replies: 3
    Last Post: 07-22-2005, 03:16 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 06:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 03:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 01:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 06:31 PM

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