Add API Functions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Blankname
Enthusiast
Enthusiast
Posts: 120
Joined: Sun Oct 14, 2012 9:11 am

Add API Functions

Post by Blankname »

I am in need of these API functions support in PB.

Code: Select all

http://msdn.microsoft.com/en-us/library/windows/desktop/ms684894(v=vs.85).aspx
Can they be added in 5.20? Thanks
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Add API Functions

Post by PB »

MSDN wrote:Minimum supported client: Windows XP [desktop apps only]
Since PureBasic supports all the way back to Win 95, these won't be added.
Fred has stated in the past that only APIs made for all Windows get included.

That said, you CAN always call them manually yourself, assuming the relevant
DLLs (or needed files) are installed on the client machine. It's as easy as this:

Code: Select all

; Pseudo-code; not a working example!

If OpenLibrary(0,"psapi.dll") And GetFunction(0,"EmptyWorkingSet")
  result=CallFunction(0,"EmptyWorkingSet",arg1$,arg2$)
  CloseLibrary(0)
EndIf
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Add API Functions

Post by c4s »

PB wrote:Since PureBasic supports all the way back to Win 95 [...]
Just as a small side note: If I recall correctly, support for Win95 has been dropped with PB5.10.
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
Blankname
Enthusiast
Enthusiast
Posts: 120
Joined: Sun Oct 14, 2012 9:11 am

Re: Add API Functions

Post by Blankname »

PB wrote:
MSDN wrote:Minimum supported client: Windows XP [desktop apps only]
Since PureBasic supports all the way back to Win 95, these won't be added.
Fred has stated in the past that only APIs made for all Windows get included.

That said, you CAN always call them manually yourself, assuming the relevant
DLLs (or needed files) are installed on the client machine. It's as easy as this:

Code: Select all

; Pseudo-code; not a working example!

If OpenLibrary(0,"psapi.dll") And GetFunction(0,"EmptyWorkingSet")
  result=CallFunction(0,"EmptyWorkingSet",arg1$,arg2$)
  CloseLibrary(0)
EndIf
In my opinion anything older than Windows XP should be dropped, including the DirectX 7 subsystem. There is less than 0.01% of people who use Windows older than XP worldwide. If PureBasic is going to progress and become a popular language, it will eventually need to drop older versions of Windows anyways. Windows 95, Windows 98, Windows ME, and Windows 2000 all should be dropped from support. That alone would free up a lot of code, and take a load off the development team. I know its there and they haven't had any issues with it, but that's because no one uses it. Current support could be left in, but why waste the resources if it's not going to be used. Especially when older versions of PureBasic will always support older versions of Windows. It would be a right move by Fred in taking the PureBasic language forward. The more Windows XP to Windows 8 support there is, the more useful and popular the language will become. Or just leave it as it is and add in the PSAPI functions, then add a little note to the documentation "only supported on Windows XP and later". That is peaceful compromise as you seem to be bothered by PureBasic improving.

P.S. PSAPI functions are included in all Windows...

...that people actually use.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Add API Functions

Post by c4s »

Blankname wrote:In my opinion anything older than Windows XP should be dropped, including the DirectX 7 subsystem. [...]
c4s wrote:Just as a small side note: If I recall correctly, support for Win95 has been dropped with PB5.10.
I guess DirectX7 too:
PB 5.10 Changelog wrote:- Removed: DirectX7 and NT4 subsystem on Windows
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Add API Functions

Post by PB »

> support for Win95 has been dropped with PB5.10

Where does it say that? Dropping DX7 is a different issue.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Add API Functions

Post by c4s »

PB wrote:> support for Win95 has been dropped with PB5.10
Where does it say that?
Sorry, I confused NT4 with Win95.

Anyway, it's obvious that support for such an old system should be dropped very soon in favor of updated API support.
What about making XP the low end on Windows? Even XP is so old that extended support from Microsoft will stop next year...
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Add API Functions

Post by Danilo »

c4s wrote:Anyway, it's obvious that support for such an old system should be dropped very soon in favor of updated API support.
You can provide the newest import libraries, even with Win8 functions. As long as you don't use these
functions, they get not linked to your .EXE and you are still able to write Win95 programs.

It is a little bit more complicated with some structures, because some structures have additional fields
on newer version of Windows. PB's "resident" files do not support a switch like WINVER yet, so the PB team
wants to provide the most compatible (Win95) structures.
Post Reply