Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Anu_Bala

@Anu_Bala
About
Posts
512
Topics
300
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Selected Row while updating in CListCtrl in MFC
    A Anu_Bala

    I have CListCtrl and updating this control with love data using OnTimer(). But i want to select some rows and do furthur actions. But when i select the row, the selected color appears,but moment it updating using OnTimer(), the selected row color become normal. How can i keep the selection row visible always?

    Anu

    C / C++ / MFC question c++

  • SetCheck() for checkbox in MFC GridControl 2.7
    A Anu_Bala

    Im using MFC GridControl 2.7 taken from code proejct in my application.In my grid control, im making second column as check box column. The default state of check box should be true. Later, user can uncheck the checkbox and depends on the state, furthur functinoality wil go. Here i dont know how to set checkbox as checked in default.

    m_ctLstCtrl.Create(listRect, this, IDC_TRENDLISTCTRL);

    	// fill it up with stuff
    	m\_ctLstCtrl.SetEditable(TRUE);
    	
    
    	try {
    		m\_ctLstCtrl.SetRowCount(9);
    		m\_ctLstCtrl.SetColumnCount(15);
    		m\_ctLstCtrl.SetFixedRowCount(1);
    		m\_ctLstCtrl.SetFixedColumnCount(1);
    		
    	}
    	catch (CMemoryException\* e)
    	{
    		e->ReportError();
    		e->Delete();
    		return -1;
    	}
    

    for (int row = 0; row < m_ctLstCtrl.GetRowCount()-1; row++)
    {
    m_ctLstCtrl.SetCellType(row+1,1,RUNTIME_CLASS(CGridCellCheck));
    // m_ctLstCtrl.SetItemState(row+1,1, m_ctLstCtrl.GetItemState(row+1,1) | GVIS_SELECTED); //if i do this, blue colr selection is appearing but not check mark

    	}
    

    Anu

    C / C++ / MFC c++ css tutorial

  • Add checkbox in second column in dynamically created ListCtrl
    A Anu_Bala

    I have included CLIstCtrl in VIe wcalss in OnCreate(). I added headers details in OnCreate(). I want to add check box in Second column on control. If i add extended style LVS_CHECKBOXES, it adds checkbox to first column. But i want that for second column, how can i do that?

    m_ctLstCtrl.Create(WS_CHILD | WS_VISIBLE | LVS_REPORT ,listRect, this, IDC_TRENDLISTCTRL);

    m\_ctLstCtrl.SetExtendedStyle(m\_ctLstCtrl.GetExtendedStyle() | LVS\_EX\_GRIDLINES|	 LVS\_EX\_FULLROWSELECT| 	LVS\_EX\_ONECLICKACTIVATE );
    
    	
    m\_ctLstCtrl.InsertColumn(0,\_T(""),LVCFMT\_RIGHT,20);
    m\_ctLstCtrl.InsertColumn(1,\_T("Visible"),LVCFMT\_LEFT,50);  //checkbox under this header
    m\_ctLstCtrl.InsertColumn(2,\_T("Status"),LVCFMT\_LEFT,50);
    m\_ctLstCtrl.InsertColumn(3,\_T("Trace color"),LVCFMT\_LEFT,50);
    m\_ctLstCtrl.InsertColumn(4,\_T("Object"),LVCFMT\_RIGHT,100);
        m\_ctLstCtrl.InsertColumn(5,\_T("Object"),LVCFMT\_RIGHT,100);
    m\_ctLstCtrl.InsertColumn(6,\_T("Object Desc"),LVCFMT\_RIGHT,100);
    

    In OnTimer() im adding data to this Listctrl as

    TagListctrl.SetRedraw( FALSE );
    TagListctrl.DeleteItem(iTagPos);
    index = TagListctrl.InsertItem(iTagPos,indexno);
    //for 'Status' and 'Tracecolor'- fil color using OnCUstonDrawList()
    TagListctrl.SetItemText(iTagPos,4,"Object");
    TagListctrl.SetItemText(iTagPos,5,sName);
    TagListctrl.SetItemText(iTagPos,6,sDesc);
    TagListctrl.SetRedraw( TRUE );

    Anu

    C / C++ / MFC question database debugging

  • Toolbar for bottom split window - CSplitterWnd
    A Anu_Bala

    If i use

    class CSplitFrame : public CframeWnd

    Here, I call the TrendView using following fucntion in mainfrm.cpp,

    void CMainFrame::OnTrendview()
    {

    if( pTrendDisplayFrame == NULL )
    {
    	iWindowNumber = 4;
    	CDocTemplate \*pTemplate = theApp.pTrendViewTemplate;
    	CCS3OprDoc\* pDoc = new CCS3OprDoc;
    	pTrendDisplayFrame = (CMDIChildWnd \*)pTemplate->CreateNewFrame( pDoc ,NULL );
    	if( pTrendDisplayFrame == NULL )
    	{
    		MessageBox( "Unable to Create Trend Display" );
    		return;
    	}
    	pTemplate->InitialUpdateFrame( pTrendDisplayFrame,NULL );
    }
    else
    	MDIActivate( pTrendDisplayFrame );
    

    }

    Here it comes messagebox “Unable to create trend display” becoz pTrendDisplayFrmae is null. Frame is not created in CreateNewFrame(),it return null from this function call from doctempl.cpp

    // create new from resource
    if (!pFrame->LoadFrame(m_nIDResource,
    WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, // default frame styles
    NULL, &context))
    {
    TRACE(traceAppMsg, 0, "Warning: CDocTemplate couldn't create a frame.\n");
    // frame will be deleted in PostNcDestroy cleanup
    return NULL;
    }

    When I use CsplitFrame as MDIChilWNd

    class CSplitFrame : public CMDIChildWnd

    IT shows assertion error in winmdi.cpp

    // walk up two parents for MDIFrame that owns MDIChild (skip MDIClient)
    CMDIFrameWnd* CMDIChildWnd::GetMDIFrame()
    {
    ASSERT_KINDOF(CMDIChildWnd, this);
    ASSERT(m_hWnd != NULL);
    HWND hWndMDIClient = ::GetParent(m_hWnd);
    ASSERT(hWndMDIClient != NULL);

    CMDIFrameWnd\* pMDIFrame;
    pMDIFrame = (CMDIFrameWnd\*)CWnd::FromHandle(::GetParent(hWndMDIClient));
    ASSERT(pMDIFrame != NULL);
    ASSERT\_KINDOF(CMDIFrameWnd, pMDIFrame); //Assertion error occurred here
    ASSERT(pMDIFrame->m\_hWndMDIClient == hWndMDIClient);
    ASSERT\_VALID(pMDIFrame);
    return pMDIFrame;
    

    }

    My TrendView base class is

    class CTrendView : public CView

    TrendListView base class is also CView

    class CTrendListView : public CView

    Im invoking this TrendListView as follow

    void CMainFrame::OnTrendListView()
    {
    // TODO: Add your command handler code here
    iGraphView = 0; //Code added by Mohan //Graph view inactive
    if( pTrendListDisplayFrame == NULL )
    {
    iWindowNumber = 11;
    CDocTemplate *pTemplate = theApp.pTrendListViewTemplate;
    CCS3OprDoc* pDoc = new CCS3OprDoc;
    pTrendListDisplayFrame = (CMDIChildWnd *)pTemplate->CreateNew

    C / C++ / MFC c++ question

  • Toolbar for bottom split window - CSplitterWnd
    A Anu_Bala

    I saw that one show CFrameWnd. My window is CMDIChildWnd. So i didnt try first. I tried now. i create CSPlitFrame as CFrameWnd and i coded like below. But when i want my particular window , it shows error on calling that view in Mainframe.cpp.

    BEGIN_MESSAGE_MAP(CSplitFrame, CFrameWnd)
    ON_WM_CREATE()
    END_MESSAGE_MAP()

    BOOL CSplitFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
    {

    CTrendListView \*pview;
    
    // Create a context.
    CCreateContext context;
    pContext = &context;
    
    // Assign custom view.
    pContext->m\_pNewViewClass = RUNTIME\_CLASS(CTrendListView);
    
    // Create the view.
    pview = (CTrendListView \*) CreateView(pContext, AFX\_IDW\_PANE\_FIRST);
    if (pview == NULL)
    	return FALSE;
    
    // Notify the view.
    //pview->SendMessage(WM\_INITIALUPDATE);
    SetActiveView(pview, FALSE);
    
    return TRUE;
    

    }

    int CSplitFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;

    // TODO:  Add your specialized creation code here
    
    
    if (!m\_wndWindowTool.CreateEx(this, TBSTYLE\_FLAT, WS\_CHILD | WS\_VISIBLE | CBRS\_TOP
    	| CBRS\_GRIPPER | CBRS\_TOOLTIPS | CBRS\_FLYBY | CBRS\_SIZE\_DYNAMIC) ||
    	!m\_wndWindowTool.LoadToolBar(IDR\_MAINFRAME))
    {
    	TRACE0("Failed to create toolbar\\n");
    	return -1;      // fail to create
    }
    
    m\_wndWindowTool.EnableDocking(CBRS\_ALIGN\_ANY);
    

    m_wndWindowTool.SetBorders(3, 3, 3, 3);
    EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndWindowTool);
    return 0;

    }

    CChildFrame.cpp OnCreateClient()

    if (!m_wndSplitter.CreateStatic(this, 2, 1))
    return FALSE;

    if(!m\_wndSplitter.CreateView(0,0, RUNTIME\_CLASS(CTrendView),CSize(cr.Width(), cr.Height()-200),pContext)||		
    	!m\_wndSplitter.CreateView(1,0, RUNTIME\_CLASS(CSplitFrame),CSize(cr.Width(), cr.Height()-550),pContext))
    {
    	m\_wndSplitter.DestroyWindow();
    	return FALSE;
    }
    

    But it shows error in calling TrendView()

    if( pTrendDisplayFrame == NULL )
    {
    iWindowNumber = 4;
    CDocTemplate *pTemplate = theApp.pTrendViewTemplate;
    CCS3OprDoc* pDoc = new CCS3OprDoc;
    pTrendDisplayFrame = (CMDIChildWnd *)pTemplate->CreateNewFrame( pDoc ,NULL ); //It shows error in creating new MDIChhildWnd
    if( pTrendDisplayFrame == NULL )
    {
    MessageBox( "Unable to Create Trend Display" );
    return;
    }
    pTemplate->InitialUpdateFrame( pTrendDisplayFrame,NULL );
    }
    else
    MDIActivate( pTrendDisplayFrame );

    When i create SplitFrame as MDICHildWnd, it shows asse

    C / C++ / MFC c++ question

  • Toolbar for bottom split window - CSplitterWnd
    A Anu_Bala

    In my CChildFrame::OnCreate(), im loading toolbar but it comes only for top view. But i want for bottom view.

    int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
    return -1;
    // TODO: Add your specialized creation code here

    struct tagSIZE butSize,bmpSize;
    bmpSize.cx = 25;bmpSize.cy = 23;butSize.cx = 35;butSize.cy = 30;
    if(iWindowNumber == 4)
    {
    	if (!m\_wndWindowTool.Create(this,CBRS\_TOP|CBRS\_TOOLTIPS|CBRS\_FLYBY|WS\_VISIBLE | CBRS\_FLOAT\_MULTI) ||
    		!m\_wndWindowTool.LoadBitmap(IDB\_GROUPVW) ||
    		!m\_wndWindowTool.SetButtons(CtrlGrp,
    		sizeof(CtrlGrp)/sizeof(UINT)))
    	{
    		TRACE0("Failed to create toolbar\\n");
    		return -1;      
    	}
    	m\_wndWindowTool.SetWindowText("Trend");
    	m\_wndWindowTool.SetSizes( butSize,bmpSize );
    	m\_wndWindowTool.SetHeight( 40 );
    
    	
    	CRect rect;
    	m\_wndWindowTool.GetItemRect(0, &rect);
    	
    	
    	m\_wndWindowTool.m\_Static.IsTitle = true;
    	if (!m\_wndWindowTool.m\_Static.Create("Title",WS\_CHILD|WS\_VISIBLE|BS\_OWNERDRAW,rect, &m\_wndWindowTool, IDD\_TITLESTATIC) )
    	{
    		TRACE0("Failed to create combo-box\\n");
    		return FALSE;
    	}
    		}
    

    }

    Anu

    C / C++ / MFC c++ question

  • Toolbar for bottom split window - CSplitterWnd
    A Anu_Bala

    I have MDI MFC application. For a particular child window, i want to split in to two. Already i have toolbar for topview by using OnCreate() in ChildFrame.cpp. I want to add toolbar for bottom view also. ChildFrame OnCreateClient() code:

    BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    // TODO: Add your specialized code here and/or call the base class

    if(iWindowNumber == 4)
    {

    CRect cr; 
    GetClientRect( &cr);
    
    if (!m\_wndSplitter.CreateStatic(this, 2, 1))
    	return FALSE;
    
    if(!m\_wndSplitter.CreateView(0,0, RUNTIME\_CLASS(CTrendView),CSize(cr.Width(), cr.Height()-200),pContext)||		
    	!m\_wndSplitter.CreateView(1,0, RUNTIME\_CLASS(CTrendListView),CSize(cr.Width(), cr.Height()-550),pContext))
    {
    	m\_wndSplitter.DestroyWindow();
    	return FALSE;
    }
    //m\_wndSplitter.SetActivePane(1, 0);
    return TRUE;
    

    }
    return CMDIChildWnd::OnCreateClient(lpcs, pContext);
    }

    In OnCreate(), im loading toolbar, but it adds only for TopView. I want to add different toolbar for bootmView. Can we add toolbar using CView::OnCreate()? i tried this but it is not happening. Otherwise i have to create 3 splitter window, middle winodw will have toolbar buttons that can be added using CMiddleView::OnCreate(). How can i get that?

    Anu

    C / C++ / MFC c++ question

  • MySQL for MFC application
    A Anu_Bala

    0 down vote favorite I have installed WAMP server in my PC for web application projects. Now i want to develop MFC application that uses mysql database in Visual Studio 2008. Whether MySQL 5.6(WAMP server) available in my PC is enough for this MFC development. Or What i have to install for this Requirements? When i searched in google i got this two. 1.MySQL Connector 2.MySQL for Visual Studio. Please guide me on this

    Anu

    Database csharp c++ database mysql visual-studio

  • MFC FeaturePack application is not running in client PC.
    A Anu_Bala

    In my PC where visual studio 2008 installed , working fine.i can get ribbon bar also. But not in other pCs. So i installed Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) and Microsoft Visual C++ 2008 Feature Pack Redistributable Package (x86) in that PCs. But its not working. IS there any particular DLL required for showing that ribbon bar?

    Anu

    C / C++ / MFC help csharp c++ visual-studio tutorial

  • MFC FeaturePack application is not running in client PC.
    A Anu_Bala

    I installed that redistributable package. But no use. its not working. Application is running but Ribbonbar is not coming.

    Anu

    C / C++ / MFC help csharp c++ visual-studio tutorial

  • MFC FeaturePack application is not running in client PC.
    A Anu_Bala

    Hi, I have created an application in visualstudio 2008 and i used MFC Featurepack CRibbonBar for designing menu bar. Its working fine in my PC. When i invoke that application in some other PC which doesnot have Visual studio, its not opening. I pasted mfc90d.dll ,mfc90ud.dll,mfcm90d.dll,mfcm90ud.dll,Microsoft.VC90.MFC.manifest in that application path. When i open the application,its opening but i cannot find the Ribbon menubar. Just the view window get enlarged and filled the screen. I think im missing some Dlls related to MFC Feature Pack. Please help me how to resolve this problem. I want to run this application in my Client PC.

    Anu

    C / C++ / MFC help csharp c++ visual-studio tutorial

  • Font size of menu text in MFCRibbonbar in feature pack.
    A Anu_Bala

    Im using MFC feature pack for my application to create menu bar looks like MS Office. But is there any option to change the fonst size of text appearing in Ribbon Panel. I used Add Category, Add Panel and CMFCRibbonButton for buttons in Panel. Just i want to increase the text size in each button.Now it appears very small.

    Anu

    C / C++ / MFC c++

  • InitInstance() Problem
    A Anu_Bala

    Hi, In my application, first the CMainFrame construcotr is getting called and then only InitInstance() is called. What may be the problem? Pls help me.

    Anu

    C / C++ / MFC help question

  • Unhandled Exception errror in CStringData GetData()
    A Anu_Bala

    Run Time error only. But when i cahnge the calling method og AddMsg,no error is coming. May be it smy mistake.Now its working.

    Anu

    C / C++ / MFC help

  • Unhandled Exception errror in CStringData GetData()
    A Anu_Bala

    In my function, Im assignning one Global CString to varaible declared in header file.But it shows unhandled exception error. My code

    CString sReceiceStr = _T(""); //Global variable

    void CChatServerDlg::AddMsg( userinfo \*udata, CString sIP)
    {
    	
    sReceiceStr.Format("%s : %s  : %s : %s : %s",udata->cSessionID ,udata->cTraineeName, udata->cPassword, udata->cClientServerMsg, udata->cInsName);
    
    		
    sTempassign = sReceiceStr;   //sTempassign is declared in Headerfile of this dlg class
    

    It shows error in the above line. It shows error in CStringData GetData() function Kindly help me.

    Anu

    C / C++ / MFC help

  • Drawimage
    A Anu_Bala

    See this link.It may help you. http://stackoverflow.com/questions/2490661/how-to-load-png-jpeg-images-using-mfc[^]

    Anu

    C / C++ / MFC help graphics learning

  • Drawimage
    A Anu_Bala

    Check bmp file is avaialble in folder.Otherwise it returns NULL.

    Anu

    C / C++ / MFC help graphics learning

  • Drawimage
    A Anu_Bala

    I coded like this for my application.

    CString bmpFilePath;
    HBITMAP hBmp;
    hBmp = (HBITMAP)::LoadImage(NULL,bmpFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
    CBitmap bmp;
    bmp.Attach(hBmp);
    CDC dcImage;
    if(!dcImage.CreateCompatibleDC(pDC))
    return;
    BITMAP bm;
    CBitmap* pOldBitmap;
    bmp.GetBitmap(&bm);
    pOldBitmap = dcImage.SelectObject(&bmp);
    pDC->BitBlt(350,100, bm.bmWidth, bm.bmHeight, &dcImage, 0, 0, SRCCOPY);
    dcImage.SelectObject(pOldBitmap);

    Anu

    C / C++ / MFC help graphics learning

  • Split window in MDI
    A Anu_Bala

    Hi, I want 3 split windows in my application,in that left for Tree control and Right window act as a main window and bottom window have list control to show some log of my application. For that i made this code.. in Mainframe.cpp(), in OnCreateClient()

    if(!m_SplitterWnd.CreateStatic(this, 2, 1))
    return FALSE;

    CRect rect;     
    GetClientRect(&rect); 
    
    if(!m\_SplitterWnd.CreateView(1, 0, RUNTIME\_CLASS(CBottomView), CSize(rect.Width(), 50),  pContext))        
    	return FALSE;       
    
    m\_SplitterWnd.SetRowInfo(0, 800, 50);
    m\_SplitterWnd.SetRowInfo(1, 330, 50);
    
    if (!m\_SplitterWnd1.CreateStatic(&m\_SplitterWnd, 1, 2, WS\_CHILD | WS\_VISIBLE | WS\_BORDER |AFX\_IDW\_PANE\_FIRST, m\_SplitterWnd.IdFromRowCol(0,0)))     
     	return FALSE;     
           // first pane     
    
    if(!m\_SplitterWnd1.CreateView(0, 0,  RUNTIME\_CLASS(CTreeMenuView), CSize(rect.Width()/5,rect.Height()-50), pContext))	          
    	return FALSE;      
           //Second pane     
    
    if(!m\_SplitterWnd1.CreateView(0, 1, RUNTIME\_CLASS(CMainWindowView), CSize(rect.Width()-rect.Width()/5,rect.Height()-50), pContext))     
    	return FALSE;  
    
    	 	int nWidth=rect.Width();
    m\_SplitterWnd1.SetColumnInfo(0, nWidth\*0.25, 50);
    m\_SplitterWnd1.SetColumnInfo(1, nWidth\*0.75, 50);
    
    
    return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
    

    And i have to attach all my child window in right side window( CMainWindowView).. In my app class,

    pDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME,
    RUNTIME_CLASS(CABBHarmonyDoc),
    RUNTIME_CLASS(CChildFrame), // custom MDI child frame
    RUNTIME_CLASS(CMainWindowView));
    if (!pDocTemplate)
    return FALSE;
    AddDocTemplate(pDocTemplate);

    pGraphViewTemplate = new CMultiDocTemplate(
    	IDR\_MAINFRAME,
    	RUNTIME\_CLASS(CABBHarmonyDoc),
    	RUNTIME\_CLASS(CChildFrame), 
    	RUNTIME\_CLASS(CGraphview));
    AddDocTemplate(pGraphViewTemplate);
    

    So when i press F5,this GraphView should display in MainwindowView. But it does not appear.Whats the mistake i did? Pls help me.. in Mianframe.cpp

    void CMainFrame::OnGraphview()
    {

    if( pGraphDisplayFrame == NULL )
    {		
    	CDocTemplate \*pTemplate = theApp.pGraphViewTemplate;
    	CABBHarmonyDoc\* pDoc = new CABBHarmonyDoc;
    	pGraphDisplayFrame = (CMDIChildWnd \*)pTemplate->CreateNewFrame( pDoc ,NULL );
    	if( pGraphDisplayFrame == NULL )
    	{
    		AfxMessageBox( "Unable to Create Graph Display" );
    		return;
    	}
    	pTemplate->InitialUpdateFrame( pGraphDisplayFrame,NULL );
    }
    else
    	MDIActivate( pGraphDisplayF
    
    C / C++ / MFC data-structures c++ help question

  • Multiple monitor support for MFC application
    A Anu_Bala

    In MDI application we cannot move single window to another monitor. I think if you create view using SDI method,then you can move that particular view to next monitor.

    Anu

    C / C++ / MFC c++
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups