Jump to content
  • Advertisement
Sign in to follow this  
GetWindowRect

Warnings?

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a question about warnings. I know some warnings are worse than others, but I cannot seem to fix a few of them. I was wondering if all warnings are bad necessarily, or if they are acceptible so to speak. Here is a list of warnings I have now that I haven't figured out how to fix, and the code that causes them:
//warning C4311: 'reinterpret_cast' : pointer truncation from 'LPVOID' to 'long'
SetWindowLongPtr(hWnd, GWL_USERDATA, reinterpret_cast<long>((LPCREATESTRUCT(lParam)->lpCreateParams)));

//warning C4311: 'type cast' : pointer truncation from 'HICON' to 'LONG'
HICON tempIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(m_Icon));
SetClassLongPtr(m_hWnd, GCL_HICONSM, (LONG)tempIcon);
SetClassLongPtr(m_hWnd, GCL_HICON, (LONG)tempIcon);

//warning C4311: 'type cast' : pointer truncation from 'MCI_STATUS_PARMS *__w64 ' to 'DWORD'
MCI_STATUS_PARMS m_StatusParams;
mciSendCommand(m_OpenParams.wDeviceID, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, (DWORD)&m_StatusParams)

//warning C4312: 'reinterpret_cast' : conversion from 'LONG' to 'Window *' of greater size
return reinterpret_cast<Window*>(GetWindowLongPtr(hWnd, GWL_USERDATA));

//warning C4312: 'type cast' : conversion from 'MCIDEVICEID' to 'LPSTR' of greater size
m_OpenParams.lpstrDeviceType  = (LPSTR)MCI_ALL_DEVICE_ID;

//warning C4312: 'type cast' : conversion from 'unsigned int' to 'char *' of greater size
//I was having a problem with some pointers that would return one of the
//following values.  checking them against NULL did not appear to work.
//When I used a breakpoint and moused over the pointer variable it would
//say <BadPtr> and one of the following values, this was the easiest way
//I could think of to check the variable before getting errors.
bool BadPtr(char* ptr)
{
	if(ptr == (char*)0x00000000 || ptr == (char*)0xffffffff)
		return true;
	else
		return false;
}


If anyone has any idea if the warnings are bad or not (for lack of better words) I would be happy to learn which ones definately need fixed, and if possible a way to go about fixing them. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
You have 64-bit compatibility mode warnings turned on, that is giving you these messages. You can ignore them if you're not interested in porting your program to 64-bit. Better yet, you turn them off, as I'm sure someone will explain shortly.

Share this post


Link to post
Share on other sites
Thank you iMalc. It seems I read somewhere how to turn them off a long time ago, I will try to remember how, I think it is in the project settings somewhere.

EDIT:
I found it.

Right click Project->Properties->C/C++-> General->Detect 64-Bit Portability Issues

I turned it to NO and I no longer get any of the errors. I guess they were all only for 64 bit portability.

Thank you again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!