Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5972355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:38:46+00:00 2026-05-22T20:38:46+00:00

I was playing with visual studio’s windows forms and the example code had this:

  • 0

I was playing with visual studio’s windows forms and the example code had this:

INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    /*code cut*/
    case WM_INITDIALOG:
        return (INT_PTR)TRUE;
    break;

While my other handler function looks like this:

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    /*code cut*/
    return 0; // no magical casting or anything, just plain int

I have a clue that in WndProc() when i do a return 0; it means the message wont get handled by the default message handler? but if you do return 1; it would handle with default handler?

But what is the point of return (INT_PTR)TRUE; ? and is it safe to use plain return 0; style there? i tried to compile and it works with just plain integer values too.

Also, im not sure when i should use which of the values, the example code had this:

EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;

But what is the point of the return (INT_PTR)TRUE; there? I changed it to FALSE but couldnt see any difference in functionality.

So, im not sure what this is doing, could anyone clear my mind on this, when should i use return 1 and when should i use return 0, and when should i use something else (if i should) ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:38:47+00:00Added an answer on May 22, 2026 at 8:38 pm

    The first piece of code is a DialogProc — quoting the relevant docs:

    Return Value
    Type: INT_PTR
    Typically, the dialog box procedure should return TRUE if it processed the message, and FALSE if it did not. If the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message.

    The second piece of code is a WindowProc — quoting the relevant docs:

    Return Value
    Type: LRESULT
    The return value is the result of the message processing and depends on the message sent.

    So, that /*code cut*/ part is critically relevant, because which return value you want depends entirely on which message is being handled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm playing about with an addin to Visual Studio 2005 that calls an external
I have been playing with the Command Window in Visual Studio (View->Other Windows->Command Window).
Does visual studio 2010 unlimited modeling project do reverse engineering? How about code generation
I've just started playing with domain-specific tools development, and I'm playing with Visual Studio
I have been playing around with Visual Studio 2010 over the past few days
Whilst playing around with resources in my visual studio 10 project, I came across
I was playing around with F# (Visual Studio 2010 beta 1), and I wrote
I've been playing with the RC of Visual Studio 2010, trying to set it
I was playing around with the idea of using Visual Studio's < include >
I just upgraded to Visual Studio 2010, and I am playing around with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.