Hi all,
Okay, this should be a simple answer. I'm having a problem with API, here is the example. Sometimes a API call needs a variable/constant like #NULL #PROCESS_TERMINATE, that kind of thing. Most of the time PB has the contant defined already, but in some cases it doesn't. So I end up doing this.
somecall_(#null,PROCESS_TERMINATE,...) I just put the in this case process Terminate in as text, not even a string how ever windows seems to have a issue with that. Am I doing something wrong? I think I am so I ask you here and now. Yes, the above is just a example, so keep that in mind. Thanks in advance.
API question
kake,
PB has most of the windows constants defined, but there are some of them missing.
You can obtain the missing values from a number of places. I have Dev-Cpp installed so I was able to find #define PROCESS_TERMINATE 1 in the wint.h file.
If you don't have the windows headers, just google for it. You should find some code in VB that gives you the correct value. VBers have declare all of the constants for themselves, poor things.
When you replace the value with just the word, without the #, you are using a variable. PB creates the variable and sets it to 0, when you want 1.
This is what to do.
Add the line:
To the top of you're code.
Then report the missing constant as a bug so that it can be fixed for the next version of PB.
PB has most of the windows constants defined, but there are some of them missing.
You can obtain the missing values from a number of places. I have Dev-Cpp installed so I was able to find #define PROCESS_TERMINATE 1 in the wint.h file.
If you don't have the windows headers, just google for it. You should find some code in VB that gives you the correct value. VBers have declare all of the constants for themselves, poor things.
When you replace the value with just the word, without the #, you are using a variable. PB creates the variable and sets it to 0, when you want 1.
This is what to do.
Add the line:
Code: Select all
#Process_Terminate = 1
Then report the missing constant as a bug so that it can be fixed for the next version of PB.
-
gnozal
- PureBasic Expert

- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Not all Windows API constants are defined in Purebasic.
If one is not, you have to do it yourself : #CONSTANTNOTFOUND = 1 for example. Just typing CONSTANTNOTFOUND without # will not do it !
Where do you find the value of the constant ?
There are some lists around in the forum. I use myself a little proggy I made : viewtopic.php?t=11457
If one is not, you have to do it yourself : #CONSTANTNOTFOUND = 1 for example. Just typing CONSTANTNOTFOUND without # will not do it !
Where do you find the value of the constant ?
There are some lists around in the forum. I use myself a little proggy I made : viewtopic.php?t=11457
Re: API question
> Am I doing something wrong?
YES! You can't just make up your own values. If a constant's value is not yet
known to PureBasic, the quickest way to find it (IMO) is to do a Google search
for: vb CONSTANT_NAME -- you'll see the value listed for Visual Basic users,
which you can then use correctly with PureBasic.
For example, the constant #MIN_ALL is not known to PureBasic, but a Google
search for vb MIN_ALL shows that it's 419 (in decimal) so just use that at the
top of your PureBasic app like so: #MIN_ALL=419
Hope this helps!
YES! You can't just make up your own values. If a constant's value is not yet
known to PureBasic, the quickest way to find it (IMO) is to do a Google search
for: vb CONSTANT_NAME -- you'll see the value listed for Visual Basic users,
which you can then use correctly with PureBasic.
For example, the constant #MIN_ALL is not known to PureBasic, but a Google
search for vb MIN_ALL shows that it's 419 (in decimal) so just use that at the
top of your PureBasic app like so: #MIN_ALL=419
Hope this helps!

