dmatch
Joined: 15 Oct 2007 Posts: 113
|
Posted: Sun Jan 06, 2008 3:57 pm Post subject: |
|
|
At http://msdn2.microsoft.com/en-us/library/aa383688%28VS.85%29.aspx is a source for info on the Windows GDI. The DllCall function in AHK fits with the use of the Flat API very well.
Or you can get a SDK helpfile (click here). To do much of anything with the API you would also need a list of Windows constants. Those are in C include/header (winuser.h, wingdi.h etc) files so you would either need them or access to these constants. SKAN has posted a useful tool for fetching constants here:
http://www.autohotkey.com/forum/topic19766.html
As far as doing structures you first use VarSetCapacity to create a variable, then you use NumPut and NumGet to put in data or get out data. You send the Variable (psuedo-structure) address in the DllCall to the particular GDI function. For instance a call using a structure looks something like this: | Code: | VarSetCapacity(LpPoint, 8, 0)
DllCall("MoveToEx", UInt, hCDC, Int, XTopL, Int, YTopL, str, LpPoint,UInt)
XTopL:=NumGet(LpPoint, 0, Int)
YTopL:=NumGet(LpPoint, 4, Int) | As you can see from the DllCall, addresses of structures can be sent as a string (str). Most other variables involved with Windows GDI can be sent with UInt or Int. All handles (hWnd for example) are UInt and numbers like XTopL and YTopL are sent as Int. When counting bytes to a particular offset into a stucture you start at 0 and each HANDLE, DWORD, UINT, INT, LONG occupies 4 bytes. That's why YTopL is found at offset 4 in the above example.
I would recommend getting MoveToEx, LineTo or some simpler function to work first so that the learning curve won't be quite so high. You also have to deal with creating/selecting/deleting objects to get GDI to work so there's quite a lot involved (at least for me). Just holler back if you need more info, if I can't help I bet someone can.
Eited to Add:
I see from looking at your Yahtze game (looks great) that you probably already know all this so.....
Anyway, hope this helps.
dmatch |
|