CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Guest

    LRESULT CALLBACK

    What is meant by "LRESULT CALLBACK" in windows procedure. thanks in advance

    LRESULT CALLBACK WindProc(....)

    Tuf


  2. #2
    Join Date
    Nov 1999
    Location
    Dresden / Germoney
    Posts
    1,402

    Re: LRESULT CALLBACK

    LRESULT & CALLBACK are two macros to hide platform specifics.

    LRESULT is the return value - actually a long.

    CALLBACK is the calling convention for functions that will be called from inside a windows functions (calling convention is in which order parameters are put on stack, how your function name is "beautified", and who cleans up the stack)



    I Might guess that under Win32, CALLBACK evaluates to __stdcall, but this is but a guess.

    The reason in: in a build for e.g. an Alpha platform, these macros might evaluate to something different (this is handled in the windows headers), but you don't have to modify your code

    Use:

    declare & implement your func using

    LRESULT CALLBACK WndProc(...)

    Peter


  3. #3
    Guest

    Re: LRESULT CALLBACK

    what windows do when windproc returns 0 or 1, I mean what is the differnence between returning 0 and 1, thanks


  4. #4
    Join Date
    Nov 1999
    Location
    Dresden / Germoney
    Posts
    1,402

    Re: WndProc Return value

    The return value depends on the message you handle. Check the online documentation for the message. With many messages, the return value is ignored; others require a true/false; (e.g. WM_NOTIFY/LVN_ENDLABELEDIT: return true if you accept the change, or false to restore the previous value) Other messages require a HWND, or a count to be returned.

    In general, pass unhandled messages to the default window procedure. (DefWindowProc(..))In most cases, you should also pass Messages to the default handler, where you "added" some behavior.


    MyWndProc
    {
    switch (uMsg) {
    case WM_FOO : /* your msg handling here */; break;
    case WM_BAR : return barActive ? 1 : 0; // msg that requires return value, not passed to default handler
    }
    return DefWndProc(uMsg, ...);
    }




    Peter



  5. #5
    Join Date
    Jan 2013
    Posts
    1

    Re: LRESULT CALLBACK

    How does LRESULT CALLBACK work in an windows application? What does it do? It's job?

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured