From: Nic on 16 Feb 2010 18:26 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 16 Feb 2010 19:08 >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 16 Feb 2010 19:11 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 16 Feb 2010 23:33 >"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 17 Feb 2010 03:13
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 |