Posts

Showing posts from May, 2015

Creating a Tabbed Dialog using the Windows API

Image
An example demonstrating how to create and display a tab common control using WinAPI (Win32) C++ programming. Much credit needs to go to Ken Fitlike's excellent WinAPI site , from which I orginally learned how to do stuff like this. I don't think the site has been updated for a number of years but it contains a ton of useful material on showing you how to create various things using the WinAPI. All that is required to create a Tabbed Dialog is some small modifications to the Simple Window example: the WndProc function handles WM_CREATE and WM_SIZE messages in addition to WM_DESTROY: [code language="cpp"] LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { switch (uMsg) { case WM_CREATE: { return OnCreate(hwnd,reinterpret_cast<CREATESTRUCT*>(lParam)); } case WM_DESTROY: { OnDestroy(hwnd); return 0; } case WM_SIZE: { OnSize(hwnd,LOWORD(lParam),HIWORD(lParam),static_cast<UINT>(wParam)); ...

The Model View Presenter pattern in C# - a minimalist implementation

Image
The Model View Presenter (MVP) is a design pattern that is particularly useful for implementing user interfaces in such a way as to decouple the software into separate concerns, such as those intended for data processing and storage (model), business logic, the routing of user commands, etc, thereby making more of your code available for unit testing. The MVP design pattern separates the following concerns: The Mode l. Stores the data to be displayed or acted upon in the user interface. The View . A passive user interface that displays the model data and routes user-initiated events such as mouse click commands to the presenter to act upon that data. The Presenter . Acts upon the model and the view. It retrieves data from the model, and displays it in the view.