Visual C++ :: Create A New Toolbar With Icons?
May 23, 2013how to create a new toolbar with my icons in vc++?
View 3 Replieshow to create a new toolbar with my icons in vc++?
View 3 RepliesI have a dialog window with a CTabCtrl. The following code is successful in showing an icon along with the text name on each of 16 tabs. The icons are 16x16 pixel squares, 4-bit, that I made with Visual Studio 2008's resource editor.
The icons to have transparent pixels (the first pixel of the color map), so that I can "shape" them to be circles, etc., instead of squares.
However, the transparency works ONLY IF I use ILC_COLOR8 instead of ILC_COLOR4, and use LR_LOADMAP3DCOLORS. (Neither of these are documented as being related.) If I don't have LR_LOADMAP3DCOLORS, or if I use ILC_COLOR4, the "transparent" parts of the icon are colored white instead.
My code now works....
// Configure the Tab control.
CTabCtrl* ptab = (CTabCtrl*) GetDlgItem( IDC_TAB1 );
static CImageList* pil = NULL;
if ( ! pil ) {
pil = new CImageList;
[Code] .....
The goal is to change the status bar (CMFCRibbonStatusBar) icons based on some events. (The old CMFCStatusBar class had the SetPaneIcon() member that easily solves the problem.)
The "improved" CMFCRibbonStatusBarPane has no members to set the icon, other then the constructor. Being a subclass of CMFCRibbonButton, it has SetImageIndex() that sets the icon index in the image list. The MS online support does not mention how and where to set that "list of images". My understanding is that the list belongs to the Button's parent; in this case it is the CMFCRibbonStatusBar, which has no methods to set any image list. How and where am I supposed to set that list of images for the status bar?
Second related question: I have tried to set the pane icon with the CMFCRibbonStatusBarPane() constructor by loading it from an icon resource. The icon appears shortly and then it is replaced by a gray patch. (for tests I also used one of the icons given by the MFC wizard, with the same result)
The code is:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
..........
if (!m_wndStatusBar.Create(this)) {
TRACE0("Failed to create status bar
");
[Code] ....
This code was placed within a program created by the MFC wizard that does nothing else. I absolutely do not "touch" the status bar after it is created here in CMainFrame::OnCreate().
Apparently the icon is "erased" after OnCreate() exits. Where, how? I have made HICON icon; a member of my CMainFrame class, with the same result.
I want to control my toolbar dynamically.
First I added tool bar with style including TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_LIST.
Then added the tool bar to a rebar. I added tool tips by handling TTN_GETDISPINFO.
Everything works fine. But when I try to add text to right of the button, the text
gets added but button size is not automatically changing.
The following code is not working .
void SetToolbarText(HWND& hwndToolbar,LPTSTR szText)
{
ATLASSERT(::IsWindow(hwndToolbar));
TBBUTTONINFO tbbi = { 0 };
tbbi.cbSize = sizeof(TBBUTTONINFO);
tbbi.dwMask = TBIF_TEXT;// | TBIF_SIZE;//if I add TBIF_SIZE code will work!
tbbi.cchText = 0;
tbbi.cx = 200;
[Code]...
How to detect when mouse pointer entering on toolbar .
View 2 Replies View RelatedVisual Studio 2013. C++.
Created a blank, SDI MFC app.
I added a new CMFCToolBar (by hand, didn't use a wizard)
It docks OK. The commands work OK. It renders OK. No problems there.
In the code, attempting to set the window text of this toolbar has no effect. The title bar text is always "Standard". I triple triple triple checked to make sure I don't have any resource ID conflicts. In a small app as this, it was pretty easy to verify this.
The toolbar also does not show in the menu illustrated in the screenshot. (The bottom, undocked toolbar should be titled "My Page Bar" and I think it should show up in the popup menu.)
I know I'm probably missing a simple step somewhere, but I haven't seen it. It looks like its getting mixed up with the Standard Toolbar resource ID somewhere but I could see nothing in the .rc or resource.h files.
//#import "c:windowsSysWow64mscomctl.ocx" raw_interfaces_only //in window7
using namespace MSComctlLib;
CComPtr<IButtons> pButtons;
CComPtr<IButton> pButton;
CComPtr<IImages> pImages;
[Code] ....
My problem is ToolTips are not shown if any of the tool-bar menu items is disabled/inactive.
They are shown when all tool bar menus are active/enabled.
I am using TTS_ALWAYSTIP while creating Tool-Bar.
What to do to enable/display tool-tips always.
I am searching an API that can give me thumbnail(with large Icons) of all folders of all drive in Windows 7. Like
c:/--->Folder1,Folder2.....FolderN
d:/--->Folder1,Folder2.....FolderN
.
.
n:/--->Folder1,Folder2.....FolderN
How i can get associate thumbnail(with large Icons) of each folders of any of the drive.
I am trying to create a OCX from a C++ dll., Here's the scenario I have a C++ dll and this dll needs to be called in VB.net program my boss want's me to create an OCX out of this.
C++ dll and use it in a VB.net class library, apparently I have created an OCX but it requires a form but the VB.net program is a class library.
I'm trying to create a simple webbrowser at my app.
code sample:
....
ATL::CAxWindow m_wndContainer;
ATL::CComPtr<IWebBrowser2> m_spWebBrowser;
HWND hWnd = m_wndContainer.Create(NULL,
CRect(0,0,200,100),
(LPCTSTR)0,
WS_CAPTION|WS_THICKFRAME|WS_OVERLAPPED|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
CoCreateInstance(CLSID_WebBrowser,NULL,CLSCTX_INPROC,IID_IWebBrowser2,(void**) &m_spWebBrowser);
...
everything is work fine except the fact the it seems that it create an IE version 7.0 and my machine have IE 8 installed.
it not suppose to create the IE according to my installed version?how do i suppose to do it?
How can I create a dialog as a DLL ? I have a SDI MFC app (CView is based on CFormView) and from a button I want to load a modal dialog, but that dialog must be developed as DLL ... I didn't find something that fit my needs on internet ... P.S. I have only VC6 !
View 14 Replies View Relatedhow to create, initialize, and maintain a memory device context that works as a local buffer for images? The idea is to maintain some large images in local DCs and bitmaps, and only bitblt them to screen in OnDraw().
What I did so far was was to define CDC and CBitmap objects as members of my View class, and then tried to initialize them with the sequence that begins at "// Initialize buffer". I placed that sequence in either OnInitialUpdate, or PreCreateWindow, or OnPrepareDC, or the view constructor, to no avail. The code always crashes in OnDraw, and I've noticed that the m_hDC member of myDevice is zero at that point.
Obviously, the initialization is wrong and MFC does (too many) things in the background which I'm not aware of.... My question was where can I read about that?
Code:
class CMyView : public CScrollView {
// ...
CDC myDevice;
CBitmap bmp;
CBitmap *oldbmp;
[Code] .....
How can I create MS Word 'print layout' like interface. The attached picture says it all. Basically I want a shaded area around my document just like word so it gives a feel of the 'page'.
I was hoping I can override some function somewhere and along that lines tried playing around with below but that didn't work.
Code:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) {
if( !CFrameWndEx::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = 250; // just playing around with size
cs.cy = 250;
return TRUE;
}
How can I do that?
I want to create a basic window using visual c++ 2010 express.
View 1 Replies View RelatedHow can I implement the paradigm demonstrated by the code below to run on WinXP?
I want to fork a process or create a thread that shares global variables with the parent process/thread.
The child process/thread monitors the progress of the parent process/thread.
I cannot find documentation for a fork function per se, a Unix term. It might be called something different for WinXP.
I would be happy to use threads instead. But I'm rusty even with Unix application threads; and I know nothing of WinXP application threads.
So any turnkey implementation that demonstrates the simplest use of process or thread functions for my purpose demonstrated below.
In either case, do "forked" processes and threads share global address space in WinXP, as they do in Unix?
I would prefer to avoid the overhead of IPC mechanisms. The "overhead" includes my own relearning curve.
The GUI screwed up my indentation. I would try to correct it. But the proper indentation appears when I edit the posting. I suppose I need to insert real tabs. Haven't figured out how (yet).
Not even real tabs work; and I cannot get the "paste as text" button to behave as I expect. What is the trick for posting indented text in this GUI?
#include "stdafx.h"
#include <stdlib.h>
#include <Windows.h>
long curCount;
int isRunning;
int _tmain(int argc, char* argv[]) {
curCount = 0;
isRunning = 1;
[code]....
Is it possible to create an NPAPI Plugin in VC++, that is cross browser compatible or should atleast work in Chrome Browser?
View 1 Replies View RelatedI am wokring on a project that has used an MFC DLL in conjunction with Outlook to send and archive mail. I need to be able to create folders for integration from an older mail system. I have looked online to see if there are examples in C++ (since I have to modify the existing C++ dll to include the funcitonality). I realize it is much simpler using VBA or C#, but I am limited with my choice. I essentially want to use the MFC type lib for Outlook 14 and use the CMAPIFolder,CFolders create folders in the Inbox.
here is a sample of the code:
//I have included the necessary header files
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
//start outlook
if (!olApp.CreateDispatch(_T("Outlook.Application"), &e))
[Code]....
I compiled the source code of QT5.1 to work with Visual Studio 2010.
But it always start off with a win32 project, so that I need to change the settings every time.
How do I kick start with a x64 project by default?
I'm trying to create an edit box in a CView.So far, this is how far I've gotten:
With this code
Code:
// .h
CEdit m_MyEditField;
// .c
m_MyEditField.Create(WS_CHILD | WS_VISIBLE,CRect(40,40,500,Y+55),this,0x1552);
m_MyEditField.SetWindowText("this is my CEdit field");
As you can see, the edit box doesn't look like the ones in a dialog, which is what I'm trying to accomplish.
Is there possibly some other class I should be using for the edit box?Or another setting for .Create?
C-> Visual studio 2010-> windows 7
How to create a directory / folder.( to browse/save my files to a directory.) how to specify the path?
I googled , but i cant able to find appropriate as it is showing all in the C#, C++ , objective C. But not in C.
Here i am writing a sample program to my POS device .problem here is it is not taking mkdir(direct/dir.h header file)function. Any alternative is there to make a directory?
I have a text file which consist of several values. These values represent distance from origin to any point in the triangle. How can I create histogram from these values? Is there any functions in OpenCV which can create histogram from these values? Below my sample values are given:
..........................
3.4 1.2 6.9 0.2 5.1 2.9
........................
I have a MFC Com Dll that has a CDialog. In the OnCreate event I create an ActiveX control. The dll is hosted inside an executable of mine. In this scenario everything works fine!
The dll is also called from an external executable and then a Debug Assertion in OCCSITE.cpp occurs when I create the ActiveX control. I suspect that in the executable there is no AfxOleInit. I spend some time with this problem and tried to CoInitialize, OleInitialize, AfxOleInitModule and even AfxOleInit in the dll. But all that does not change a thing. If I understand the mechanics then this is an intended behaviour and should be done in the host exe.
What I observed in the OCCSITE.cpp:
Code:
_AFX_THREAD_STATE* pState = AfxGetThreadState();
if (!pState->m_bNeedTerm && !AfxOleInit())
return hr;
In my executable m_bNeedTerm is 0 and in the external one (where the ActiveX does not work) it is -1. In AfxOleInit this is explained as a special flag to prevent the dll from doing an unnecessary OleInitialize. But as I said even if I call OleInitialize myself I get the Debug Assertion and the ActiveX is not visible.
Is there anything I can do to make the ActiveX control work in the external application? Obviously I cannot Change anything in the application...
Is there an easy way to create a column of buttons ina listView?
I need that every file of the listView has a button in the first cell. Is that possible?
I need to create a function using rot to encrypt certain strings the function begins like this
#include "encrypt.h"
std::string encrypt (std::string text, int rot) {
for (int i
and ends like this
return NULL;
}
dont need to write the string encrypted and dont need to crate a decrypt function.
Is it possible to create property which I can pass parameters? Here is what I would like to do:
__property double a = {read=getA("a"), write=setA("a")};
__property double b= {read=getB("c"), write=setB("c")};
double getA(char *a);
void setA(double value, char *a);
double getB(char *a);
void setB(double value, char*a);