1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// create a view to occupy the client area of the frame
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | CBRS_TOP | WS_VISIBLE
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
/* ========== Creation de la comboBox pour l'affichage la liste des driver 1553 ========== */
TBBUTTON button;
button.iBitmap=NULL;
button.idCommand=0;
button.fsStyle=TBSTYLE_SEP;
button.dwData=0;
button.iString=NULL;
m_wndToolBar.GetToolBarCtrl().InsertButton(0,&button);
m_wndToolBar.GetToolBarCtrl().InsertButton(0,&button);
m_wndToolBar.SetButtonInfo(0,1,TBBS_SEPARATOR,100);
CRect rect;
m_wndToolBar.GetItemRect(0,&rect);
rect.top=0;
rect.bottom=rect.top+100;
rect.right+=100;
if(!m_ComboBox.Create(CBS_DROPDOWNLIST | WS_VISIBLE | WS_TABSTOP,rect,&m_wndToolBar,1))
{
TRACE0("Failed to create combobox\n");
return FALSE; // fail to create
}
/***************************/
/*CODE POUR AJOUTER LE BOUTON*/
/***************************/
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
/* ====== Initialiser la liste des driver dans le ComboBox ====== */
int i;
for(i=0;i<m_wndView.m_azListCsDriver.GetCount();i++)
{
m_ComboBox.AddString(m_wndView.m_azListCsDriver.GetAt(i));
}
m_ComboBox.SetCurSel(0);
m_nTimerId = SetTimer(1111 /* id */, 1000 /* ms */, NULL);
/*===== Mode pleine ecran =====*/
this->ShowWindow(SW_MAXIMIZE);
return 0;
} |
Partager