Solved

Set state of toolbar button?

Posted on 2001-08-17
1
644 Views
Last Modified: 2013-11-20
Hi and thank for your time to read my question,

I am using VC6, I have a workspace: CMyApp, and have a toolbar in CMainFrame. I want to set the button of this toolbar to HIDDEN from CMyAppView class, or CMyAppDoc class, but I don't know how the way.

I tried declare a static CToolbar's variable at CMainForm, and in CMyAppView, I call this static variable for my purpose, but not successful.

Pls help me.
Best regards and thanks in advance.
0
Comment
Question by:vinhdh
1 Comment
 

Accepted Solution

by:
resham earned 50 total points
Comment Utility
Hi,

You can access MainFrame's members in ur application by calling AfxGetMainWnd().

Here is the sample code
In view class

CMainFrame *pMainFrm = (CMainFrame*) AfxGetMainWnd();
CToolBar& toolBar = pMainFrm->GetToolBar();
CToolBarCtrl& tbCtrl = toolBar.GetToolBarCtrl();

//To hide the  button
tbCtrl.HideButton(ID_FILE_PRINT, FALSE);

And in MainFrame Class
CToolBar& CMainFrame::GetToolBar()
{
     return m_wndToolBar;
}


Hope this will help.

Resham

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now