CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Location
    Poland
    Posts
    12

    Own Windows shell replacement - help in OOP

    I'm writing my own shell replacement for Windows 7 and 8 (32 & 64bit). This is my hobby and I do this program for personal use only.

    Currently I have done (in 90% - small issues left) reverse-engineering of the system tray. Now i'm trying to create the taskbar. Unfortunately I don't know how to create objects and how to set relationships between them. It's mostly about message management and the drawing.

    I have base class called CWindow which provide basic functionality of window-controls and windows with title bar. My taskbar class called CTaskbarWnd is a class derived from CWindow. CTask is a base class having information about a task.

    At the moment I decided to create a separate class, which will be used to draw the buttons. Object of this class through a pointer will access to information about the task. CTaskbarWnd will use this class to draw specific button.

    I mean something like that:

    Code:
    CTask *pBtnTask;
    WM_PAINT:
       hDC = BeginPaint(hWindow, &ps);
       iter = taskList.begin();
       while (iter < taskList.end())
       {
           pBtnTask = (*iter);
           pTaskBtnPainter->PaintBtn(hDC, &pBtnTask);
           iter++;
       }
       EndPaint(hWindow, &ps);
    break;
    Or maybe it would be better if each of these buttons will be a window, which itself will be painted?

    I am asking for help because I want to do it in right way, I mean OOP.

    By the way - is there someone who has experience in creating their own shell and would be willing to help?

  2. #2
    Join Date
    Dec 2008
    Posts
    144

    Re: Own Windows shell replacement - help in OOP

    I would stick to idea of creating buttons as windows. And they will be able to paint themself.
    As for me, having a separate class only for buttons painting is not the best solution. Painting is more an action than an object. In theory, any class should represent some real object or entity.

  3. #3
    Join Date
    Aug 2011
    Location
    Poland
    Posts
    12

    Re: Own Windows shell replacement - help in OOP

    Ok, thanks for the advice, I did it exactly in this way. My taskbar is fully working now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured