Results 1 to 3 of 3

Thread: OOP wrapper for Win32 API...

  1. #1

    OOP wrapper for Win32 API...

    Hello, just to expose quite how poor my Delphi knowledge is I'd like to ask for help on the following:

    I'm trying to create a very simple class for the task of creating, displaying etc a window through the Win32 API.

    The reason for this is that I am trying to stay as strictly OOP as possible since I'm told that this is the whole point of Delphi/OPascal. The thing is whenever I look for code to help me in my tasks it always less than OO. For example when I started looking at the OpenGL tutorials at NeHe's and used the Delphi code I noticed that it isn't at all OO - so I thought I'd do it myself.

    However, I'm not quite 'there' yet so I'll start with Win32. I've already had a go but I keep getting tons of Exceptions errors!

    Could anyone suggest what I should be *thinking* about when I try to wrap Win32 (or OpenGL for that matter) into a class?

    I'm happy to post my code but its a mess ops:

  2. #2

    OOP wrapper for Win32 API...

    Hi!

    OOP ist not just writing classes. You should have a look at the TWinControl which is the Delphi OO version of a windowed control (everything with a handle). But TWinControl allocates the handles dyamically,so it may difficult to follow the code.

    Post your code, and we can discuss the problems.

    good luck

  3. #3

    OOP wrapper for Win32 API...

    Trying to do *every*thing as objects is a bit over the edge, IMHO. Thereare always tasks taht better resolved with the plais structural programming. Do not "wrap" the APIs. Create classes you need, make them call the required API functions from their methods.

    Could anyone suggest what I should be *thinking* about when I try to
    These APIs are about states. Think of how the state changes and API calls flow and how this maps onto your class ierarchy. For example, make sure that the texture wrappers are created only after the openGL loader class is created, together with the rendering context. And so on.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •