-
Jul 12th, 2024, 05:55 PM
#1
Thread Starter
New Member
[RESOLVED] Specifying the Hwnd for FileSaveDialog/FileOpenDialog Show Method
Hi, I could have posed this question in the VB6 forum but my sense is that this is where the cool kids hangout - so will ask it here.
In tB, I'm implementing FileSaveDialog/FileOpenDialog classes via a reference to Jon Johnson's very useful Windows Development Library. It seems the most common usage for these is calling the Show method from a Form to do file IO. Show method requires that an owner Hwnd be passed as an argument - in all the VB6 examples that I have found thus far the developer passes the Form's window handle. Makes sense.
But what should I do if I intend to call FileSaveDialog/FileOpenDialog not from an instantiated Form? My first random thought was to pass the handle returned by GetDesktopWindow() and that seems to be working fine, but I'm wondering if I'm asking for trouble here. Are there any possible issues with doing this? If so, is there a safer approach?
Thanks!
-
Jul 12th, 2024, 06:15 PM
#2
Re: Specifying the Hwnd for FileSaveDialog/FileOpenDialog Show Method
According to https://devblogs.microsoft.com/oldne...24-00/?p=40493 that might be a bad idea. If you don't have an owner then just use null for the owner.
-
Jul 12th, 2024, 08:23 PM
#3
Thread Starter
New Member
Re: Specifying the Hwnd for FileSaveDialog/FileOpenDialog Show Method
PlausiblyDamp - thanks much for that link. Reading that not only answered my question about a Form-less call to the FileXXXXDialogs but also cleared up for me why it is necessary to pass the Form's window handle to modal dialogs called from the Form. Excellent!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|