SOL9 Sample: HelloWorld

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * HelloWorld.cpp 
 * Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL9
// 2009/10/08

#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include "resource.h"

namespace SOL {

class HelloWorld :public ApplicationView {

public:
  /**
   * Constructor
   */
  HelloWorld(Application& applet, const TCHAR* label, Args& args)
    :ApplicationView(applet, label, args)
  {
    addEventHandler(WM_PAINT, this, 
        (Handler)&HelloWorld::paint, _T("Hello world"));
    
    addCallback(XmNmenuCallback, IDM_EXIT, this,
      (Callback)&HelloWorld::exit, NULL);
  }

private:
  long paint(Event& event)
  {
    PaintDC pdc(this);
    TCHAR* text = (TCHAR*)event.getData();
    if (text) {
      pdc.setBkColor(RGB(0, 0, 255));
      pdc.setTextColor(RGB(255, 255, 255));

      pdc.textOut(100, 100, text, strlen(text));
    }
    return 0L;
  }
};
}


void  Main(int argc, TCHAR** argv)
{
  ModuleFileName module(argv[0]);
  const TCHAR* name = module.getFileName();
  try {
    Application applet(name, argc, argv);

    Args args;
    HelloWorld hellov(applet, name, args);
    hellov.realize();
    applet.run();

  } catch (Exception& ex) {
    caught(ex);
  } catch (...) {
    caught(UnknownException());
  }
}






Last modified: 1 Feb 2017

Copyright (c) 2017 Antillia.com ALL RIGHTS RESERVED.