一个非常非常简单的东西:
class CTestDlg : public CDialog {
public:
friend UINT VoteOnce(LPVOID);
CWebBrowser2 m_browser;//webbrowser控件
...void CTestDlg::OnOK() {
thread = AfxBeginThread(RunOnce, this);
}UINT RunOnce(LPVOID param) {
CVoteDlg *pTarget = (CVoteDlg *)param;
pTarget->m_browser.Navigate("about:blank", NULL, NULL, NULL, NULL);
return TRUE;
}一按OK按钮就:
---------------------------
Windows Internet Explorer
---------------------------
Cannot find 'about:blank'. Make sure the path or Internet address is correct.
---------------------------
OK
---------------------------然后:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Runtime Error!Program: D:\vote\Debug\vote.exeThis application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
---------------------------
OK
---------------------------请问哪里出问题了?
class CTestDlg : public CDialog {
public:
friend UINT VoteOnce(LPVOID);
CWebBrowser2 m_browser;//webbrowser控件
...void CTestDlg::OnOK() {
thread = AfxBeginThread(RunOnce, this);
}UINT RunOnce(LPVOID param) {
CVoteDlg *pTarget = (CVoteDlg *)param;
pTarget->m_browser.Navigate("about:blank", NULL, NULL, NULL, NULL);
return TRUE;
}一按OK按钮就:
---------------------------
Windows Internet Explorer
---------------------------
Cannot find 'about:blank'. Make sure the path or Internet address is correct.
---------------------------
OK
---------------------------然后:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Runtime Error!Program: D:\vote\Debug\vote.exeThis application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
---------------------------
OK
---------------------------请问哪里出问题了?
RunOnce只有这一个调用;
直接RunOnce()是好的
看看param?
一个CTestDlg 指针传进线程里,你转成了CVoteDlg ,不知道CVoteDlg 是怎么来的。
用消息来通讯.
一个CTestDlg 指针传进线程里,你转成了CVoteDlg ,不知道CVoteDlg 是怎么来的。
----------------------------------------------------------------------------
这个是笔误……
----------------------------------------------------------------------------
http://support.microsoft.com/kb/147578/EN-US/
----------------------------------------------------------------------------
看过了;里面说了不能传递MFC对象
请问,要在线程里用ie控件怎么办呢?自己建一个ole对象,把句柄作为参数传过去?另外,要开一个线程例如f(a,b,c),AfxBeginThread()的参数那一项怎么写?