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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T19:44:03+00:00 2026-05-16T19:44:03+00:00

This is the code I have: HWND WebformCreate(HWND hParent, UINT id) { return CreateWindowEx(0,

  • 0

This is the code I have:

HWND WebformCreate(HWND hParent, UINT id)
{
    return CreateWindowEx(0, WEBFORM_CLASS, _T("about:blank"),
        WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, 0, 0, 100, 100, hParent,
        (HMENU)id, GetModuleHandle(NULL), 0);
}

This is the warning I get:

warning C4312: 'type cast' : conversion from 'UINT' to 'HMENU' of greater size

These are the questions I have:

  1. Why does the compiler think it’s a bad idea to cast to a bigger type?
  2. What’s the best way to get rid of the warning? (I don’t want to disable it.)
  3. Doing a double type cast like this: (HMENU)(UINT_PTR)id gets rid of the warning. Why/how?
  4. Disabling “Detect 64-bit Portability Issues” (Wp64) also gets rid of the warning. Why is Wp64 deprecated? Should I have it on?
  • 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-16T19:44:04+00:00Added an answer on May 16, 2026 at 7:44 pm

    You’re casting a 32bit UINT to a 64bit pointer. That’s suicide – you’re trying to point to something but forgot half it’s location! You absolutely MUST take a UINT_PTR. When you cast a pointer to an int, the behaviour is only OK if the int has the same size as the pointer. Else, it’s the end of your application’s runtime courtesy of an access violation.

    Edit:
    Why does the compiler think it’s a bad idea to cast to a bigger type?
    R.E. above

    What’s the best way to get rid of the warning? (I don’t want to disable it.)
    Fix the problem. This code will almost certainly instacrash.

    Doing a double type cast like this: (HMENU)(UINT_PTR)id gets rid of the warning. Why/how?
    It happens because casting a UINT to a UINT_PTR is perfectly valid- UINT_PTR is just an integral type, there’s no loss of data.

    Disabling “Detect 64-bit Portability Issues” (Wp64) also gets rid of the warning. Why is Wp64 deprecated? Should I have it on?
    It’s deprecated because, actually, I can’t quite remember why. I think it warns a little too readily. But for the basic “Don’t cast integral types and pointers”, you should definitely leave it on.

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

Sidebar

Related Questions

I am in vb6, behing a button i have put this code: hwnd is
I wrote this code I have these errors Cannot implicitly convert type x.Program.TreeNode' to
So I have this code for these Constructors of the Weapon class: Weapon(const WeaponsDB
Suppose I have this code: var myArray = new Object(); myArray["firstname"] = "Bob"; myArray["lastname"]
So I have this code that takes care of command acknowledgment from remote computers,
So I have this code in a google app engine template: <select name='voter'> {%
I have this code in jQuery, that I want to reimplement with the prototype
I have this code: chars = #some list try: indx = chars.index(chars) except ValueError:
I have this code that performs an ajax call and loads the results into
I have this code #include <iostream> using namespace std; int main(int argc,char **argv) {

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.