策略为王源代码扩展系列-SListView.cpp:增加按 CTRL+M 切换到多股同列

Published

增加按 CTRL+M 切换到多股同列

第一部分 股票列表界面

策略为王源代码扩展系列-SListView.cpp:增加按 CTRL+M 切换到多股同列

step 1:增加CTRL+M按键检测代码

G:\stock\TskingVS2019\src\Client\StkUI\GridCtrl.cpp

// move about with keyboard
void CGridCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
    if (!IsValid(m_idCurrentCell)) 
    {
        CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
        return;
    }

    CCellID next = m_idCurrentCell;
    BOOL bChangeLine = FALSE;

    if (IsCTRLpressed())
    {
        switch (nChar)
        {
           case 'A': OnEditSelectAll();  break;
#ifndef GRIDCONTROL_NO_CLIPBOARD
           case 'X': OnEditCut();        break;
           case 'C': OnEditCopy();       break;
           case 'V': OnEditPaste();      break;
#endif
	    /***** custom extend CTRL+M 多股同列by freeman 2019/06/08******/
		   case 'M':
			   HWND	hWnd = AfxGetMainFrame()->GetSafeHwnd();
			    ::PostMessage(hWnd, WM_COMMAND, ID_REALTIME_NINESTOCK, 0);						
			   break;
        /***** custom end CTRL+M 多股同列by freeman 2019/06/08******/
        }
    }

step 2:发送多股同列消息

 

/***** custom extend CTRL+M 多股同列by freeman 2019/06/08******/
		   case 'M':
			   HWND	hWnd = AfxGetMainFrame()->GetSafeHwnd();
			    ::PostMessage(hWnd, WM_COMMAND, ID_REALTIME_NINESTOCK, 0);						
			   break;
        /***** custom end CTRL+M 多股同列by freeman 2019/06/08******/

 

第二部分 日K线界面添加按 CTRL+M 切换到多股同列

G:\stock\TskingVS2019\src\Client\StkUI\View\GraphView.cpp

void CGraphView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	switch(nChar)
	{
	case VK_RETURN:
		m_graph.OnReturn(IsSHIFTpressed(), IsCTRLpressed());
		break;
        ....
         /***** custom extend CTRL+M 多股同列by freeman 2019/06/08******/
	case 'M':
		if (IsCTRLpressed())
		{			
				HWND	hWnd = AfxGetMainFrame()->GetSafeHwnd();
				::PostMessage(hWnd, WM_COMMAND, ID_REALTIME_NINESTOCK, 0);			
		}
		break;
		/***** custom end CTRL+M 多股同列by freeman 2019/06/08******/
	}
}