With this would that be the sort of pointer needed for the lParam of LVM_SORTITEMS?
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Also can we use this for the CreateThread function and if so would the lpStartAddress function be running without blocking the Lua thread or would it block it?
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
__DLL.NewCallback & CreateThread
yes , you can make it something like below (UN-TESTED)Shrek wrote:With this would that be the sort of pointer needed for the lParam of LVM_SORTITEMS?
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Code: Select all
LVM_SORTITEMS = 4144
User32 = __DLL.LoadLibrary("user32.dll", "stdcall");
if(User32) then
ListView_SortItems = __DLL.GetFunction(User32,_int, "SendMessageA",_long,_long,_long,_callback);
end
-- callback function
function CompareFunc(lParam1,lParam2,lParamSort)
-- compare lParam1,lParam2 here
return 0;
end
function ListViewSortItems(hWnd)
local cbCompareFunc = __DLL.NewCallback(User32,_int,"CompareFunc",_long,_long,_long);
ListView_SortItems(hWnd,LVM_SORTITEMS,0,cbCompareFunc);
end
unfortunately not so , this will lead an app crash or a similar effectShrek wrote:
Also can we use this for the CreateThread function and if so would the lpStartAddress function be running without blocking the Lua thread or would it block it?
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
because , a thread means a new execution stack in same memory space and threads can not share/access data of other threads directly
this is a long story to explain but multi-threading support is in todo list of APM
Thanks for that, sorting a ListView was a high priority for me and the thread was a bonus but at least the bonus is on its way