警告C4244:'=':从'INT_PTR'转换为'HRESULT',可能会丢失数据 [英] warning C4244: '=' : conversion from 'INT_PTR' to 'HRESULT', possible loss of data

查看:132
本文介绍了警告C4244:'=':从'INT_PTR'转换为'HRESULT',可能会丢失数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,


请帮我解决警告。 VS2013,64BIT配置。为什么这样的警告


DllRegisterServer函数的重新类型是HRESULT。但为什么它在x64中显示出警告?


警告C4244:'=':从'INT_PTR'转换为'HRESULT',可能会丢失数据


void somefunction(){


        .....


      FARPROC entryPt;

      entryPt = GetProcAddress(hDisplayLib,TEXT(" DllRegisterServer"));

      if(entryPt!= NULL)

      {

        HRESULT hResult;

        hResult =(* entryPt)();

        if(SUCCEEDED(hResult))

        {

        }¥b $ b      }
}

STDAPI DllRegisterServer(无效)

{

//

}

解决方案

2016年11月18日上午12:19,Uralsib写道:


请帮我解决警告。 VS2013,64BIT配置。为什么会出现这样的警告?


DllRegisterServer函数的Retrun类型是HRESULT。但为什么它会在x64中显示警告?


警告C4244:'=':从'INT_PTR'转换为'HRESULT',可能会丢失数据



无效功能(){

$
       .....      FARPROC entryPt;       entryPt = GetProcAddress(hDisplayLib,TEXT(" DllRegisterServer"));


entryPt的类型必须与您指向的函数的实际原型相匹配至。在这种情况下,

 HRESULT(STDAPICALLTYPE * entryPt)(); 



HI,

Please help me to solve the warnings. VS2013, 64BIT configuration. Why such warning

Retrun type of DllRegisterServer function is HRESULT. But why it is showing warings in x64?

warning C4244: '=' : conversion from 'INT_PTR' to 'HRESULT', possible loss of data

void somefunction(){

       .....

      FARPROC entryPt;
      entryPt = GetProcAddress(hDisplayLib, TEXT("DllRegisterServer"));
      if (entryPt != NULL)
      {
        HRESULT hResult;
        hResult = (*entryPt)();
        if (SUCCEEDED(hResult))
        {
        }
      }
}
STDAPI DllRegisterServer(void)
{
//
}

解决方案

On 11/18/2016 12:19 AM, Uralsib wrote:

Please help me to solve the warnings. VS2013, 64BIT configuration. Why such warning

Retrun type of DllRegisterServer function is HRESULT. But why it is showing warings in x64?

warning C4244: '=' : conversion from 'INT_PTR' to 'HRESULT', possible loss of data

void somefunction(){

       .....      FARPROC entryPt;       entryPt = GetProcAddress(hDisplayLib, TEXT("DllRegisterServer"));

The type of entryPt must match the actual prototype of the function you make it point to. In this case,

HRESULT (STDAPICALLTYPE* entryPt)();


这篇关于警告C4244:'=':从'INT_PTR'转换为'HRESULT',可能会丢失数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆