Git Product home page Git Product logo

cwindow's Introduction

CWindow Proyect

The objetive of this project is write a Win32 window wrapper class which requires the minimun user interventionm, and yet, it be extremely fexible. Also, user must be able to extend the class without having to inherit or reimplement any methods.

Otherwise, wherever possible and reasonable, proyect also tried to use names consistent with the Win32 API as a form of assitance to the developer.

Motivation

Anyone familiar with the Win32 API knows that the process for creating windows is rather lengthy: you create a WNDCLASSEX structure, initialize its members and register it (per window class); create the window, check for the validity of the returned handle, and finally display the window. Of course, I neglected to mention that initializing the WNDCLASSEX structures members requires that you define a window procedure first...

So it's logical that the enterprising C++ developer would like to wrap all of the above in a nice class that would allow her write something like:

**CWindow** *wnd = new Window(...); 
wnd->Create(...); 
wnd->Show(...);

Code example

Using this project as as base for applications, the code of these might look like this:

#include "CWindow.h"

int APIENTRY WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, INT nShow) {
	MSG Msg;
	CWindow mainWnd;

	mainWnd = new CWindow(hInst, NULL, "Caption");
	mainWnd.Show();
	mainWnd.Update();

	while(GetMessage(&Msg, NULL, 0, 0) > 0)
	{
	    TranslateMessage(&Msg);
	    DispatchMessage(&Msg);
	}
}

How use it

To use it, you only have to clone CWindow project in a local folder and use that as a base project.

You can create a new instance of CWindow as application main window or you can extend it to make a new window class with more funcionalities.

Contributing

If you have a patch, or stumbled upon an issue with CWindow, you can contribute this back to the code.

References

License

Code and documentation copyright 2014 by Jorge Soto García. Code released under the GPLv2.0 license. Docs released under Creative Commons Share Alike v4.0.

cwindow's People

Contributors

sotogarcia avatar

Watchers

James Cloos 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.