📄 demodlgb.cpp
字号:
// DemoDlgB1.cpp : implementation file
//
#include "stdafx.h"
#include "Messenger.h"
#include "DemoDlgB.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDemoDlgB dialog
CDemoDlgB::CDemoDlgB(CWnd* pParent /*=NULL*/)
: CDialog(CDemoDlgB::IDD, pParent)
{
//{{AFX_DATA_INIT(CDemoDlgB)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDemoDlgB::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDemoDlgB)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDemoDlgB, CDialog)
//{{AFX_MSG_MAP(CDemoDlgB)
ON_WM_CREATE()
ON_WM_PAINT()
ON_WM_RBUTTONDOWN()
ON_MESSAGE(WM_REFRESH_STOCK,OnPaint)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDemoDlgB message handlers
int CDemoDlgB::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
void CDemoDlgB::OnPaint()
{
UINT i;
CMainFrame *pFrame;
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
pFrame = (CMainFrame *)AfxGetMainWnd();
dc.TextOut(32,0,_T("沪深5分钟涨幅Top 10"));
for(i = 0;i <20;i++)
{
dc.TextOut(10,24*(i + 1),pFrame->m_StockInfo[i]);
}
// Do not call CDialog::OnPaint() for painting messages
}
void CDemoDlgB::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
int i,cmd_id,stock_idx;
char str_url[64],str_stockno[10];
CRect rect_dlgb;
CMenu menuPopup;
CMainFrame *pFrame;
menuPopup.CreatePopupMenu();
pFrame = (CMainFrame *)AfxGetMainWnd();
for(i = 0;i < 20;i++)
{
memset(str_stockno,'\0',sizeof(str_stockno));
strncpy(str_stockno,(LPCTSTR)(pFrame->m_StockInfo[i]),8);
menuPopup.AppendMenu(MF_STRING,(ID_SH1 + i),_T(str_stockno));
}
#if 0
menuPopup.AppendMenu(MF_STRING,ID_SH1,_T("sh000001"));
menuPopup.AppendMenu(MF_STRING,ID_SH2,_T("sh000002"));
menuPopup.AppendMenu(MF_STRING,ID_SH3,_T("sh000003"));
menuPopup.AppendMenu(MF_STRING,ID_SH4,_T("sh000004"));
menuPopup.AppendMenu(MF_STRING,ID_SH5,_T("sh000005"));
menuPopup.AppendMenu(MF_STRING,ID_SH6,_T("sh000006"));
menuPopup.AppendMenu(MF_STRING,ID_SH7,_T("sh000007"));
menuPopup.AppendMenu(MF_STRING,ID_SH8,_T("sh000008"));
menuPopup.AppendMenu(MF_STRING,ID_SH9,_T("sh000009"));
menuPopup.AppendMenu(MF_STRING,ID_SH10,_T("sh000010"));
menuPopup.AppendMenu(MF_STRING,ID_SZ1,_T("sz000001"));
menuPopup.AppendMenu(MF_STRING,ID_SZ2,_T("sz000002"));
menuPopup.AppendMenu(MF_STRING,ID_SZ3,_T("sz000003"));
menuPopup.AppendMenu(MF_STRING,ID_SZ4,_T("sz000004"));
menuPopup.AppendMenu(MF_STRING,ID_SZ5,_T("sz000005"));
menuPopup.AppendMenu(MF_STRING,ID_SZ6,_T("sz000006"));
menuPopup.AppendMenu(MF_STRING,ID_SZ7,_T("sz000007"));
menuPopup.AppendMenu(MF_STRING,ID_SZ8,_T("sz000008"));
menuPopup.AppendMenu(MF_STRING,ID_SZ9,_T("sz000009"));
menuPopup.AppendMenu(MF_STRING,ID_SZ10,_T("sz000010"));
#endif
this->GetWindowRect(&rect_dlgb);
cmd_id = (int)menuPopup.TrackPopupMenu( \
TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, \
(rect_dlgb.left + point.x),(rect_dlgb.top + point.y), \
this);
if(cmd_id != 0)
{
stock_idx = cmd_id - ID_SH1;
#if 0
sprintf(str_url, \
"http://finance.sina.com.cn/realstock/company/s%s000%02d/nc.shtml",(stock_idx < 10 ? "h6":"z0"),stock_idx);
#else
memset(str_stockno,'\0',sizeof(str_stockno));
strncpy(str_stockno,(LPCTSTR)(pFrame->m_StockInfo[stock_idx]),8);
sprintf(str_url, \
"http://finance.sina.com.cn/realstock/company/%s/nc.shtml",str_stockno);
#endif
ShellExecute(0, _T("open"),str_url, NULL, NULL,SW_SHOWMINIMIZED );
}
CDialog::OnRButtonDown(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -