MT_AutoIt编译过不去
MT_AutoIt编译过不去/*=====================MT_AutoIt.dll
By FredAI 12/2012
Open source Multi-thread dll for AutoIt
*/
#include <Windows.h>
//Declare our struct for the _ThreadProc3 Threadproc function
typedef struct ThreadProc3Data {HWND hwnd;int top;} *PThreadProc3Data;
//Declare our 4 thread proc functions
DWORD WINAPI _ThreadProc1(LPVOID lpParameter);
DWORD WINAPI _ThreadProc2(LPVOID lpParameter);
DWORD WINAPI _ThreadProc3(LPVOID lpParameter);
DWORD WINAPI _ThreadProc4(LPVOID lpParameter);
//Declare the Thread creation function
HANDLE WINAPI _AutoItThreadCreate(
int index,
LPVOID lpParameter,
SIZE_T dwStackSize,
DWORD dwCreationFlags,
LPDWORD lpThreadId
);
BOOLEAN APIENTRY DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
switch ( fdwReason )
{
case DLL_PROCESS_ATTACH:
//For optimization.
DisableThreadLibraryCalls( hinstDLL );
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
} // End of DllMain
DWORD WINAPI _ThreadProc1(LPVOID param)
{
PWSTR wstr = (PWSTR)param;
MessageBox(0,wstr,L"Thread message",MB_OK);
return 0;
} // End of _ThreadProc1
DWORD WINAPI _ThreadProc2(LPVOID param)
{
PWSTR wstr = (PWSTR)param;
MessageBox(0,wstr,L"Thread message",MB_OK);
return 0;
} // End of _ThreadProc1
DWORD WINAPI _ThreadProc3(LPVOID param)
{
PThreadProc3Data thpd = (PThreadProc3Data) param;
HWND desktopHwnd = GetDesktopWindow();
HDC desktopDC = GetDC(desktopHwnd);
int desktopwidth = GetDeviceCaps(desktopDC,HORZRES);
HDC hdcpic = GetDC(thpd->hwnd);
for (int i=0;i<desktopwidth;i++)
{
BitBlt(hdcpic, 0, 0, 240,180, desktopDC, i, thpd->top, SRCCOPY);
//picgr.DrawImage(&desktopBmp,i,thpd->top,240,180);
SleepEx(20,true);
if (i == desktopwidth-240-1) i = 0;
}
return 0;
} // End of _ThreadProc1
DWORD WINAPI _ThreadProc4(LPVOID param)
{
PWSTR wstr = (PWSTR)param;
MessageBox(0,wstr,L"Thread message",MB_OK);
return 0;
} // End of _ThreadProc1
HANDLE WINAPI _AutoItThreadCreate(int index, LPVOID lpParameter,
SIZE_T dwStackSize,DWORD dwCreationFlags,LPDWORD lpThreadId)
{
switch (index)
{
case 1:
return CreateThread(NULL,dwStackSize,&_ThreadProc1,lpParameter,dwCreationFlags,lpThreadId);
case 2:
return CreateThread(NULL,dwStackSize,&_ThreadProc2,lpParameter,dwCreationFlags,lpThreadId);
case 3:
return CreateThread(NULL,dwStackSize,&_ThreadProc3,lpParameter,dwCreationFlags,lpThreadId);
case 4:
return CreateThread(NULL,dwStackSize,&_ThreadProc4,lpParameter,dwCreationFlags,lpThreadId);
default:
return 0;
}
} // End of _AutoItThreadCreate!!!!! 好像是wstr类型错误 看样子不是AU3语言的吧 高手的多线程,挺好玩的,可惜dll编译不过去 修改成 Release 再编译。 谢谢{:face (88):} 回复 5# nmgwddj
这个应该创建什么项目?控制台?MFC?WIN32? 回复 7# haijie1223
我下载的这个人的整个解决方案编译的:https://www.autoitscript.com/forum/topic/146794-multi-thread-autoit/ 这是学习C++ ? 回复 8# nmgwddj
ok 谢谢 回复 8# nmgwddj
我用2015编译,体积是2010的两倍多。。。 又是伪多线程?
还是测试多线程? 还是c#简单些 感觉是蛋疼的多线程,调用的是 C++,如果用C++在调用au3COM控件再操作源码还可以用下,但是怎么绝得还是蛋疼的事情,搞的好像是 个自己拼装的按键精灵,
页:
[1]