Author |
Topic: Learning Windows API (Read 1184 times) |
|
Kirkkaf13
New Member
member is offline


Gender: 
Posts: 28
|
 |
Learning Windows API
« Thread started on: May 21st, 2014, 6:45pm » |
|
Hello,
I have been using BBC Basic to attempt to learn the Windows API, thought it might be quicker using a language I am more familiar with than starting with C/C++.
It seems that I did not think this through fully because most of the learning resources available are written in object orientated C++ and I am finding it hard to port the examples to an imperative/structured style (might be the incorrect why to describe BB4W).
Now I never thought that this was going to be an easy task but with the addition of having the write example programs completely different to the available resources, I am really struggling.
So BB4W has the SYS function to call any WinAPI method, pretty powerful functionality for a BASIC language to have, which is another reason that attracts me to BB4W than any other BASIC.
It appears SYS is not as straight forward as it sounds by calling any WinAPI method, take for example the MessageBox.
So in C/C++ a message box can be displayed with: Code:MessageBox(0, "First Win32 Program.", "Window Title", MB_OK);
In BB4W: Code:SYS "MessageBox", @hwnd%, "First Win32 Program.", "Window Title", 0
Now in C/C++ a constant is provided for the final argument to let the method know you just want to display an "OK" button. I wouldn't write this in BB4W and had to refer to the manual to find I have to provide a literal integer.
Is there no way to use the constants or do I have to find out the value of these?
I would still class myself as a novice at programming and probably way over my head here. My main interest is to learn Direct2D.
Thank you.
|
« Last Edit: May 21st, 2014, 7:01pm by Kirkkaf13 » |
Logged
|
|
|
|
rtr
Guest
|
 |
Re: Learning Windows API
« Reply #1 on: May 21st, 2014, 9:29pm » |
|
on May 21st, 2014, 6:45pm, Kirkkaf13 wrote:Is there no way to use the constants or do I have to find out the value of these? |
|
That is what the Add Windows Constants utility (probably slot 8 in your Utilities menu) is for! It is described (along with the other add-in utilities) at the BB4W Wiki here:
http://bb4w.wikispaces.com/Tools+and+Utilities
It takes only two mouse clicks to run the utility, but if you consider even that to be an unacceptable overhead there are dialects of BASIC which understand the Windows Constants directly (such as Liberty BASIC or, preferably, my clone LB Booster).
Richard.
|
|
Logged
|
|
|
|
Kirkkaf13
New Member
member is offline


Gender: 
Posts: 28
|
 |
Re: Learning Windows API
« Reply #2 on: May 21st, 2014, 9:50pm » |
|
Richard,
It seems you never disappoint, excellent utility. Got any good resources on the Windows API? I do not think MSDN does it any justice.
Thanks.
|
|
Logged
|
|
|
|
rtr
Guest
|
 |
Re: Learning Windows API
« Reply #3 on: May 22nd, 2014, 08:13am » |
|
on May 21st, 2014, 9:50pm, Kirkkaf13 wrote:Got any good resources on the Windows API? I do not think MSDN does it any justice. |
|
MSDN is the only complete and up-to-date resource, but I still sometimes use the old (Windows 95 era) Win32Help utility, because of the convenience of it being installed locally rather than requiring an online connection.
The relevant FAQ has more details:
http://www.bbcbasic.co.uk/bbcwin/faq.html#q8
Windows Help is not supported out-of-the-box on recent versions of Windows (Vista and later) so you will need to install the necessary upgrade; you should be automatically prompted when you first run Win32.hlp.
Richard.
|
|
Logged
|
|
|
|
Kirkkaf13
New Member
member is offline


Gender: 
Posts: 28
|
 |
Re: Learning Windows API
« Reply #4 on: May 22nd, 2014, 6:27pm » |
|
I know you mentioned it might not work out of the box, that defiantly is the case. I am not even sure how I could get this installation to work.
Here is the error I get once I have chosen my directory: `Error creating registry key: Software\Microsoft\Windows\CurrentVersion\Uninstall\win32 onlinehelp_is1.`
I am using 64bit Windows 8.1.
Thanks
|
|
Logged
|
|
|
|
rtr
Guest
|
 |
Re: Learning Windows API
« Reply #5 on: May 22nd, 2014, 8:14pm » |
|
on May 22nd, 2014, 6:27pm, Kirkkaf13 wrote:Error creating registry key |
|
That is most likely an access rights issue, which as a user of Windows 8.1 you should be familiar with. Did you remember to 'Run as administrator'? Or have you disabled UAC (in which case you will need to log in with an administrator account)?
Installing Win32 Help was straightforward on this 64-bit Windows 8.1 PC (with UAC enabled).
Richard.
|
|
Logged
|
|
|
|
Kirkkaf13
New Member
member is offline


Gender: 
Posts: 28
|
 |
Re: Learning Windows API
« Reply #6 on: May 22nd, 2014, 9:33pm » |
|
Quote:Did you remember to 'Run as administrator'? |
|
I did not, but it is installed now.
Do you have a copy of the APIViewer application, it appears the link from the FAQ does not work. http://www.jonripley.com/bb4w/win32api/viewer
Thanks
|
« Last Edit: May 22nd, 2014, 9:42pm by Kirkkaf13 » |
Logged
|
|
|
|
rtr
Guest
|
 |
Re: Learning Windows API
« Reply #7 on: May 22nd, 2014, 9:57pm » |
|
on May 22nd, 2014, 9:33pm, Kirkkaf13 wrote:Do you have a copy of the APIViewer application, it appears the link from the FAQ does not work. |
|
Sorry, I don't have a copy of Jon's plugin (in any case Copyright would preclude me making it available). His site does seem to be rather intermittent - I believe he runs his own web server so that may be part of the reason (the IP address resolves to a Virgin Media account).
I can only suggest you check again from time to time in the hope that it will be back up. It would be sad to see yet another BB4W resource discontinued.
Richard.
|
|
Logged
|
|
|
|
Kirkkaf13
New Member
member is offline


Gender: 
Posts: 28
|
 |
Re: Learning Windows API
« Reply #8 on: May 22nd, 2014, 10:45pm » |
|
That is okay Richard I will try again another time. As they say when a door closes, another one opens.
All BB4W needs is a couple of new dedicated users to contribute. I am in no position to provide anything useful to the community at the moment but I sure will once I have something worth releasing.
Kirk
|
|
Logged
|
|
|
|
|