Hi Rossine,
Change this:
pFunc = GetProcAddress( handle,"GetLastInputInfo" );
to this:
pFunc = ( GETLASTINPUTINFO_ ) GetProcAddress( handle,"GetLastInputInfo" );

or turn off C++ mode (remove -TP C compiler switch) if this is plain C code.

[ Why is -TP active for everyone today? :) ]

Brgds,
Viktor

On Thu, Mar 5, 2009 at 11:09 PM, Rossine <[email protected]> wrote:

>
> Hello,
>
> When compiling this program:
>
> [CODE]
> #pragma BEGINDUMP
>
> #include "windows.h"
> #include "hbapi.h"
> /*
> typedef struct tagLASTINPUTINFO {
>    UINT cbSize;
>    DWORD dwTime;
> } LASTINPUTINFO, *PLASTINPUTINFO;
> */
>
> WINUSERAPI BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO);
> typedef  BOOL (WINAPI * GETLASTINPUTINFO_)(PLASTINPUTINFO);
>
> HB_FUNC( SYSIDLESECS )
> {
>   HINSTANCE handle= LoadLibrary("user32.dll");
>   if ( handle)
>   {
>      GETLASTINPUTINFO_ pFunc;
>      pFunc = GetProcAddress( handle,"GetLastInputInfo" );
>      if (pFunc)
>      {
>         LASTINPUTINFO lpi;
>
>         lpi.cbSize = sizeof(LASTINPUTINFO);
>
>         if (!pFunc(&lpi))
>         {
>            hb_retni(0);
>         }
>         else
>         {
>            hb_retnd( ( DOUBLE ) ( GetTickCount() - lpi.dwTime ) * 0.001 );
>         }
>      }
>   else
>      {
>         hb_retni(0);
>      }
>   }
>
>   if (handle)
>      {
>         FreeLibrary( handle);
>      }
> }
> #pragma ENDDUMP
>
> **----------------------------------------------------------------------
> [ENDCODE]
>
> I generated this error:
>
> teste.c
> teste.prg(20) : error C2440: '=' : cannot convert from 'FARPROC' to
> 'GETLASTINPUTINFO_'
>        This conversion requires a reinterpret_cast, a C-style cast or
> function-style cast
>
> How to fix this ?
>
> PS: I use harbour + msvc 2008
>
> Regards,
>
> Rossine.
>
> --
> View this message in context:
> http://www.nabble.com/How-to-fix-this---tp22361860p22361860.html
> Sent from the Harbour - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> Harbour mailing list
> [email protected]
> http://lists.harbour-project.org/mailman/listinfo/harbour
>
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to