From: Nic on
Hello

In the VS 2005 I have been using, handles such as HWND and HISTANCE are
defined with DECLARE_HANDLE (..) which concerns me because I have been
casting these handles to LPVOID. Should I be concerned about this?

Thanks in advance
Nic




From: David Lowndes on
>In the VS 2005 I have been using, handles such as HWND and HISTANCE are
>defined with DECLARE_HANDLE (..) which concerns me because I have been
>casting these handles to LPVOID. Should I be concerned about this?

Probably, and since you're posting the question, I guess you are :)

Dave
From: Igor Tandetnik on
Nic <ncg3827(a)googlemail.com> wrote:
> In the VS 2005 I have been using, handles such as HWND and HISTANCE
> are defined with DECLARE_HANDLE (..) which concerns me because I have
> been casting these handles to LPVOID. Should I be concerned about
> this?

I'm not sure I understand the problem. How does the handles being defined with DECLARE_HANDLE hinder your ability to cast them to LPVOID? Come to think of it, _why_ are you casting them to LPVOID in the first place?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925

From: Nic on

>"Igor Tandetnik" <itandetnik(a)mvps.org> wrote in message
>news:%23L4q0W2rKHA.728(a)TK2MSFTNGP04.phx.gbl...
>Nic <ncg3827(a)googlemail.com> wrote:
>> In the VS 2005 I have been using, handles such as HWND and HISTANCE
>> are defined with DECLARE_HANDLE (..) which concerns me because I have
>> been casting these handles to LPVOID. Should I be concerned about
>> this?

>I'm not sure I understand the problem. How does the handles being defined
>with DECLARE_HANDLE hinder your ability to cast them to LPVOID? Come to
>think of it, _why_ are you casting them to LPVOID in the first place?
>--
>With best wishes,
> Igor Tandetnik

>With sufficient thrust, pigs fly just fine. However, this is not
>necessarily
>a good idea. It is hard to be sure where they are going to land, and it
>could be dangerous sitting under them as they fly overhead. -- RFC 1925

Thanks Igor and Dave for the reply. In answer to the above question, I have
been looking into the InterlockedExchangePointer function, which requires
casting to LPVOID, as I am declaring a global variable as:'volatile
HINSTANCE ghInstance' in a multithreaded application . However, the variable
is only assigned a values at startup and it is declared as volatile
therefore, I do not think it is necessary to use the
InterlockedExchangePointer function here after all.

Nic


From: Ulrich Eckhardt on
Nic wrote:
> [...] I have been looking into the InterlockedExchangePointer function,
> which requires casting to LPVOID, as I am declaring a global variable
> as:'volatile HINSTANCE ghInstance' in a multithreaded application .
> However, the variable is only assigned a values at startup and it is
> declared as volatile therefore, I do not think it is necessary to use the
> InterlockedExchangePointer function here after all.

It is not even necessary to define it as volatile.

Uli

--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932