1. Win32 tutorial

Hi All,

Someone asked for a Win32 tutorial. I am learning myself to program in
Win32, using David Cuny's Win32Lib and other stuff I've collected during
the recent months.
Here is my first attempt; I hope it is appreciated by at least some of yo=
u.

A concise introduction to programming in Win32.

When programming in Windows, you have a huge library of functions at your=

disposal. These functions are called API-routines. API stands for
Application Programming Interface.
This API, although provided by Microsoft, is callable from all kinds of
programs, including 'Euphoria for Win32'. One big advantage of the
Graphical User Interfaces of Windows over Dos is that these API-routines
are not specific to one compiler, and the graphical mode is the only
possible mode.

If you are new to Win32 programming and see such a program for the first
time, you ask yourself : 'Is all this really needed to open a plain
'vanilla' window?'
Look at the file window.exw, provided as an example with Euphoria. It is
more than 200 lines long and a total of 17 API-routines are called.
Apparently these are the basic routines for building even the simplest
Windows application. But it's been a while now since Euphoria 2.0 for
Windows was launched, and as Robert Craig expected, there are already som=
e
'wrappers' available, that hide the dirty details and give an application=

developer tools for building his programs in a simpler way.

As I am a starter myself in this field, I will mainly be concentrating up=
on
one of these include files, Win32Lib.ew by David Cuny. This library is
constantly updated and embettered, so be sure to always download and use
the latest edition. As I'm writing this, version 0.12a is the most recent=

contribution.
The simple window program now really looks quite simple, as can be seen
here:

-- example1.exw
--
-- This opens a blank window

include win32lib.ew

constant SimpleWin =3D  =

    create( Window, "Simple Window", 0, Default, Default, 200, 100, 0 )

WinMain( SimpleWin )

-- end of example1.exw

At the risk of repeating what is already written in Win32Lib.doc, I will
try to explain what the function create() does and what the parameters ar=
e.
The function create() reserves (allocates) space in memory and pokes the
information given in the parameters there. Further on,  your application
can read, act upon and sometimes change this information. The parameters
are:

1. Sort of control. You can create windows, buttons, lists, check-boxes
etc. Later I will explain this further.
2. The name or 'Caption' of the control.
3. The 'owner' or 'parent' of the control.
4. The 'x position' (upper left corner) of the control.
5. The 'y position' (ditto).
6. The width of the control.
7. The heigth of the control.
8. 'Flags' or 'Special Properties' of the control.

This ends the introduction. Provided there is interest, I will be posting=

and writing more of this tutorial.
If you have any questions, please email me.

Ad_Rienks at compuserve.com

new topic     » topic index » view message » categorize

2. Re: Win32 tutorial

Ad Rienks:

Please, Please continue!!  I have been totally clueless!

You are even getting your own folder for win32 tutorials *makes folder* <--
see!!  I just made it!!

drooling for more

snortboy

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32 tutorial

I think the concept of a Win32 tutorial (here or in a software package) is a
great  idea. Ad, you have done a good job explaining the first stage of
Windows programming. It would be great also if David Cuny also wrote a
tutorial that teaches his win32.ew approach. I've started experimented with
it on Thanksgiving and it has tempted me to change my DOS programming ways.
win32.ew is great! However, I'm still a little fuzzy on some areas. Practice
makes perfect, however.

David Gay
http://www.geocities.com/SiliconValley/Vista/4346
A Beginner's Guide To Euphoria

new topic     » goto parent     » topic index » view message » categorize

4. Re: Win32 tutorial

Ad Rienks wrote:

> This ends the introduction. Provided there is interest, I will be posting
> and writing more of this tutorial.

There is interest.  ;')

> If you have any questions, please email me.

Don't know enough to ask questions yet, I think.  I managed to adapt one
windhoos prog to make it work the way I wanted it to, well, almost.  Couldn't
figure out how to get a second window open and working and then closing.
Anyways, thanks.  ;')

\/\/ood/\/\age

new topic     » goto parent     » topic index » view message » categorize

5. Re: Win32 tutorial

John Worthington asked:

>Don't know enough to ask questions yet, I think.  I managed to adapt one=

>windhoos prog to make it work the way I wanted it to, well, almost. =

Couldn't
>figure out how to get a second window open and working and then closing.=

>Anyways, thanks.  ;')

>\/\/ood/\/\age

This is a problem, as David Cuny points out in his documentation. The
second windows behaviour is not stable. But take a look at the Store
Manager program by Michael Sabal(version 0.2). It can be d/l'ed from the
Recent Contributions Page or from Michaels own Homepage. I use the
following rules for a second window:
(Don't know if this is a good solution, but it works for me until now)
1. The second window shouldn't be a child of the first one, but have owne=
r
'0'.
2. When loading the second window, I disable the first one using
setEnable(WinMain, 0). This is to prevent the second window to 'disappear=
'
when the first one is clicked.
3. The second one should only be closed from within itself by it's own
Close Button - this *is* a child of the second window. Don't forget to
setEnable(WinMain, 1) again.

There should be other solutions to keep a second window modal, using the
last 'properties' parameter of create(). I haven't found out yet, only kn=
ow
that for a message_box you can use MB_TASKMODAL. But for a Window I haven=
't
found such a property. I'm open to any suggestion in this matter.

Thanks,
Ad.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Win32 tutorial

Ad:

    Can you make a "list of stuff" to get?  Like, what programs, supplements,
etc. should i have to start with?  thx

snortboy

new topic     » goto parent     » topic index » view message » categorize

7. Re: Win32 tutorial

Ad Rienks wrote:

> John Worthington asked:
> >figure out how to get a second window open and working and then closing.

> This is a problem, as David Cuny points out in his documentation. The
> second windows behaviour is not stable. But take a look at the Store
> Manager program by Michael Sabal(version 0.2). It can be d/l'ed from the
> Recent Contributions Page or from Michaels own Homepage. I use the
> following rules for a second window:

Okey dokey, will do.  ;')


> (Don't know if this is a good solution, but it works for me until now)
> 1. The second window shouldn't be a child of the first one, but have owner
> '0'.

Ah hah!  First mistake of mine!


> 2. When loading the second window, I disable the first one using
> setEnable(WinMain, 0). This is to prevent the second window to 'disappear'
> when the first one is clicked.
> 3. The second one should only be closed from within itself by it's own
> Close Button - this *is* a child of the second window. Don't forget to
> setEnable(WinMain, 1) again.

Ah, alright.  I think I might can figure this out.  ;')

> There should be other solutions to keep a second window modal, using the
> last 'properties' parameter of create(). I haven't found out yet, only know
> that for a message_box you can use MB_TASKMODAL. But for a Window I haven't
> found such a property. I'm open to any suggestion in this matter.

Hey, at least this gave me a good starting point to play with it.  Thanks, Ad.

\/\/ood/\/\age

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu