Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I know this may a little late coming but I just pre-empted a similar problem in my own program and it reminded me of this question. I used the windows FindWindowEx API function against the task dialogues window title property to find the dialogues window handle, then used my own class to make that an Iwin32Window which can then be used as a parent for a message box or task-dialogue. the appropriate code is below (VB.NET)</p> <pre><code> 'allows us to use the handle as a window class window Implements IWin32Window private _handle public sub new(handle as intptr) _handle = handle end sub Public ReadOnly Property Handle As System.IntPtr Implements System.Windows.Forms.IWin32Window.Handle Get Return _h End Get End Property end class 'Declare the needed DLL import class NativeMethods &lt;DllImport("user32.dll", SetLastError:=True, ThrowOnUnmappableChar:=True, CharSet:=CharSet.Unicode, bestFitMapping:=False)&gt; Public Shared Function FindWindowEx(hwndParent As IntPtr, hwndChildAfter As IntPtr, lpszClass As String, lpszWindow As String) As IntPtr End Function end class 'Make sure you've set a window title when you run your task sub runTask() dim myDlg as Ookii.Dialogs.ProgressDialog 'Do what you need to here myDlg.WindowTitle = "make sure you set a title" end sub sub myTask(sender as object, e As System.ComponentModel.DoWorkEventArgs) 'Checks and balances here if fileExists then 'this is the dialog that's running our task Dim dlg As Ookii.Dialogs.ProgressDialog = DirectCast(sender, Ookii.Dialogs.ProgressDialog) 'Find the window handle Dim dlgHandle As IntPtr = NativeMethods.FindWindowEx(IntPtr.Zero, IntPtr.Zero, Nothing, dlg.WindowTitle) 'make it an Iwin32Window dim dlgWindow as new window(dlgHandle) 'That can then be used as a parent for the message box or the task dialog MessageBox.Show(dlgWindow,"The file exists, overwrite?") end if end sub </code></pre> <p>I'm not really very good at commenting my code or making my explanations understood so If you have any questions about what's going on I'll try and help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload