Hi... I am writing a windows explorer toolbar that sets up a standard st of columns (like author, comments, etc..) so the user dosn't have to do it..(later will add more functions for handeling MS office documents etc..) Now i have a working toolbar and have made my way through explorer to the lSysListView32 and using a LVCOLUMN managed to send the message that inserts the column.. But (allways a but) dose any one know how to tell explorer to populate the column with the info? I am only using standard columns (like author, comments, etc..) Code So far... private void button1_Click(object sender, System.EventArgs e) { MessageBox.Show("Button Clicked!"); //set the view to detail SendMessage(Explorer.HWND, LVM_COMMAND, viewREPORT, 0); //now get the IntPtr lSHELLDLLDefView = FindWindowEx(Explorer.HWND, 0, "SHELLDLL_DefView", null); if (lSHELLDLLDefView == null) { return; } IntPtr lDUIViewWndClassName = FindWindowEx(lSHELLDLLDefView, IntPtr.Zero, "DUIViewWndClassName", IntPtr.Zero); if (lDUIViewWndClassName == null) { return; } IntPtr lDirectUIHWND = FindWindowEx(lDUIViewWndClassName, IntPtr.Zero, "DirectUIHWND", IntPtr.Zero); if (lDirectUIHWND == null) { return; } IntPtr lCtrlNotifySink = FindWindowEx(lDirectUIHWND, IntPtr.Zero, "CtrlNotifySink", IntPtr.Zero); if (lCtrlNotifySink == null) { return; } IntPtr lSysListView32 = FindWindowEx(lCtrlNotifySink, IntPtr.Zero, "SysListView32", IntPtr.Zero); if (lSysListView32 == null) { return; }
//create new column LVCOLUMN lvc = new LVCOLUMN(); lvc.mask = 0x0001|0x0008|0x0002|0x0004;//LVCF_FMT|LVCF_SUBITEM|LVCF_WIDTH|LVCF_TEXT lvc.fmt = 0x0001; lvc.cx = 100; lvc.text = "Author";
int counter = 0; SendMessage(lSysListView32, 0x1000 + 97, counter, ref lvc);
}Not sure if this is the right forum but it is writen in C# but is probably more to do with windows... Many Thanks Calvin | | Mr.C...._ Tuesday, May 06, 2008 7:26 AM | | | Giorgi Dalakishvili Tuesday, May 06, 2008 8:39 AM | thanks I have read that, but it talks about how to create your own custom columns, but what i want to do is create a button on explorer that sets a folder to a standard layout using standard columns..
I have looked into IShellView, but carn't seem to get it working in c#, so now i am looking into the registery settings... HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\BagMRU so i can make a buttun that aplies a template..
Filename,Author,subject,catagory, and comments.. are the column heading i want to set...
calvin streeting
| | Mr.C...._ Tuesday, May 06, 2008 6:56 PM | Ok... Still trying to get this to work (please help a c# novice)
i think the key lies with IShellBrowser so i am trying to get it from the ISseviceProvider Guid guids = ExplorerGUIDs.IID_IShellBrowser; Guid riid = ExplorerGUIDs.IID_IUnknown; try { object ws; sp.QueryService( ref guids, ref riid, out ws); //once we have interface to the COM object we can create RCW from it ShellBrowser = (IShellBrowser)Marshal.CreateWrapperOfType( ws as IShellBrowser, typeof(IShellBrowser)); } catch (COMException) {
but the Marshal code is wrong... its based on which works...
Guid guid = ExplorerGUIDs.IID_IWebBrowserApp; Guid riid = ExplorerGUIDs.IID_IUnknown; try { object w; sp.QueryService( ref guid, ref riid, out w ); //once we have interface to the COM object we can create RCW from it Explorer = (WebBrowserClass)Marshal.CreateWrapperOfType( w as IWebBrowser, typeof(WebBrowserClass) ); OnExplorerAttached(EventArgs.Empty); } catch( COMException ) {}
but i am not sure whatclass to use for a IShellBrowser...
can anyone help..
| | Mr.C...._ Saturday, May 10, 2008 12:07 AM |
|