How do I call the Windows API? Just for reference.

Windows specific questions.
MythGuyDK
Posts: 22
Joined: Sep 21, 2006 20:01

How do I call the Windows API? Just for reference.

Postby MythGuyDK » Feb 21, 2007 19:15

I tried this on the General board. I got a different anwer to my problem. However... I still want to know how to call it.
ytwinky
Posts: 217
Joined: Dec 03, 2005 12:44
Location: MD, Germany

Postby ytwinky » Feb 21, 2007 20:17

Do you know this already?
regards
ytwinky
MythGuyDK
Posts: 22
Joined: Sep 21, 2006 20:01

Postby MythGuyDK » Feb 21, 2007 21:02

That... leads to a useless site... >_>
it has links to similar pages but nothing else...
ytwinky
Posts: 217
Joined: Dec 03, 2005 12:44
Location: MD, Germany

Postby ytwinky » Feb 21, 2007 21:41

I thought you would be interested in the APIGuide..
[Edit]
..so sorry, but the only link I have seems to be outdated..
The APIGuide is no longer available(from that site..)
[Edit2]
http://www.soft-ware.net/hobby/programm ... pro=p03951
Select a DL-Mirror of your choice, the guide is in english
The link is okay, I just downloaded a more recent version than I already have..
regards
ytwinky
coderJeff
Site Admin
Posts: 3410
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Postby coderJeff » Feb 21, 2007 22:28

Most windows API functions (and enums, types, constants, etc) are available in FreeBASIC by including the appropriate header files.

See the ./inc/windows.bi file and ./inc/win/ directory of your FreeBASIC installation.

An example from another post:
yetifoot wrote:i use a zstring as follows, to avoid having to Left(...) to get rid of nulls

Code: Select all

#include "windows.bi"

Dim buffer As ZString * 1024
Dim buffersize As DWORD = 1024

If GetUserName(@buffer, @buffersize) = 0 Then
  Print "Failed to obtain UserName"
Else
  Print buffer
End If

Sleep
ytwinky
Posts: 217
Joined: Dec 03, 2005 12:44
Location: MD, Germany

Postby ytwinky » Feb 22, 2007 11:23

In the API Guide you have explanations, hints and examples, so it's a good overview, imho.
Of course you do not have a reference to all WinAPI-functions
(fyi: Copyright © The KPD-Team, 1998-2002), it is only a point to get started.
Look up a function in the API Guide and then use the appropriate FB-headers..
regards
ytwinky
MythGuyDK
Posts: 22
Joined: Sep 21, 2006 20:01

Postby MythGuyDK » Feb 23, 2007 2:51

OK. This is very helpful.
Thanks,
~Myth
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Postby yetifoot » Feb 23, 2007 13:57

For a lot of things, it really is as simple as

#include "windows.bi"

then you can start using them.

For the last few years the only documentation I would recommend is MSDN.

http://msdn.microsoft.com/

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 6 guests