Re: How can I install Window types in lua ?

Teto <[email protected]> Sat, 31 Mar 2012 14:25:39 +0200
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <CADHp1NzKWXrm8cDqmek7COKUSjZSxkckWW=5sgeXhRM39TyLMQ@mail.gmail.com>
"Trying to use unregistered class' means the class you are registering
either takes an unregistered parameter or returns one which you need
to register.
Windows mainly use void* you need to cast. I am not sure how luabind
reacts to that. You could try to cast explicitly functions on
registration.

2012/3/31 鸡肋 <[email protected]>:
> Question 1 :
>
> I installed a class member function like below :
>
> member function :
>         HWND CRenderManager::GetSafeWnd()
> {
> DCHECK(::IsWindow(m_hWnd));
> return m_hWnd;
> }
>
> install to lua :
>        void CRenderManager::InstallToLua( lua_State* luaState )
> {
> DCHECK(luaState);
> using namespace luabind;
> module(luaState, "ui")
> [
> class_<CRenderManager>("RenderManager")
> .def("GetSafeWnd", &CRenderManager::GetSafeWnd)
> ];
> }
>
> Now, I use the member function in lua :
>  function SysButton:OnClose(object)
> local render = object:GetRenderManager() -- Get RenderManager installed
> render:GetSafeWnd() -- Here is the problem ?
> end
>
> When the code step out the member function, it throw an exception like this
> :
> [c]-1(method GetSafeWnd) std::runtime_error: 'Trying to use unregistered
> class'
>
> Is it because the HWND type should be installed to lua ?  I look up MSDN :
>
> typedef HANDLE HWND;
>
> typedef PVOID HANDLE;
>
> typedef void *PVOID;
>
> How can I install Windows types (HWND, HANDLE...) to Lua ?
>
> Question 2 :
>
> How can I register Windows API (PostMessage、SendMessage、Point) to lua ?
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user