A つの bank internal システムがupdateして, そもそもxpシステムの, adjust で to たのに.
Windows7の, Folderbrowserdialogがうまく してなかった.
Adjust べて fruit が, Shi Fang ない. Windows systemの exists bugです.
Color 々 survey けて, として two つの 's really into 対応 square needle があります.
1, windowチーム opened Souel されたwindowsapicodepackをdownloadして,
そのmicrosoft.windowsapicodepack.dialogsを reference 前転して開脚座り, the following example にするばよい.
Commonopenfiledialog dialog = new Commonopenfiledialog (); Dialog. InitialDirectory = @ "C:\Users\wangj\Documents\WeChat files\wxid_mw93g8weqm3e11\msg"; Dialog. Isfolderpicker = true; if (dialog. ShowDialog () = = Commonfiledialogresult.ok) {TextBox1.Text = dialog. FileName; }
2, Windows apiを use 前転して開脚座り.
public static class folderbrowserlauncher { //<SUMMARY>&NBSP ; //Using title text to look for the top Level dialog window is fragile. / In particular, this would fail in Non-english applications. //</summary> Const string _toplevelsearchstring = "Browse for Folder"; //<SUMMARY>&NB Sp //These should be more robust. We find the correct child controls in the dialog //By using the GetDlgItem method, rather than the FindWindow (Ex) method, //BE Cause the dialog item IDs should be constant. //</summary> C onst int _dlgitembrowsecontrol = 0; const int _dlgitemtreeview = 100; &NBSP ; [DllImport ("User32.dll ", SetLastError = True)] static extern IntPtr FindWindow (string lpclassname, String Lpwin Downame); [DllImport ("User32.dll")] static extern IntPtr GetDlgItem (IntPtr hdlg, int niddlgitem); [DllImport ("user32.dll", CharSet = CharSet.Auto)] & nbsp static extern IntPtr SendMessage (IntPtr hWnd, UInt32 Msg, IntPtr WParam, IntPtr lParam); <summary> //Some of the messages that the Tree View control would respond to //</summary> Private Const int tv_first = 0x1100; &NB Sp Private Const int Tvm_selectitem = (Tv_first + one); Private Const int Tvm_getnextitem = (Tv_first +); Private Const int Tvm_getitem = (Tv_first +); PR ivate Const INT Tvm_ensurevisible = (Tv_first +); Private Const int wm_close = 0x0010; //<summary> //Constants used to identity specific items in the Tree View contr ol //</summary> Private Const int tvgn_root = 0x0; &NB Sp Private Const int tvgn_next = 0x1; Private Const int tvgn_child = 0x4; &nbs P Private Const int tvgn_firstvisible = 0x5; Private Const int tvgn_nextvisible = 0 x6; Private Const int Tvgn_caret = 0x9; //<summary> &N Bsp //Calling this method was identical to calling the ShowDialog method of the provided &N Bsp FolderBrowserDialog, except that an attempt'll be made to scroll the Tree view //To MAK E The CUrrently selected folder visible in the dialog window. //</summary> //<param name= "Dlg" ></param> //<param name= "parent" ></param& gt; //<returns></returns> public static DialogResult S Howfolderbrowser (FolderBrowserDialog dlg, IWin32Window parent = null) { &NB Sp DialogResult result = dialogresult.cancel; Thread t3 = new Thread (( ) => { int i = 30 ; while (i>0) &N Bsp { i--; &NBSP ;   System.Threading.Thread.Sleep; INTPTR Hwnddlg = FindWindow (string) null, _toplevelsearchstring); if ( Hwnddlg! = IntPtr.Zero) { INTPTR Hwndfolderctrl = GetDlgItem (Hwnddlg, _dlgitembrowsecontrol) ; if (Hwndfolderctrl! = IntPtr.Zero) &nb Sp { &N Bsp INTPTR HWNDTV = GetDlgItem (Hwndfolderctrl, _dlgitemtreeview);   ; if (hwndtv! = IntPtr.Zero) &NBSP ; { &N Bsp INTPTR item = SendMessage (HWNDTV, (UINT) tvm_getnextitem, NE W IntPtr (Tvgn_caret), IntPtr.Zero); &NB Sp if (item! = IntPtr.Zero) { &N Bsp //sendmessage (HWNDTV, WM_CLOSE, IntPtr.Zero, item); & nbsp SendMessage (HWNDTV, Tvm_ensurevisible, IntPtr.Zero, item); &NBS P //if (i>20) &NB Sp // SendMessage (HWNDTV, 0x0000, IntPtr.Zero, IntPtr.Zero); &NB Sp //retries = 0;&NB Sp , //S Endkeys.send ("{tab}{tab}{right}"); &NBS P &NBSP ; } &N Bsp } } & nbSp } } & nbsp }); T3. Start (); result = dlg. ShowDialog (parent); return result; } }
Folderbrowserdialogがwindows7 environment で Drivers されたfolderを appropriate ないように to express things like