Dear PB Forum people
Please can someone point me in the right direction for applying some API functions in PB/CC?
I'm not by profession a programmer, but as a scientist I use programming as a tool for mathematical and statistical modelling (among other things). I find PB/CC really excellent for this purpose (in the past I used TurboBasic and then Turbo Pascal). I have no ambitions to be a Windows programmer, or at least that's not a mountain I wish to climb at present, but in some circumstances I like to make my life easier by using certain Windows functions. For example, by looking at examples posted in these forums, I have learned how to use OpenFileDialog and SaveFileDialog from ComDlg32.inc for easy access to files in different folders.
However... there are a couple of things I'd like to do that I can't work out yet.
Firstly, if I'm going to open a file for output and I find out that the file already exists, I have three options: overwrite, append or abort and choose a new file name. Of course it's very easy to do this in the console, but having got the file name using SaveFileDialog, I'd like a nice user-friendly message or dialog to pop up and offer the options on the click of a mouse. I've worked out how to get a message box with buttons for "yes", "no" and "cancel"...
...and I can respond to the value of x returned, but how would I get a box with buttons labelled "Overwrite", "Append" and "Abort"? Or is this something best left to 'real' programmers...?
Secondly, in the course of running a program I sometimes like to change my working directory. Again, easy to implement in the console, but not as convenient as clicking on a directory structure. SaveFileDialog and OpenFileDialog can be used to accomplish a folder change, but are obviously the wrong tools for the job. Is there a similar function which is the right tool?
Finally, is there any handy documentation for Win32API.inc, ComDlg32.inc, etc. other than Win32.hlp? I'm looking for simple guidance on which function does what, with examples of how to use the syntax.
Thanks in advance for any enlightenment!
Please can someone point me in the right direction for applying some API functions in PB/CC?
I'm not by profession a programmer, but as a scientist I use programming as a tool for mathematical and statistical modelling (among other things). I find PB/CC really excellent for this purpose (in the past I used TurboBasic and then Turbo Pascal). I have no ambitions to be a Windows programmer, or at least that's not a mountain I wish to climb at present, but in some circumstances I like to make my life easier by using certain Windows functions. For example, by looking at examples posted in these forums, I have learned how to use OpenFileDialog and SaveFileDialog from ComDlg32.inc for easy access to files in different folders.
However... there are a couple of things I'd like to do that I can't work out yet.
Firstly, if I'm going to open a file for output and I find out that the file already exists, I have three options: overwrite, append or abort and choose a new file name. Of course it's very easy to do this in the console, but having got the file name using SaveFileDialog, I'd like a nice user-friendly message or dialog to pop up and offer the options on the click of a mouse. I've worked out how to get a message box with buttons for "yes", "no" and "cancel"...
Code:
x=MessageBox(0,"File already exists!","Warning:",%MB_YESNOCANCEL)
Secondly, in the course of running a program I sometimes like to change my working directory. Again, easy to implement in the console, but not as convenient as clicking on a directory structure. SaveFileDialog and OpenFileDialog can be used to accomplish a folder change, but are obviously the wrong tools for the job. Is there a similar function which is the right tool?
Finally, is there any handy documentation for Win32API.inc, ComDlg32.inc, etc. other than Win32.hlp? I'm looking for simple guidance on which function does what, with examples of how to use the syntax.
Thanks in advance for any enlightenment!

Comment