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
P

Philipp Kursawe

@Philipp Kursawe
About
Posts
10
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Handling LVN_DELETEITEM in CListViewCtrl subclass
    P Philipp Kursawe

    I would like to handle LVN_DELETEITEM in my subclass:

    class DailyProgramListView :
    public ATL::CWindowImpl<DailyProgramListView, WTL::CListViewCtrl, ATL::CWinTraitsOR<LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SINGLESEL>>,
    public WTL::CCustomListViewDraw<DailyProgramListView> {

    BEGIN\_MSG\_MAP\_EX(DailyProgramListView)
      MSG\_WM\_CREATE(OnCreate)
      MSG\_WM\_SIZE(OnSize)
      REFLECTED\_NOTIFY\_CODE\_HANDLER\_EX(LVN\_DELETEITEM, onDeleteItem)
      NOTIFY\_CODE\_HANDLER\_EX(LVN\_DELETEITEM, onDeleteItem)
      CHAIN\_MSG\_MAP\_ALT(WTL::CCustomListViewDraw<DailyProgramListView>, 1)
      DEFAULT\_REFLECTION\_HANDLER()
    END\_MSG\_MAP()
    

    };

    For some reason, the LVN_DELETEITEM is still only posted to the parent of the listview. The parent has REFLECT_NOTIFICATIONS_EX() in its MSGMAP.

    Happy coding, Philipp Kursawe

    ATL / WTL / STL c++

  • Are WS_POPUP windows not disabled when a modal dialog box is displayed?
    P Philipp Kursawe

    Hello! I have a WS_POPUP window created with another window as its parent (parentWindow). When I create a modal dialogbox with parentWindow as its parent I can still click and modify the popup window. Are not other windows of the app disabled when a modal dialogbox is displayed?

    Happy coding, Philipp Kursawe

    Windows API question

  • How to prevent listview from redrawing when setting its columns width?
    P Philipp Kursawe

    I am already using WM_SETREDRAW but the listview still redraws itself during LVM_SETCOLUMNWIDTH calls.

    Happy coding, Philipp Kursawe

    Windows API tutorial question

  • How to get IDOK / IDCANCEL command message from an non-modal dialog set as client in CFrameWindowImpl?
    P Philipp Kursawe

    What I want to achieve is that my tabbed windows use the IsDialogMessage to behave as if they were dialogs. So I have implemented a handler for WM_FORWARDMSG in each of my tabviews windows. In my MainFrame I call tabview.PreTranslateMessage() which correctly forwards the message to the current active tab window. My CWindowImpl of each tab window has this: MESSAGE_HANDLER_EX(WM_FORWARDMSG, OnForwardMsg) LRESULT OnForwardMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) return IsDialogMessage((LPMSG)lParam); } However, pressing the VK_RETURN or VK_ESCAPE key does not result in a WM_COMMAND message being sent to the tabviews window.

    Happy coding, Philipp Kursawe

    ATL / WTL / STL hardware tutorial question

  • How to create an flicker free owner draw listbox using CDoubleBufferWindowImpl?
    P Philipp Kursawe

    Thanks Alain, this works (almost)! I am using your WTL::CControlDialogImpl to show the listbox in a modal dialog. The drawing is a little off now.

    void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT item)
    if (item->itemID == -1) return;

    WTL::CDCHandle dc(item->hDC);
    
    dc.GradientFillRect(item->rcItem, RGB(200,200,200), RGB(10,10,10), false);
    if (item->itemState == ODS\_FOCUS) {
      dc.SetTextColor(RGB(255,255,255));
    } else {
      dc.SetTextColor(RGB(255,255,255));
    }
    WCHAR text\[1024\];
    int chars = m\_Ctrl.GetText(item->itemID, text);
    dc.SetBkMode(TRANSPARENT);
    dc.SelectFont(font);
    dc.DrawText(text, chars, &item->rcItem, DT\_NOPREFIX | DT\_SINGLELINE | DT\_CENTER | DT\_VCENTER | DT\_END\_ELLIPSIS);
    

    }

    After some rows the gradients stop to show up and the background is just the standard window color.

    Happy coding, Philipp Kursawe

    ATL / WTL / STL tutorial question

  • Using CContainedWindowT in a base class causes assert in conrete class
    P Philipp Kursawe

    Thanks Alain for your reply! Maybe I should describe what I want to achieve: I want to subclass a child window and pre-handle certain messages in my class before the child window can process them itself. I thought CContainedWindow was the way to go then? In the particular case I want to set the background colour of the window.

    Happy coding, Philipp Kursawe

    ATL / WTL / STL c++ help

  • How to get IDOK / IDCANCEL command message from an non-modal dialog set as client in CFrameWindowImpl?
    P Philipp Kursawe

    Hello! I have a CTabViewImpl set as the client in a CFrameWindowImpl. I wonder how its possible to get WM_COMMAND messages from the active tab page's dialog. When I have the same dialog template used in a modal dialog, the IDOK and IDCANCEL buttons placed in the template generate the appropriate WM_COMMAND messages. However, when I use the dialog template as a page in the CTabViewImpl the WM_COMMAND messages are no longer generated. Usually a press on ESC oder RETURN generate the WM_COMMAND messages. Any way to have this mechanism work in embedded, non-modal dialogs too?

    Happy coding, Philipp Kursawe

    ATL / WTL / STL hardware tutorial question

  • Using CContainedWindowT in a base class causes assert in conrete class
    P Philipp Kursawe

    I have a base template class

    template<class T, UINT titleId, int SortIndex, class WindowClass = ATL::CWindowImpl<T>>
    class ATL_NO_VTABLE ITabPageImpl : public WindowClass {

    BEGIN_MSG_MAP_EX(ITabPageImpl)
    MSG_WM_CREATE(onCreate)
    MSG_WM_DESTROY(onDestroy)

    REFLECT\_NOTIFICATIONS\_EX()
    

    ALT_MSG_MAP(1)
    NOTIFY_CODE_HANDLER_EX(LVN_DELETEITEM, onModifyTable)
    END_MSG_MAP()

    ITabPageImpl() : _table(this, 1) {}

    private:
    ATL::CContainedWindowTWTL::CListViewCtrl _table;

    In the onCreate method I subclass a control, if the implementation provides a specific method:

    __if_exists(T::getTableControl) {
    _table.SubclassWindow(static_cast<T*>(this)->getTableControl());
    }

    However, after subclassing the message loop of T produces an assertion when the subclassed control is supposed to process its first message. The basic Idea is, that I want to put handling of certain messages in the base class and lift the burden on implementation classes. Thanks for any help!

    Happy coding, Philipp Kursawe

    ATL / WTL / STL c++ help

  • How to create an flicker free owner draw listbox using CDoubleBufferWindowImpl?
    P Philipp Kursawe

    Hello, I am struggling to fit CListBoxCtrl and CDoubleBufferWindowImpl together. I have a owner drawn listbox ready, whose MSG_WM_DRAWITEM I handle in the parent control for now. I guess the first step would be to move the MSG_WM_DRAWITEM message handling to my custom listbox control. How would I then also fit in the double buffer technique? My solution was something like in the DoPaint method to call the original controls DefWndProc but that does not work. Any ideas?

    Happy coding, Philipp Kursawe

    ATL / WTL / STL tutorial question

  • How do I use CWindowWithReflectorImpl?
    P Philipp Kursawe

    I wanna implement a toolbar for Windows using WTL classes like CToolBarCtrl. For the toolbar to work I saw in numerous examples that you have to create a reflection window, that is essentially a hidden parent for the toolbar so you can fetch the commands send by the toolbar. I wonder if you could implement a reflective toolbar using the CWindowWithReflectorImpl? I never got it to work though. The created window did not repaint itself and the toolbar was not visible. Anyone here knows how to use CWindowWithReflectorImpl? Thanks in advance!

    Happy coding, Philipp Kursawe

    ATL / WTL / STL question c++ tutorial
  • Login

  • Don't have an account? Register

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