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
M

madmax0001

@madmax0001
About
Posts
29
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Tooltip problem
    M madmax0001

    Hi Karsten That's it! I just have to call Activate after disabling the parent wnd. Thank you very much

    C / C++ / MFC help question

  • Tooltip problem
    M madmax0001

    Hello Hans, thank you for your answer. I have tried this but it does not work. After calling AfxGetStaticModuleState() in the GetMessageProc, AfxGetApp() returns a NULL pointer within the proc. So I removed AFX_MANAGE_STATE(AfxGetStaticModuleState( )) and then the pointer is OK. (But here is no change in the tooltip behavior)

    LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam)
    {
    // Switch the module state for the correct handle to be used.
    AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
    ...

    I think the problem is not that it is a modeless dialog, because when the dialog is in modeless state, the tooltips work (without any GetMessageProc). This means that PreTranslateMessage within my dialog is called. The problem only occurs when I call

    m\_pParentWnd->EnableWindow(FALSE);
    

    in the dialog class. When I set a breakpoint in PreTranslateMessige procedure of my dialog, I can see that RelayEvent is called (But the Tooltip doens not apear): Btw: My modeless dialog is created in the mainframe, it is not in a dll. Any ideas? regards

    C / C++ / MFC help question

  • Tooltip problem
    M madmax0001

    Hello, I have a problem with a tooltip control in a modeless dialog. I have created the tooltip like this in the dialogs OnInitDialog() function:

    m\_pTip = new CToolTipCtrl();
    m\_pTip->Create(this, TTS\_ALWAYSTIP);
    m\_pTip->SetMaxTipWidth(250);
        m\_pTip->Activate(TRUE);
    m\_pTip->AddTool(this, "TEST");
    

    I also call RelayEvent in PreTranslateMessage. This works fine. But in a certain situation I must disable the parent window of the dialog, so the dialog behaves like a modal dialog. I do this just with

    m\_pParentWnd->EnableWindow(FALSE);
    

    But after this call the tooltips in my dialog do not work anymore. Does someone have a hint for me? Thank you

    C / C++ / MFC help question

  • How to change a single toolbar icon at runtime?
    M madmax0001

    Hello, I have a toolbar with several icons in it and there is one icon that I must change at runtime. How can I manage this? I have tried someting like this, but the code crashes...

    CToolBarCtrl& tb = m\_wndToolBar.GetToolBarCtrl();
    int iButtonCount = tb.GetButtonCount();
    
    CDC dcMemToolbar; 
    CDC dcMemSrc;
    CBitmap SrcBmp;
    CBitmap NewBmp;
    CBitmap\* pOldSrcBmp = NULL;
    CDC\* pDc = GetDC();
    dcMemToolbar.CreateCompatibleDC(pDc);
    dcMemSrc.CreateCompatibleDC(pDc);
    
    SrcBmp.LoadBitmap(IDB\_TOOLBAR);
    pOldSrcBmp = dcMemSrc.SelectObject(&SrcBmp);
    dcMemToolbar.BitBlt(0, 0, iButtonCount\*16, 16, &dcMemSrc, 0, 0, SRCCOPY);	
    
    NewBmp.LoadBitmap(IDB\_INVALID\_ICON);
    dcMemSrc.SelectObject(&NewBmp);
    dcMemToolbar.BitBlt(0, 0, 16, 16, &dcMemSrc, 0, 0, SRCCOPY);	
    
    dcMemSrc.SelectObject(pOldSrcBmp);
    
    m\_wndToolBar.SetBitmap(SrcBmp);
    

    Thank you

    C / C++ / MFC question tutorial

  • Call of OnCreate in a CTreeCtrl derived class
    M madmax0001

    Hello Mark, thank you very much for your help. I have now changed my class and now I do my initialization by calling a special function in my OnInitDialog. Regards

    C / C++ / MFC help question learning

  • Call of OnCreate in a CTreeCtrl derived class
    M madmax0001

    Yes, I forgot to mention this. My code looks like this: void CMyMgrDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMyMgrDlg) DDX_Control(pDX, IDC_CHAIN_TREE, m_treeCtrl2); //}}AFX_DATA_MAP } I have edited nothing here. This code was generated automatically. Regards

    C / C++ / MFC help question learning

  • Call of OnCreate in a CTreeCtrl derived class
    M madmax0001

    Yes, I have done this in the header file: //{{AFX_DATA(CMyMgrDlg) enum { IDD = IDD_MY_MGR_DLG }; CMyTreeCtrl m_treeCtrl2; //}}AFX_DATA The object is created and I can call other functions I have added to CMyTreeCtrl. When I create the object manually without a dialog resource it works: m_treeCtrl2.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_TRACKSELECT|TVS_SHOWSELALWAYS, rect, this, 1234); But I don't want to create all objects manually, I want to use the resource editor to do this.

    C / C++ / MFC help question learning

  • Call of OnCreate in a CTreeCtrl derived class
    M madmax0001

    Hello, I have a problem regarding a CTreeCtrl derived class. I have added a message handler for WM_CREATE: int CMyTreeCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) I placed a CTreeCtrl item on the dialog in the resource aditor and afterwards I have change the class from CTreeCtrl to CMyTreeCtrl. This works. But the problem is, that the OnCreate member function is never called... What did I miss? Regards MM

    C / C++ / MFC help question learning

  • How to prevent a Dialog from being resized by choosen font size?
    M madmax0001

    Hi, I have a CDialogBar derived dialog which is automatically resized by the OS when the user switches from standard size (96dpi) to 120dpi. The problem is, that only the CDialogbar is dependend from the font sizes, and all the other CToolbars have the standard size. Is is possible to prevent the dialog from being resized by the OS? Maybe by setting the fontsize permanently for the dialog to -11 ? Thanks

    C / C++ / MFC help tutorial question

  • Transparent checkbox text?
    M madmax0001

    Hi Ralf, your tip works perfectly for me! Thank you very much !!! Greetings

    C / C++ / MFC tutorial question

  • Transparent checkbox text?
    M madmax0001

    Hi, I have tried to handle WM_ERASEBKGND and I have also set WS_EX_TRANSPARENT for my CButton derived control, but the background still is not transparent. How can I render the text only? I don't want to draw the box and the checkmark myself. Thanks

    C / C++ / MFC tutorial question

  • Transparent checkbox text?
    M madmax0001

    Hi, I need to know how to draw the checkbox button text background transparent. Thanks

    C / C++ / MFC tutorial question

  • Ownerdraw CProgressCtrl with XP Themes
    M madmax0001

    Yes, ok that's what I want to do. But 1.) Win2000 and 2.) Win XP with DEACTIVATED themes draw the border alone. I can't prevent this. And 3.) Windows XP with themes ACTIVATED doesn't draw the border. So if I put some code in the OnPait Proc. to draw a border, the control looks fine in condition 3.). But in condition 1.) + 2.) I got two borders: The one that I draw myself and the one that the OS draw. So I don't know how to solve this...

    C / C++ / MFC help tutorial question

  • Ownerdraw CProgressCtrl with XP Themes
    M madmax0001

    Hi, thank you for your fast reply. I think DrawThemeBackground with PP_BAR will draw the "theme'd" border with round edges. What I want to do is a progress control that looks like a sunken static. The control should just look like a non themed control.

    C / C++ / MFC help tutorial question

  • Ownerdraw CProgressCtrl with XP Themes
    M madmax0001

    Hi, I have derived a class from CProgressCtrl. In OnPaint() I do my painting of the current progress which works fine. But there is a problem when the application uses XP themes: There is no border drawn around the control. I can draw the border myself, but then I got problems with win2000 (-> 2 borders). Does anyone know how to enable the border for a ownerdraw progress control ? thanks

    C / C++ / MFC help tutorial question

  • How to implement a WM_COPY handler for a CEdit derived control
    M madmax0001

    Hi, thank you very much. You're right. I have found my problem. I had implemented a handler for WM_CHAR where my editbox content is formatted. To process WM_COPY commands I must call the base class procedure for WM_CHAR for nonprintable characters like this: void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if(isprint(nChar)==0){ CEdit::OnChar(nChar, nRepCnt, nFlags); return; } // Further processing here } Now the OnCopy implementation is called ! :-)

    C / C++ / MFC help tutorial question

  • How to implement a WM_COPY handler for a CEdit derived control
    M madmax0001

    Hi, I've tried but it is also never called.

    C / C++ / MFC help tutorial question

  • How to implement a WM_COPY handler for a CEdit derived control
    M madmax0001

    Hi, I have written a CEdit derived control for displaying formatted float values. Now I want to implement a handler for WM_COPY and WM_PASTE. The WM_COPY handler for e.g. must copy the unformatted(!) float value to the clipboard. I have tried something like BEGIN_MESSAGE_MAP(CMyNumberEdit, CEdit) ON_MESSAGE(WM_COPY, OnCopy) END_MESSAGE_MAP() ... but OnCopy is never called. Can anyone help me? THX

    C / C++ / MFC help tutorial question

  • Manifest for MFC DLL
    M madmax0001

    Hello, I want to implement XP Visual Styles for a MFC DLL. I've read many infos about it in the web but I have still problems. So what I have done: resource.h #define MANIFEST_RESOURCE_ID 2 I imported a new resource with the type 24 as MANIFEST_RESOURCE_ID. So the .rc file looks like: MANIFEST_RESOURCE_ID 24 MOVEABLE PURE "res\\MyDlgDll.dll.manifest" stdafx.h #define ISOLATION_AWARE_ENABLED 1 compiler otion: /D "ISOLATION_AWARE_ENABLED" When I build the project with VC8 it works fine: The main application can have the visual styles disabled while the DLL always uses XP styles. But I must build the DLL with VC6 and this doesn't work. I have installed the newest Microsoft Platform SDK for Windows Server 2003 R2 where I can see in commctrl.h the #if def section for the ISOLATION_AWARE_ENABLED stuff. I have adjusted the VC6 path to the new include dirc of the platform SDK. But I still use the old VC6 libs because the plaform SDK has no X86 builds of the LIBs. Maybe the problem is the linking of my dll fo mfc42? (When I comile with VC8 the dll is linked mfc80). Can someone help me? THX

    C / C++ / MFC help c++ wpf sysadmin windows-admin

  • CTooltipCtrl for a modeless dialog in a DLL
    M madmax0001

    Hi, me again... a few days a go I posted a problem with showing tooltips in a modeless dialog in a dll. I got a hint which seems to solve the problem. I have done several tests in the meantime and unfortunatelly there is still a small problem with the tooltip. To setup the tooltips for the modeless dialog in my dll I use this function: ////////////////////////////////////////// void CMyDialog::SetToolTip(CWnd* pWnd, LPCTSTR lpszText) { if((pWnd != NULL) && (m_pTip != NULL)){ TOOLINFO ti; ti.cbSize = sizeof(TOOLINFO); ti.lpszText = (LPTSTR)lpszText; ti.hinst = AfxGetInstanceHandle(); ti.hwnd = pWnd->m_hWnd; ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; ti.uId = (UINT)pWnd->m_hWnd; m_pTip->SendMessage(TTM_ADDTOOL, 0, (LPARAM)&ti); } } ////////////////////////////////////////// THe tooltip is shown and this works without (!) any call to CMyDialog::PreTranslateMessage(MSG* pMsg) and RelayEvent. But I need this call, because there is an MFC bug with tooltips for disabled controls and I used in my other modal dialogs this code: ////////////////////////////////////////// BOOL CMyDialog::PreTranslateMessage(MSG* pMsg) { TRACE("PreTranslateMessage\n"); if(m_pTip != NULL){ // The following code is a workaround for a MFC tooltip bug which // prevents the popup of a tooltip for a disabled control in a modal dialog. // Transate the message based on TTM_WINDOWFROMPOINT MSG msg = *pMsg; msg.hwnd = (HWND)m_pTip->SendMessage(TTM_WINDOWFROMPOINT, 0, (LPARAM)&msg.pt); CPoint pt = pMsg->pt; if((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) ::ScreenToClient(msg.hwnd, &pt); msg.lParam = MAKELONG(pt.x, pt.y); // Let the ToolTip process this message. m_pTip->RelayEvent(&msg); } // if return CDialog::PreTranslateMessage(pMsg); } ////////////////////////////////////////// Then I tried to use the message hook which was neccessary to use accellerators in CMyDialog to call PreTranslateMessage: ////////////////////////////////////////// // Hook procedure for WH_GETMESSAGE hook type. LRESULT CALLBACK GetMessageProc(int nCode, WPARAM wParam, LPARAM lParam) // If this is a keystrokes message, translate it in controls' // PreTranslateMessage(). LPMSG lpMsg = (LPMSG)lParam; if((nCode >= 0) && (PM_REMOVE == wParam) && (lpMsg->message >= WM_KEYFIRST && l

    C / C++ / MFC help c++ debugging workspace
  • Login

  • Don't have an account? Register

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