How to implement a big icon style open dialog

xiaoxiao2021-03-06  77

By default, the style of the file list of open dialogs is a list style. To implement an open box, you will automatically be a large icon style. You need to display the file list control (SyslistView32) before the open dialog is displayed. , Then change its style. Standard ListView controls have four styles, as follows: lvs_icon 0x0000 large icon style lvs_report 0x0001 Details Style lvs_smallicon 0x0002 Small icon Style LVS_LIST 0x0003 list The style is previously answered a netizen in 9cbs, just having some code, relatively simple Ccrun has not been added.嘿嘿. Place a TButton on the Form, a TopEndialog.

Then add the following code: .h file: public: // user declarations void __fastcall openDialogshow (TOBJECT * sender); void __fastcall openDialogclose (TOBJECT * Sender) ;. CPP file: // --------- -------------------------------------------------- ---------------- FarProc OlddlgopenProc = NULL; Static Lresult Callback NewDLGOpenProc (HWND HWND, UINT UMSG, WPARAM WPARAM, LPARAM LPARAM); // --------- -------------------------------------------------- ---------------- Static Lresult Callback NewdlgopenProc (HWND HWND, UINT UMSG, WPARAM WPARAM, LPARAM LPARAM) {IF (umsg == wm_updateuistate) {hwnd hshell = findWindowEx (getParent (hwnd ), NULL, "SHELLDLL_DefView", NULL); HWND hListView = FindWindowEx (hShell, NULL, "SysListView32", NULL); if (hListView) {SetWindowLong (hListView, GWL_STYLE, GetWindowLong (hListView, GWL_STYLE) & 0xFFFFFFF0 | LVS_ICON); }} Return CallWindowProc ((FarProc) OlddlgopenProc, HWnd, UMSG, WPARAM, LPARAM);} // -------------------------------------------------- ---------------------- // article from http://www.ccrun.com// welcome to visit // C Builder Research author: ccrun (witch ) // ----------------------------------- ----------------------------__ fastcall tfrmmain :: tfrmmain (tComponent * Owner): TFORM (OWNER) {OpenDialog1-> onClose = OpendialogClose OpenDialog1-> ONSHOW = OpenDialogShow; Button1-> onclick = button1click;} // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------- void __fastcall tfrmmain :: Button1click TOBJECT * Sender) {OpenDialog1-> Execute ();

} // ----------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------- Void __fastcall tfrmmain :: OpenDialogshow (TOBJECT * Sender) {OlddlGopenProc = (FarProc) setWindowlong (OpenDialog1-> Handle, GWL_WNDPROC, (Long) NewdlgopenProc);} // ------------------------------------- -------------------------------------- void __fastcall tfrmmain :: OpenDialogClose (TOBJECT * Sender) { Setwindowlong (OpenDialog1-> Handle, GWL_WndProc, (long) OlddlgopenProc);} //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------ later ccrun accidentally found that there are Simpleline: // ------------------------------------------ -------------------------------- // This article is from http://www.ccrun.com// Welcome to C Builder Research // author: ccrun (witch) const DWORD FCIDM_SHVIEW_LARGEICON = 28713; // large icons mode const DWORD FCIDM_SHVIEW_SMALLICON = 28714; // small icon mode const DWORD FCIDM_SHVIEW_LIST = 28715; // list mode const DWORD FCIDM_SHVIEW_REPORT = 28716; / / const dword fcidm_shview_thumbnail = 28717; // xp OnlyConst DWORD FCIDM_SHVIEW_TILE = 2 8718; // xp // ----------------------------------------- -------------------------------__ fastcall tfrmmain :: tFrmmain: TFORM (Owner) {////////////// Specify the Open Dialog that is executed when the dialog is displayed OpenDialog1-> OnShow = DLGOpenonShow;} // ----------------------------- --------------------------------------------- void __fastcall tfrmmain: : WndProc (TMESSAGE & MSG) {// Reserved WndProc implementation message custom processing if (msg.msg == wm_user 1) {// file list is a listView control, its parent-control relationship is as follows: // TopEndialog - > Shelldll_defview -> syslistview32 hwnd hdlg = (hwnd) msg.wparam; hwnd hctrl = findwindowex (HDLG, NULL, "shellDll_defview", null); if (hctrl! =

转载请注明原文地址:https://www.9cbs.com/read-51265.html

New Post(0)