Re: How can I pass HWND parameter in funciton ?

Nigel Atkinson <[email protected]> Thu, 24 May 2012 01:02:49 +1000
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
I vaguely remember HWND, HBRUSH, HANDLE etc actually being just integers
under the hood.  A quick look through windows.h I guess. ;-)

Nigel

On Tue, 2012-05-22 at 12:21 -0500, Ryan Pavlik wrote:
> Wouldn't a HWND be a pointer (lightuserdata) rather than an integer?
> 
> 
> Also, not sure if your impl. of compute_score is valid.
> 
> 
> Ryan
> 
> On Mon, May 21, 2012 at 7:57 AM, 鸡肋 <[email protected]> wrote:
>         I want to install "BOOL PostMessage(HWND hWnd, UINT
>         Msg, WPARAM wParam, LPARAM lParam)  " to lua ?
>         First, I defined a converter of HWND type:
>         template <>
>         struct default_converter<HWND>
>         : native_converter_base<HWND>
>         {
>         int compute_score(lua_State* L, int index)
>         {
>         return cv.compute_score(L, index);
>         }
>         
>         
>         HWND from(lua_State* L, int index)
>         {
>         return HWND(lua_tointeger(L, index));
>         }
>         
>         
>         void to(lua_State* L, HWND const& x)
>         {
>         lua_pushinteger(L, (int)x);
>         }
>         
>         
>         default_converter<int> cv;
>         };
>         
>         
>         Then, I defined the function like below:
>         def("PostMessage", &PostMessage)
>         
>         
>         But, the complier show :
>          'int luabind::native_converter_base<T>::match(lua_State
>         *,luabind::detail::by_value<T>,int)' : cannot convert
>         parameter 2 from 'luabind::detail::by_pointer<T>' to
>         'luabind::detail::by_value<T>'
>         
>         
>         Then, I defined the function like this:
>         def("PostMessage", &PostMessage, copy(_1))
>         
>         
>         But it didn't work too!
>         
>         
>         How can I install the PostMessage function to lua ?
>         
>         
>         Thanks!
>         
>         ------------------------------------------------------------------------------
>         Live Security Virtual Conference
>         Exclusive live event will cover all the ways today's security
>         and
>         threat landscape has changed and how IT managers can respond.
>         Discussions
>         will include endpoint security, mobile security and the latest
>         in malware
>         threats.
>         http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>         _______________________________________________
>         luabind-user mailing list
>         [email protected]
>         https://lists.sourceforge.net/lists/listinfo/luabind-user
>         
> 
> 
> 
> 
> -- 
> Ryan Pavlik
> HCI Graduate Student
> Virtual Reality Applications Center
> Iowa State University
> 
> [email protected]
> http://academic.cleardefinition.com
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user