AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

gdi32 help please

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
daveand5



Joined: 09 Nov 2007
Posts: 18
Location: http://taplpoker.com/

PostPosted: Sun Jan 06, 2008 2:24 pm    Post subject: gdi32 help please Reply with quote

does anyone have a complete list of function calls to gdi32 ??
and also when it asks for a structure such as bezier with 5 sets of points, how do you do that with ahk?
_________________
visit my website
Back to top
View user's profile Send private message Send e-mail MSN Messenger
dmatch



Joined: 15 Oct 2007
Posts: 113

PostPosted: Sun Jan 06, 2008 3:57 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group