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 8152183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:38:17+00:00 2026-06-06T15:38:17+00:00

Hello everyone, I have some confusion regarding some Win32 API data types and macros

  • 0

Hello everyone,
I have some confusion regarding some Win32 API data types and macros that we use-:

Firstly-:
Regarding the WM_NOTIFY message. The lparam contains the pointer to the NMHDR structure. So if its a pointer why is it illegal to access the NMHDR structure like this-:

(*lparam)->idFrom

I mean if its a pointer then I could just use an indirection operator to get to the structure. LPARAM is itself typedefed from LONG_PTR. Why do I have to write the code like this-:

((LPNMHDR)lparam)->idFrom

What is LPNMHDR?
LPNMHDR is typedefed in the following way-:

typedef NMHDR FAR * LPNMHDR;

FAR* is again defined in the following way-:

#define FAR _far

What is _far and why to I have to use LPNMHDR cast to access the NMHDR structure from LPARAM?

Secondly-:
What does the MAKEINTRESOURCE macro do? I have seen a lot of authors use a plain string when specifying resources to functions. For example-:

CreateDialog(hInst,"Dialog Box",
                hwnd,(DLGPROC)DialogFunc);

But in modern compilers we use-:

CreateDialog(hInst,MAKEINTRESOURCE(DIALOG_BOX),
                hwnd,(DLGPROC)DialogFunc);

I know that if we use a string identifier in the resource file instead of a number then we can omit this macro so does this macro convert a number to a string. For example does it convert 23 into “23”?? Because if it did then I would be able to use -:

CreateDialog(hInst,"23",
                hwnd,(DLGPROC)DialogFunc);

if my dialog box resource was defined with 23. But this doesn’t work.

So I want to know what is the outcome after this macro processes an identifier? How does it work? What would I have to do in order to print the value of the MAKEINTRESOURCE in a message box because I am facing problems while copying the value to a string using the the sprintf function. But I know that MAKEINTRESOURCE outputs a LPSTR because it is defined in the following way-:

#define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i))))

I have not yet found any documentation on how this macro works. The msdn states that MAKEINTRESOURCE is a macro which ‘converts an integer value to a resource type compatible with the resource-management functions‘.
Thank You.

  • 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-06-06T15:38:19+00:00Added an answer on June 6, 2026 at 3:38 pm

    lParam is not a pointer, it is an integer type parameter, so you have to cast it to the proper pointer type before using it.

    LPNMHDR is just a typedef used for historical reason. You can just as well use NMHDR*. The FAR and _far qualifiers were used with 16-bit Windows, and are just noise left over from that time.

    The MAKEINTRESOURCE is a trick used by the Windows C language interface, to simulate what an overloaded function would do in C++. This way you can call the CreateDialog with either a pointer (to string) parameter or an integer parameter. This uses knowledge that strings will never be allocated at very low addresses, so these can be reserved as an alias for the resource IDs. A rather ugly hack!

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

Sidebar

Related Questions

Hello everyone it's been some days that I use sql to make analysis and
Hello everyone. I'm using Silverlight webbrowser control, and I'm having some problems with that.
Hello everyone i have a problem I have a text $text = some and
Hello everyone I have converted a project in C# to F# that paints the
hello everyone I have some problem with understanding this piece of the code: import
Some details XAMPP 1.7.1 OS tested on vista and xp Hello everyone. I have
Hello everyone I have some problem to grab movie title with regular expression. how
Hello everyone Masters Of Web Delevopment :) I have a piece of PHP script
Hello everyone I'm trying to improve my Java skills by solving some problems from
Hello everyone I am new to blackberry and I want a textfield that scroll

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.