Re: How can I pass HWND parameter in funciton ?

Ryan Pavlik <[email protected]> Tue, 22 May 2012 12:21:16 -0500
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <CABMFTE8O7WM=SEQ2efqfa5EDp4R1XBACo-Xb4hqr50FmO3r7Yg@mail.gmail.com>
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