Skip to content

Commit 242cb67

Browse files
committedApr 23, 2015
通视的Bug终于解决
不能在线程中创建窗体
1 parent c36e2a0 commit 242cb67

18 files changed

+512
-316
lines changed
 
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// DialogStockDrv.cpp : implementation file
2+
//
3+
4+
#include "stdafx.h"
5+
#include "QuantBox_TongShi_Quote.h"
6+
#include "DialogStockDrv.h"
7+
#include "afxdialogex.h"
8+
9+
#include "MdUserApi.h"
10+
11+
#define WM_USER_STOCK 2000
12+
// CDialogStockDrv dialog
13+
14+
IMPLEMENT_DYNAMIC(CDialogStockDrv, CDialogEx)
15+
16+
CDialogStockDrv::CDialogStockDrv(CWnd* pParent /*=NULL*/)
17+
: CDialogEx(CDialogStockDrv::IDD, pParent)
18+
{
19+
m_pUserApi = nullptr;
20+
}
21+
22+
CDialogStockDrv::~CDialogStockDrv()
23+
{
24+
}
25+
26+
void CDialogStockDrv::DoDataExchange(CDataExchange* pDX)
27+
{
28+
CDialogEx::DoDataExchange(pDX);
29+
}
30+
31+
32+
BEGIN_MESSAGE_MAP(CDialogStockDrv, CDialogEx)
33+
ON_MESSAGE(WM_USER_STOCK, OnTSDataDriver)
34+
ON_WM_CLOSE()
35+
END_MESSAGE_MAP()
36+
37+
38+
// CDialogStockDrv message handlers
39+
40+
41+
BOOL CDialogStockDrv::OnInitDialog()
42+
{
43+
CDialogEx::OnInitDialog();
44+
45+
// TODO: Add extra initialization here
46+
if (m_pUserApi)
47+
{
48+
m_pUserApi->InitDriver(GetSafeHwnd(), WM_USER_STOCK);
49+
MoveWindow(0, 0, 0, 0);
50+
ShowWindow(SW_HIDE);
51+
ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
52+
}
53+
54+
return TRUE; // return TRUE unless you set the focus to a control
55+
// EXCEPTION: OCX Property Pages should return FALSE
56+
}
57+
58+
LONG CDialogStockDrv::OnTSDataDriver(UINT wParam, LONG lParam)
59+
{
60+
if (m_pUserApi)
61+
return m_pUserApi->_OnMsg(wParam, lParam);
62+
return 1;
63+
}
64+
65+
void CDialogStockDrv::OnClose()
66+
{
67+
// TODO: Add your message handler code here and/or call default
68+
if(m_pUserApi)
69+
{
70+
m_pUserApi->QuitDriver();
71+
}
72+
73+
CDialogEx::OnClose();
74+
}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#pragma once
2+
3+
4+
class CMdUserApi;
5+
// CDialogStockDrv dialog
6+
7+
class CDialogStockDrv : public CDialogEx
8+
{
9+
DECLARE_DYNAMIC(CDialogStockDrv)
10+
11+
public:
12+
LONG OnTSDataDriver(UINT wParam, LONG lParam);
13+
14+
CDialogStockDrv(CWnd* pParent = NULL); // standard constructor
15+
virtual ~CDialogStockDrv();
16+
17+
// Dialog Data
18+
enum { IDD = IDD_DIALOG_STOCKDRV };
19+
20+
protected:
21+
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
22+
23+
DECLARE_MESSAGE_MAP()
24+
public:
25+
virtual BOOL OnInitDialog();
26+
CMdUserApi* m_pUserApi;
27+
afx_msg void OnClose();
28+
};

0 commit comments

Comments
 (0)