Coder Social home page Coder Social logo

wwpw's Introduction

Windows Window Procedure Wrapper

A object-oriented wrapper for the windows window procedure.

Usage

Definig your window class

Example:

class Window : public ww::WindowBase<Window> {
public:
    LRESULT CALLBACK HandleMessage(UINT Message, WPARAM WParam, LPARAM LParam) override {
        // Handle messages here
    }

    static constexpr LPCTSTR ClassName = "my_window_class";
};

The HandleMessage function

This replaces the WindowProc function. The parameters Message, WParam and LParam are the parameters passed to the internal WindowProc function. The window handle is not passed as an argument as it can be accessed as a member of the window class.

The ClassName value

This defines the name of the window class the window uses. This does not have to be unique across multiple window classes.

Creating a window

Example:

Window wnd;
ww::CreateStruct params = {...};
wnd.Create(params);
wnd.Show(nCmdShow);

WindowBase::Create

Creates the window with the given parameters.

WindowBase::Show(int CmdShow)

Shows the window in the given show mode. The first time this is called this should be the nCmdShow parameter passed obtained by the WinMain. For more information about this value see the ShowWindow documentation.

The CreateStruct

The struct is defined as

struct CreateStruct {
	LPCTSTR Name;
	int     Width   = CW_USEDEFAULT;
	int     Height  = CW_USEDEFAULT;
	int     X       = CW_USEDEFAULT;
	int     Y       = CW_USEDEFAULT;
	HWND    Parent  = NULL;
	LONG    Style   = WS_OVERLAPPEDWINDOW;
	HMENU   Menu    = NULL;
	DWORD   ExStyle = 0;
};

Fields:

  • Name - The window title
  • Width, Heigh - The dimensions of the window
  • X, Y - The position of the window
  • Parent - The parent window
  • Style - The window style
  • Menu - The menu to use
  • ExStyle - The extended window style

wwpw's People

Contributors

jamo42 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.