Restored from previous forum. Originally posted by StSchnell.
Hello community,
at the moment I code a programm with access to the WinAPI. Now I have questions about handling with the API:
1. Is it possible to have the same access to constants of the API as to the functions, e. g. Sleep_(1000) calls the API function sleep, with WM_CLOSE_ or #WM_CLOSE I get the number 16?
2. Is it possible to use a special character for number in hex format, e. g. #SYNCHRONIZE = 1048576, but the API said #SYNCHRONIZE = &H100000. Okay, it is the same, but all API documents use hex format, can I use hex format too?
3. If I get an API function a string, and it needs a zero terminted string, is it necessary to use + Chr(0) at the end of the string or set it PureBASIC automatically?
4. Exist a function Not in PureBASIC, e. g. If i=1..., If Not i=1 or IfNot i=1?
5. Which debuglevel exist 0, 1, 2... or A, B, C... and what do each of them resp. what does it mean?
6. Is it possible to see local variables in the window of the debugger, without using the command Debug ?
Thanks for answers.
Bye
Stefan
StSchnell
A lot of small questions
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
WM_CLOSE_.l = #WM_CLOSE
at the top of your code. I doubt Fred would change how constants are access (with a # in front of them) as he has previously said he would not like to change things like that (I am specifically thinking of the structure\field separator, but they are both something which can be used to identify things in the language).
Debug "foo",3
Debug "bar",6
And you set the DebugLevel to 5 then you will only see the first debug output. If you set the DebugLevel to be more or equal to 6 then you will see both.
--
I used to be a nihilist but I don't believe in that any more.(Win98first ed. + all updates, PB3.51, Ed3.53)
Sure, just do:Originally posted by StSchnell
1. Is it possible to have the same access to constants of the API as to the functions, e. g. Sleep_(1000) calls the API function sleep, with WM_CLOSE_ or #WM_CLOSE I get the number 16?
WM_CLOSE_.l = #WM_CLOSE
at the top of your code. I doubt Fred would change how constants are access (with a # in front of them) as he has previously said he would not like to change things like that (I am specifically thinking of the structure\field separator, but they are both something which can be used to identify things in the language).
If you put the dollar symbol in front of a number it makes it hexadecimal, e.g. $F00can I use hex format too?
All PureBasic strings are zero terminated.3. If I get an API function a string, and it needs a zero terminted string, is it necessary to use + Chr(0) at the end of the string or set it PureBASIC automatically?
Not yet, but I think it is on Fred's list of stuff to do.4. Exist a function Not in PureBASIC, e. g. If i=1..., If Not i=1 or IfNot i=1?
If you mean the debug level of the Debug command then you use any number you want. It is used so that you can enable or disable how much debug output you get by using the DebugLevel command. For example if you have the code5. Which debuglevel exist 0, 1, 2... or A, B, C... and what do each of them resp. what does it mean?
Debug "foo",3
Debug "bar",6
And you set the DebugLevel to 5 then you will only see the first debug output. If you set the DebugLevel to be more or equal to 6 then you will see both.
Not yet, again on Fred's list of stuff to do.6. Is it possible to see local variables in the window of the debugger, without using the command Debug ?
--
I used to be a nihilist but I don't believe in that any more.(Win98first ed. + all updates, PB3.51, Ed3.53)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Hi,
A lot of small answers...
1. All Windows Constants can be easily accest from PB. Just put a # for Constant in front of it.
So #WM_CLOSE was just the right guess.
2. The Crarakter for this is '$'. So &H100000 in API is $100000 in PureBasic. (There is also the '%' Craracter if you want to use Binary Numbers: %11 equals to 3)
3. PureBAsic Strings are NULL terminated, so no need to add something at all.
4. There is only Bitwise not at the Moment it is the ~ character. I think logical Not is planned.
5. The DebugLevel are Numbers, from 0 to whatever you want. You can set different DebugLevels and then use the Debug Command also with a DebugLevel Parameter. This means, that this Debug Command will only be executed, if you program is in a certain DebugLevel.
6. No, that is not possible ATM
If you want to learn more about DebugLevel, look in the Help in the Debugger Section.
There is also more about the Operators in 'Variables and Types' Section
Hope that helps...
Timo
Edit:
Too slow again
Hi,
A lot of small answers...
1. All Windows Constants can be easily accest from PB. Just put a # for Constant in front of it.
So #WM_CLOSE was just the right guess.
2. The Crarakter for this is '$'. So &H100000 in API is $100000 in PureBasic. (There is also the '%' Craracter if you want to use Binary Numbers: %11 equals to 3)
3. PureBAsic Strings are NULL terminated, so no need to add something at all.
4. There is only Bitwise not at the Moment it is the ~ character. I think logical Not is planned.
5. The DebugLevel are Numbers, from 0 to whatever you want. You can set different DebugLevels and then use the Debug Command also with a DebugLevel Parameter. This means, that this Debug Command will only be executed, if you program is in a certain DebugLevel.
6. No, that is not possible ATM
If you want to learn more about DebugLevel, look in the Help in the Debugger Section.
There is also more about the Operators in 'Variables and Types' Section
Hope that helps...
Timo
Edit:
Too slow again
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm