# Win32 Tutorial Part 2

Before I start talking about the controls available in Win32lib.ew, I'll answer a question by Noah Smith. He asked what stuff he should have to begin Win programming. Well, the Win32lib.zip file contains the .ew include file, a .doc file and 15 example programs. This is the core around which I will be building this tutorial. I think it is a good start to study these example programs, and also the demo programs in the Euphoria\Demo\Win32 directory.

Try to understand what these programs do, try putting in your own routines and see how ( and if ! ) they work. Print out David Cuny's Win32lib.doc file, read it every evening before you go to bed, skipping the parts you don't understand at the first attempt, reread it and again try to write your own routines.

If you want to see a really nice example of what can be done with the current version of Win32lib, look at the Store Manager program by Michael Sabal. At the moment, version 0.2 is available for downloading. I was also quite impressed with the calendar program by DaJaRo, but Mr. Cuny has pointed out that some routines need to be rewritten, because of 'memory leaks'.

Later on, you can look in the Euphoria archives, or in the recent contributions, for other programs using Euphoria for Windows. (Sorry to all those that contributed, I'm not naming you here personally; if I mention no one, no one can be offended because I forgot him or her.)

Oh, and if you are really serious about it, of course there is the book by Charles Petzold: "Programming Windows 95",(1996), Redmont: Microsoft Press- although I never read it, this must be the 'Bible' for Windows programmers. Unfortunately, I think you should have a working knowledge of C and C++ to really be able to work with this book. The same is true for most of the books written on Windows Programming.

This ends this post for today. I'm too tired now, the part on controls will follow tomorrow.

-- example2.exw

    -- (Wolf's "aberration")
    -- This opens a blank window.
    -- and adds an EXIT item to a menubar.

    include win32lib.ew

    constant SimpleWin =
        create( Window, "Tiny", 0, Default, Default, 160, 80, 0 ),
    --  ^^ first, create our simple empty window.
        ExitMenu = create( Menu, "Eξt", SimpleWin, 0, 0, 0, 0, 0 ),
    --                      ^^ then a menu in the menu bar.
    --                             ^^ called EXIT, and accessible by the
    --                                ALT x key combination.
    --                                     ^^ located in the SimpleWin window.

        ExitNow = create(MenuItem,"Now!", ExitMenu,0,0,0,0,0)

    -- next we add a procedure which kills the program.

    procedure onMenu_Exit(integer self, integer event, sequence params )
        closeWindow( SimpleWin )
    end procedure

    -- and here we create an event handler which will kill the program
    -- when the 'Now!" menu item is triggered.
    -- i.e: it will "run" the above procedure !

    SetHandler( ExitNow, w32HClick, routine_id("onMenu_Exit") )

    WinMain( SimpleWin, Normal )

    -- end of example2.exw

..end of lesson.

CONTENTS