1. getOpenFileName options
- Posted by AndyDrummond Oct 29, 2010
- 2032 views
I'm using Win32Lib, and getOpenFileName(). I'd very much like the menu to open showing thumbnails rather than a simple list. Does anyone know how I can achieve this? I've looked at the OFN_xxx options but nothing seems relevant. I'm selecting pictures for a program, and it isn't nice to always have to select Thumbnails from the open filename menu system each time.
I suppose I'm bound to admit that I'm still using Eu3, largely because I'm using IDE & Win32Lib and it does all I want. One day I'll change, but for now, not.
2. Re: getOpenFileName options
- Posted by LarryMiller Oct 29, 2010
- 1913 views
I don't think this will be simple. As far as I can tell the Windows API does not support this is in a documented or supported way. I once saw an old MSDN article describing something like this which involved creating a hook function for the dialog, handling it's messages, and using an undocumented constant. The article predated Windows 2000. I suspect you don't want to go that far.
3. Re: getOpenFileName options
- Posted by AndyDrummond Oct 29, 2010
- 1855 views
I don't think this will be simple....... I suspect you don't want to go that far.
How true. I had a horrible feeling that might be the case. It would be easier to write my own control to do the job if it isn't straightforward. Thanks for the warning!
4. Re: getOpenFileName options
- Posted by DerekParnell (admin) Oct 29, 2010
- 1803 views
I don't think this will be simple....... I suspect you don't want to go that far.
How true. I had a horrible feeling that might be the case. It would be easier to write my own control to do the job if it isn't straightforward. Thanks for the warning!
Larry's right. Microsoft don't play fair as a lot of their GUI uses non-Standard windows API.
To get the sort of effect you are after, you will need to write your own, which may include a lot of custom-drawn controls.
5. Re: getOpenFileName options
- Posted by AndyDrummond Oct 30, 2010
- 1770 views
Thanks, gentlemen. And no thanks, Mr Gates. I guess I will just have to get on with it, then ... ho hum.
6. Re: getOpenFileName options
- Posted by petelomax Oct 31, 2010
- 1906 views
I've had a quick search/play with this. It is possible, but not trivial:
http://msdn.microsoft.com/en-gb/magazine/cc164009.aspx
I had partial success, it seemed to work but then crashed my PC...
Anyway, here's what I did:
1) modified arwen's demo_idle to have a file open dialogue.
2) set a flag before opening the dialogue to trigger code in the idle handler.
3) in the idle handler, if the flag was set, called xGetForegroundWindow followed by xGetDlgItem with ID_LISTVIEW=#461. This failed (returned 0) the first time round, but found it on the second attempt. At that point I cleared the flag and sent the ODM_VIEW_THUMBS.
I won't post any code since it's broken, and you want a win32lib solution.
HTH, Pete
7. Re: getOpenFileName options
- Posted by AndyDrummond Nov 01, 2010
- 1672 views
Thanks Pete. I looked at the MSDN post, and downloaded their C++ example. It rather confirms my decision!
What I intend to do is write a "Filmstrip" type view for selection of images. Rather like the folder browse filmstrip view. I'm also adding a comment field so the user can add a textual comment to each image which they can read as they scroll back and forth. I think it will take a lot less effort than trying to persuade Windows open dialog to control its grandchildren, and with additional bonuses - boni? - too. I think the CXImage library will handle all the image stuff nicely. Time will tell.
It's truly amazing how the Windows API can make things so difficult to do at times. I mean, writing it all in C++ is a disaster IMHO. All that lovely type checking, bypassed in almost every case with type casting. If I wrote code like that I'd expect to have problems. Should all have been written in euphoria, of course!
8. Re: getOpenFileName options
- Posted by bugfinder Nov 01, 2010
- 1701 views
Andy:
There is a program in the archive that uses com, list view thumb nails and win32lib called view picture.
There are also other programs that may help you here but that program features the main things you are looking for.
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=image
9. Re: getOpenFileName options
- Posted by AndyDrummond Nov 01, 2010
- 1646 views
Andy:
There is a program in the archive that uses com, list view thumb nails and win32lib called view picture.
There are also other programs that may help you here but that program features the main things you are looking for.
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=image
I got it! I ran it! It crashed when I selected thumbnails, with a machine-level exception :( I can't seem to get past that point, which rather leaves it less than useful.
I'll go through it, but Tone Skoda is a better programmer than I am, and probably had more time, so unless I can see why it is failing I may have problems getting much out of it.
I have to say that I often find it faster to write code from square one, using proven libraries, than to try and sort out why another program is failing, then try and cherry-pick the bits I want, then cobble them into my program. I will certainly look at the code, but unless I can get it to run fairly quickly I suspect it won't help too much.
Thanks, BugFinder, for pointing this out; I appreciate any help/advice/ideas, especially if I can use the info.