Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Windows File Requester... well, almost. (DBPro)

Author
Message
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 19th Jan 2003 18:35
I've found a way of accessing the windows file requester via DBPro. I don't know if it's of any use to anyone because there are a couple niggling problems with it, but it does work.

It could be handy for testing purposes.

The is one major requirement, you need MrTAToad's Handles.dll installed in the '\Compiler\plugins-user' folder. This can be found at his site http://www.nickk.nildram.co.uk/ under DBPro plugins.
Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 19th Jan 2003 18:37
First up is the include file. Save this as FileReq_Include.dba.



Now a small demo. Run this in any Windowed display.
Remember! Add FileReq_Include.dba in the Included Source Files list.




The major problem with this is when you move or resize the requester, it screws up the DBPro display until you exit the requester and call the next SYNC/FASTSYNC. Unfortunatly I don't think it's possible to solve this. pity.

Unless, one of you boffins knows a way of locking the requester in the center of the display without resizing. That would be a good compromise.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jan 2003 19:28
Nice one. A few suggestions though.

1) My utility plugin has peeking and poking for strings that might simplify things a bit. MrTAToad's peek/poke plugin might also have them - I'm not sure, I haven't checked it.
2) You do not have to free the memory at the end if you don't want to - windows will automatically reclaim all memory that has been allocated.
3) You can leave the window handle as 0 if you don't have MrTAToad's plugin.
4) You are misunderstanding the hinstance value - leave it zero.

I might have a way to keep the display refreshed DLL only I'm afraid, and I'll have to try it for certain.

*sigh* The list just gets longer and longer...
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 19th Jan 2003 20:43
1) My utility plugin has peeking and poking for strings...
I believe MrTAToad's peek/poke does handle strings, but I wanted to minimise the use of external plugins just in case (for one reason or another) no one uses them or does not have access to them.

2) You do not have to free the memory at the end if you don't want to...
Are you absolutly sure about this? I thought it wise to do so, because I thought you were responsible for memory clean up if you use the Make Memory command (well, in this case anyway).

3) You can leave the window handle as 0...
Hmmm, the problem with that is the requester becomes detatched from the window, as a result you will be able to click in the DBPro window and the requester will disapear behind it. I'd like to keep it on top.

4) You are misunderstanding the hinstance value...
I thought I was forced to use a value here, OK zero it is.

What is HINSTANCE anyway?

Considering points 3 & 4, is there away of reading a windows handle by using any of the system dll's ? This way I can make this free of user plugins for the time being (no insult to MrTAToad intended), then I will be able make an update of the Include file.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jan 2003 21:16
You only need to free memory to make it available for further memory allocations, but as the intention is to create the structure once, continually reallocating memory will just complicate things. All memory allocated in the standard way will be reclaimed automatically by windows when the process ends.

The use of HINSTANCE varies. Follow this link for the specifics of this usage : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/CommonDialogBoxLibrary/CommonDialogBoxReference/CommonDialogBoxStructures/OPENFILENAME.asp

There is a way to get the window handle through an API call ... but I forget for now what it is. I'll have a look around.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 19th Jan 2003 21:19
Ye Gods! What a big link!

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Jan 2003 22:13
All part of the MS plan to take over the world - crash all those browsers out there by making them run out of memory

Try this:


Or substitute 'GetForegroundWindow' instead. These both work because DBPro only has one window that can be active or forground. I know that there is a better way to get the primary window, but this should work for now.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 19th Jan 2003 23:22
Thankyou, That works fine.

So here is the updated Include file.



Changes:
InitFileReq() no longer needs a dll value as this function will now scan for any free dll slots.

If IanM is correct (I sure he is, he's smarter than me) you're no longer forced to use UloadFileReq() at the end of your program, I leave it there in case you want it.

ToDo:
Well, if I can solve that display problem....hmmmm.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 19th Jan 2003 23:24
...Oh! And no user plugins required for this one either.

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.

Login to post a reply

Server time is: 2024-05-02 00:13:14
Your offset time is: 2024-05-02 00:13:14