Home How to set the folder for an embedded Shell activeX control in winforms
Reply: 0

How to set the folder for an embedded Shell activeX control in winforms

Alexander Ryan Baggett
Alexander Ryan Baggett Published in 2018-01-12 19:56:52Z

If I was just automating the shell directly as opposed it embedding it, it would look something like this :

string curDir = Directory.GetCurrentDirectory();
Shell32.Shell shell = new Shell32.Shell();

However, my goal is to embed it into my windows form. This is what I have so far:

  • So, I have added a COM reference to Microsoft Shell Controls and Automation (Shell32.dll)
  • I have added a COM control in the winforms toolbar via choose items to the Microsoft Shell Folder View Router
  • I have dragged the control to my form so I have access to it in a variable called axShellFolderViewOC1

My code so far looks like this :

using System;
using System.Windows.Forms;
using System.IO;
using Shell32;
using AxShell32;

namespace winforms
    public partial class Form1 : Form
        public Form1()
            string curDir = Directory.GetCurrentDirectory();

            var comObject= axShellFolderViewOC1.GetOcx();
            var comInterface = comObject as  //what goes here?

            //pseudo code

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310255 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO