January 25, 2020, 06:51:00 am

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


File Request Dialog

Started by LarryMc, January 17, 2007, 08:56:29 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

Anyone know what the const flag value is to force a filerequest dialog into thumbnail viewing mode?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Ionic Wind Support Team

LarryMc

I was looking at the source for FileRequest in IBPro.

I know there is a way to force the open file dialog into thumbnail viewing mode; just don't know how to do it.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Dennisc

Failure is only the opportunity to begin again more intelligently
www.denniscomninos.com

mrainey

January 17, 2007, 02:39:04 pm #4 Last Edit: January 17, 2007, 02:42:47 pm by mrainey
Here's a thread on the subject from the Pyxia forum archive.

Posted: Wed Jul 28, 2004 10:11:25 PM    Post subject: Force Thumbnail view in FILEREQUEST? 
--------------------------------------------------------------------------------
Is there a way I can force FILEREQEUST to open in thumbnail view? I know that there is no documented way to do it with the FILEREQUEST function itself, but I am wondering if there is a way I can do it with the API.

Also, I believe this will limit my app to Windows 2000 or XP correct? Since IIRC, Windows 2000 was the first version of Windows to support thumbnail view in the file dialog?

Thanks!

Simba
Posted: Wed Jul 28, 2004 10:33:19 PM    Post subject: Followup 
--------------------------------------------------------------------------------
Just a followup, to see if am sort of on the right track.
I assume the default way that FILEREQUEST opens on a directory is controlled by some kind of directory flag or registry entry. For example, somehow, FILEREQUEST "knows" that it should open "My Pictures" in thumbnail view by default. So I guess what I am looking for is a way to set that flag on a directory created from my application's code so that the default view will always be thumbnail when FILEREQUEST is opened on that directory.

Thanks again!

TronDoc

Posted: Wed Jul 28, 2004 10:58:13 PM    Post subject:   
--------------------------------------------------------------------------------
I had asked this question long, long ago
and was told that open requesters with
a thumbnail view were all custom dialogs.
There should be examples of several
people's attempts to create one somewhere
on these forums.. ..I think.
If w2k and XP now support it that's cool.
Joe

Simba

Posted: Wed Jul 28, 2004 11:15:09 PM    Post subject:   
--------------------------------------------------------------------------------
Well, WinXP must support it, because a standard FILEREQUEST in IBasic will show the MyPictures directory in thumbnail view by default. So there must be some kind of flag that tells it to show that directory in thumbnail view by default.

On a somewhat related note, why is this API call failing?

Code:
type OSVERSIONINFO
   def dwOSVersionInfoSize : word
   def dwMajorVersion : word
   def dwBuildNumber : word
   def dwPlatformId : word
   def szCSDVersion[128] : char
endtype
declare import, GetVersionExA(LPOSVERSIONINFO as OSVERSIONINFO),int
def lpOsVersionInfo : OSVERSIONINFO
def myint : int
openconsole
myint = GetVersionExA(lpOsVersionInfo)
print "dwOSVersionInfoSize: " + str$(lpOsVersionInfo.dwOSVersionInfoSize)
print "dwMajorVersion: " + str$(lpOsVersionInfo.dwMajorVersion)
print "dwBuildNumber : " + str$(lpOsVersionInfo.dwBuildNumber)
print "dwPlatformId: " + str$(lpOsVersionInfo.dwPlatformId)
print "szCSDVersion: " + lpOsVersionInfo.szCSDVersion
print "Result: " + str$(myint)
do
until inkey$<>""
closeconsole
end

Thanks again

Paul Turley
Posted: Thu Jul 29, 2004 02:06:34 AM    Post subject:   
--------------------------------------------------------------------------------
Your missing a member in the UDT (dwMinorVersion), they should be UINT and not WORD, and You need to set the member dwOSVersionInfoSize to LEN(OSVERSIONINFO) before sending it to GetVersionExA

This is done with a lot of Microsoft functions that have more than one UDT type accepted as a parameter.

Other than that it works fine ;)

Code:
type OSVERSIONINFO
   def dwOSVersionInfoSize : UINT
   def dwMajorVersion : UINT
   def dwMinorVersion : UINT
   def dwBuildNumber : UINT
   def dwPlatformId : UINT
   def szCSDVersion[128] : ISTRING
endtype
declare import, GetVersionExA(LPOSVERSIONINFO as OSVERSIONINFO),int
def lpOsVersionInfo : OSVERSIONINFO
def myint : int
lpOsVersionInfo.dwOSVersionInfoSize = LEN(OSVERSIONINFO)
openconsole
myint = GetVersionExA(lpOsVersionInfo)
print "dwOSVersionInfoSize: " + str$(lpOsVersionInfo.dwOSVersionInfoSize)
print "dwMajorVersion: " + str$(lpOsVersionInfo.dwMajorVersion)
PRINT "dwMinorVersion: " + str$(lpOsVersionInfo.dwMinorVersion)
print "dwBuildNumber : " + str$(lpOsVersionInfo.dwBuildNumber)
print "dwPlatformId: " + str$(lpOsVersionInfo.dwPlatformId)
print "szCSDVersion: " + lpOsVersionInfo.szCSDVersion
print "Result: " + str$(myint)
do
until inkey$<>""
closeconsole
end

Simba
Posted: Thu Jul 29, 2004 02:31:15 AM    Post subject:   
--------------------------------------------------------------------------------
Thanks Paul,

Yes, the API call works now. As far getting FILEREQUEST to default to thumbnail view, I've been searching through the API docs and also looking around on the Web, and it looks like the way to do this would be to process the WM_INITDIALOG message from the FILEREQUEST box, and then post a WM_COMMAND message to change the view that it is using. However, this presents two problems. First, it seems Microsoft has chosen not to document the message numbers that are sent when the view is changed, so I don't know which message to post. Second, since FILEREQUEST does not have a message handler, I am not sure how to process its INITDIALOG message (or send it a message for that matter since it does not have a handle.) Do I have to use the Windows API GetOpenFileName if I want to do this?

This all seems like I shouldn't have to do it though, since as I said, there has to be some other way to tell the file dialog to default to thumbnail mode, since if you go to "My Pictures" in the file dialog, it will default to thumbnail mode. I thought that perhaps this was controled the Desktop.ini file in "My Pictures", but lifting stuff out of there and placing it in a +h +s Desktop.ini file in my own directory did not change the behavior of the file dialog. So I guess that is not how Microsoft is telling the file dialog to default to thumbnail view in "My Pictures" either... Oh well, if anyone has any solutions to this, please let me know.

Thanks.

Unknown User
Posted: Sun Aug 01, 2004 12:18:10 PM    Post subject:   
--------------------------------------------------------------------------------
Paul posted an updated file dialog some time ago: http://www.pyxia.com/community/viewtopic.php?t=7014&highlight=getopenfile

It opens in thumbnail view if this option is selected for that folder. (In XP al least), haven't tested on 98 ).

If these options are kept in the registry maybe it could be changed temporarily before the folder is opened
in the filedialog. :?:

Simba

Posted: Sun Aug 01, 2004 07:46:47 PM    Post subject:   
--------------------------------------------------------------------------------
Quote:

Paul posted an updated file dialog some time ago: http://www.pyxia.com/community/viewtopic.php?t=7014&highlight=getopenfile



I'm pretty sure this is just the extended file dialog that has the sidebar with the icons for "My Documents", etc, (as opposed to the simple Windows 95 style one that does not have them) In that case, I also think the code that Paul posted is the default FILEREQUEST in IB Pro already (It wasn't in IB Standard). And if that is true, then it still does not do what I am looking for, since it still defaults to list view on all folders accept My Pictures. If I create a normal folder, and set the type to "pictures" or "photo album", I still get list view in the file dialog by default.

This is true in most other applications as well when you request a standard file dialog.

Also notice, that in the code Paul posted, there is no constant for changing the default view that the dialog opens in. That's because Microsoft, for whatever reason, has chosen not to provide us with one. So as I posted earlier, it seems that the only way to do this is send a WM_COMMAND message to the dialog to change the view.

Unknown User
Posted: Mon Aug 02, 2004 07:41:35 PM    Post subject:   
--------------------------------------------------------------------------------
Quote:
since it still defaults to list view on all folders accept My Pictures.
I just checked, you're right. Things aren't supposed to be too easy I guess.

Software For Metalworking
http://closetolerancesoftware.com

sapero

I have a snippet for IBPro, it uses local hook to do this:
Code Select
$include "windows.inc"

CONST OFN_ENABLESIZING = 0x800000
CONST OFN_DONTADDTORECENT = 0x2000000
const MAX_PATH = 260
$define SAVEFLAGS OFN_ENABLESIZING|OFN_EXPLORER|OFN_OVERWRITEPROMPT|OFN_DONTADDTORECENT|OFN_PATHMUSTEXIST
int g_hook
extern _hinstance as int

main()

sub main()
_InitCommonControls()
OPENFILENAME ofn
_RtlZeroMemory(&ofn, len(OPENFILENAME))
istring szPath[MAX_PATH]
szPath = GetStartPath() + "test.txt"

ofn.lStructSize = len(OPENFILENAME)
' ofn.hwndOwner   =
ofn.hInstance   = _hinstance
ofn.lpstrFilter = "All Files (*.)\x00*.*\x00\x00"
ofn.lpstrFile   = &szPath
ofn.nMaxFile    = MAX_PATH
ofn.lpstrDefExt = "txt"
ofn.Flags       = SAVEFLAGS

' install local hook
g_hook = _SetWindowsHookEx(WH_CBT, &OfnCbtProc, 0, _GetCurrentThreadID())
' get the file
_GetSaveFileName(ofn)
' uninstall the hook
_UnhookWindowsHookEx(g_hook)
return
endsub


' view flags
$define ODM_VIEW_ICONS  0x7029
$define ODM_VIEW_LIST   0x702B
$define ODM_VIEW_DETAIL 0x702C
$define ODM_VIEW_THUMBS 0x702D
$define ODM_VIEW_TILES  0x702E


sub OfnCbtProc(nCode:int,wParam:int,lParam:int),int

if (nCode = HCBT_CREATEWND) ' a window is about to be created

istring szClass[64]
' wParam = HWND
_GetClassName(wParam, szClass, 64)
if (szClass = "SHELLDLL_DefView")
_PostMessage(wParam, WM_COMMAND, ODM_VIEW_THUMBS, 0)
endif
endif
return _CallNextHookEx(g_hook, nCode, wParam, lParam)
endsub

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

sapero

Instead all this complicated stuff with GetSaveFileName and the OPENFILENAME structure, you can use the standard FileRequest function, but the hook is still needed to change the view.
This hook is used as (easier) replacement for OFNHookProc callback function (ofn.lpfnHook) where inside WM_INITDIALOG you must post a custom message to the dialog (to proceed all pending messages), then inside this custom message you can change the view ...
Please read article in MSDN Magazine 2004 - List View Mode[...]

LarryMc

sapero
The code you posted works just like I want it to (thumbnails) for saving a file.

Now, what I haven't been able to figure out is how to make it load one or more files.

The C article you posted is greek to me.

I tried to merge your posted code with Paul's IBPro FileRequest source code and all I did was dig myself a hole I couldn't get out of.

After a few hours I just deleted the mess I had created since it wouldn't even open the dialog.

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library