c# - OpenFileDialog within My Form Not windows browser pop-up form -


i dont know if openfiledialog right control, want open bookmarked filepath within main form control. have program implements dont know how go it.

when user clicks button, column on left in picture below show folder of last opened file path. how go create this. have path folder want display, controls should use, code highly appreciated sample

you can setparent function. below example educational purposes!

using system; using system.diagnostics; using system.linq; using system.runtime.interopservices; using system.text; using system.windows.forms; using system.drawing;  namespace windowsformsapplication4 {     public partial class form1 : form     {         public form1()         {             this.size = new system.drawing.size(800, 600);             this.topmost = true;             this.formborderstyle = formborderstyle.fixedtoolwindow;             func<bool> run = () =>                 window.find(hwnd =>                 {                     var cn = window.getclassname(hwnd);                     var res = (cn == "cabinetwclass");                     if (res)                     {                         this.controls.clear();                         window.setparent(hwnd, this.handle);                         window.setwindowpos(hwnd, new intptr(0), -8, -30, this.width + 10, this.height + 37, 0x0040);                     }                     return res;                 });              new button { parent = this, text = "start" }                 .click += (s, e) =>                     {                         if (run() == false)                             messagebox.show("open explorer");                     };         }     }      public static class window     {         public static bool find(func<intptr, bool> fn)         {             return enumwindows((hwnd, lp) => !fn(hwnd), 0) == 0;         }         public static string getclassname(intptr hwnd)         {             var sb = new stringbuilder(1024);             getclassname(hwnd, sb, sb.capacity);             return sb.tostring();         }         public static uint getprocessid(intptr hwnd)     // {0:x8}         {             uint pid;             getwindowthreadprocessid(hwnd, out pid);             return pid;         }         public static string gettext(intptr hwnd)         {             var sb = new stringbuilder(1024);             getwindowtext(hwnd, sb, sb.capacity);             return sb.tostring();         }          delegate bool callbackptr(intptr hwnd, int lparam);          [dllimport("user32.dll")]         static extern int enumwindows(callbackptr callptr, int lpar);          [dllimport("user32.dll")]         static extern uint getwindowthreadprocessid(intptr hwnd, out uint lpdwprocessid);          [dllimport("user32.dll", charset = charset.auto, setlasterror = true)]         static extern int getwindowtext(intptr hwnd, stringbuilder lpstring, int nmaxcount);          [dllimport("user32.dll", setlasterror = true, charset = charset.auto)]         static extern int getclassname(intptr hwnd, stringbuilder lpclassname, int nmaxcount);          [dllimport("user32", charset = charset.auto, exactspelling = true)]         public static extern intptr setparent(intptr hwndchild, intptr hwndparent);          [dllimport("user32.dll", setlasterror = true)]         public static extern bool setwindowpos(intptr hwnd, intptr hwndinsertafter, int x, int y, int w, int h, uint uflags);     } } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -