ocx:定义一个firework(short a)事件,定义一个线程,定义一个函数
如果在函数中调用firework正常影应,使用线程会就调不出来了。请问大家怎么改呢?
DWORD WINAPI MSG(LPVOID para)
{
CTest2Ctrl *ctr = (CTest2Ctrl*)para;
ctr->tt();
return 1;
}
int CTest2Ctrl::tt()
{
int a = 0;
int b = 1;
int c = a +b;
SendMessage((WM_USER+1),FireRes,c,0); //此处应该怎么写呢?
//FireRes(c); //在线程函数直接调会出问题。在一般函数中正常
return c;
}
如果在函数中调用firework正常影应,使用线程会就调不出来了。请问大家怎么改呢?
DWORD WINAPI MSG(LPVOID para)
{
CTest2Ctrl *ctr = (CTest2Ctrl*)para;
ctr->tt();
return 1;
}
int CTest2Ctrl::tt()
{
int a = 0;
int b = 1;
int c = a +b;
SendMessage((WM_USER+1),FireRes,c,0); //此处应该怎么写呢?
//FireRes(c); //在线程函数直接调会出问题。在一般函数中正常
return c;
}
解决方案 »
- 写一个com组件,如果只是作为dll进程内实现,可以不要代理/存根么?
- 我想实现把枚举到的进程id和通过进程id获得的窗口句柄显示在EditBox里面 请问这代码怎么改动 谢谢
- 求助多线程网络编程(有酬谢)
- 各位大下能否推荐几本VC的经典书籍呀?
- *****我要申请做斑竹********
- 设置透明窗体问题,请教各位高手!
- 在使用MSXML组件时,程序出现访问内存异常,不只是什么原因,请教!!
- 如何实现按 CTRL+ALT+DEL 显示的任务列表里面也见不到进程的踪迹
- _findfirst函数的使用,在线等待呀!
- 如何再文件中查找出字符串所在的正行字符串内容,然后动态显示在CListctrl框框
- 关于addchart这个函数的问题
- 麻烦大家看一下,这个opengl的程序,为啥点击右键后图像没有刷新?
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
ParametershWnd
[in]
Handle to the window whose window procedure will receive the message. If this parameter is HWND_BROADCAST, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.Microsoft Windows Vista and later. Message sending is subject to User Interface Privilege Isolation (UIPI). The thread of a process can send messages only to message queues of threads in processes of lesser or equal integrity level.Msg
[in] Specifies the message to be sent.
wParam
[in] Specifies additional message-specific information.
lParam
[in] Specifies additional message-specific information.
你看清楚SendMessage的参数,第一个是句柄,第二个是消息ID即WM_USER+1,后面两个是需要传递的数据,可以为NULL
#define WM_SETSLIDERPOS WM_USER+10int CTest2Ctrl::tt()
{
int a = 0;
int b = 1;
int c = a +b;
AfxMessageBox("tt");
SendMessage(WM_SETSLIDERPOS,0,0); AfxMessageBox("tt5");
return c;
}
BEGIN_MESSAGE_MAP(CTest2Ctrl, COleControl)
//{{AFX_MSG_MAP(CTest2Ctrl)
// NOTE - ClassWizard will add and remove message map entries// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SETSLIDERPOS, OnSetSliderPos) //对应关系 ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties)END_MESSAGE_MAP()
LRESULT CTest2Ctrl::OnSetSliderPos( WPARAM wparam, LPARAM lParam )
{
AfxMessageBox("fdafdzjb");
return 0;
} .h中定义
// Message maps
//{{AFX_MSG(CTest2Ctrl)
// NOTE - ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
afx_msg LRESULT OnSetSliderPos( WPARAM wparam, LPARAM lParam ); //}}AFX_MSGDECLARE_MESSAGE_MAP()