RE: Win4Eu update

new topic     » topic index » view thread      » older message » newer message

Tommy Carlier wrote:

<SNIP> 

> Although Win4Eu hides the low-level stuff for regular users, you can
> still access all the low-level features. An example: structures. You
> can create structures, like you create regular objects, with the 
> create-verb. Here's a simple definition of a structure, and how you
> create an instance:
> }}}
<eucode>
> constant POINT = defineStructure("POINT", {
>    {"x", Int},
>    {"y", Int}
> })
> 
> integer pt, size
> atom address
> pt = create(POINT, "pt", {})
> pokeField(pt, "x", 0, 100)
> pokeField(pt, "y", 0, 100)
> size = getStructureSize(pt) -- get the size in bytes
> address = getStructureAddress(pt) -- get the physical address
> 
> destroy(pt) -- release the memory
> </eucode>
{{{

>
> I will try to make it as easy as possible for people to create
> Windows applications. And another advantage of the object-oriented
> architecture is extensibility: it will be easy to create new controls
> and treat them exactly the same as regular controls (what I earlier
> tried to do with EuControls). 
> 
> --
> tommy online: http://users.telenet.be/tommycarlier
> tommy.blog: http://tommycarlier.blogspot.com
> Euphoria Message Board: http://uboard.proboards32.com
> Empire for Euphoria: http://empire.iwireweb.com

Have you seen structs.e? The version in the RDS contribs is fairly old, 
but still it works well. It's very much like what you have there.

I've got an updated version, that I built for the empire set.
It goes like this..

constant RECT = define_struct({
  {"left",  LONG}
 ,{"top",   LONG}
 ,{"right", LONG}
 ,{"bottom",LONG}
})

atom lprect
lprect = alloc_struct(RECT)

pokes(lprect,{0,0,100,100})
? peeks(lprect) -- print all members
? peeks({lprect,"right"}) -- print the "right" member
? sizeOf(lprect) -- print the size of the struct
? sizeOf({lprect,"left"}) -- print the size of the left member
dealloc_struct(lprect)


There is also addressOf() and offsetOf(), etc..
It also supports arrays, unions, externally allocated structs, and other 
stuff.


Chris Bensler
Code is Alchemy

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu