Getting the right window of "CtrlNotifySink" - c#

I tried to get a hold on the icons of any folder, by going down this window tree:
CabinetWClass
ShellTabWindowClass
DUIViewWndClassName
DirectUIHWND
CtrlNotifySink
SHELLDLL_DefView
DirectUIHWND
however, I am stuck in DirectUIHWND, because there are more than one child with the class name "CtrlNotifySink".
I need to get a hold on a specific "CtrlNotifySink".. the one that have the child "SHELLDLL_DefView".
how can I do it?
Thanks,
Aviad S.

You might be going about this the wrong way.
If you want to find out what folder windows the user has open, and look at the items within them, take a look at the scriptable shell objects. The examples on MSDN are mainly in VB and Javascript, but the approach applies to C# as well.

Related

UWP Multiple MenuItem Views in NavigationView

Is there a way in a NavigationView in UWP to have multiple "Views" for NavigationViewMenuItems? The concept would be to have Categories or Folders as MenuItems, and when clicked or the NavigationViewMenuItems would slide out to the left and show the contents of the folder or category. Then when navigating back out of the folder, the folder and categories list would slide in from the left again. I know I can change the NavigationView.MenuItemsSource in C#, but I'd like to instead have this done primarily in XAML. I've tried numerous ways to do this, but can't seem to find a way that works.
I don't really have any code to demonstrate this, as this is a whole concept issue rather than a single bug that isn't working. I have searched everywhere, and have found numerous articles/links about loading different views into NavigationView.Content, but nothing of changing the MenuItems portion.
Does anyone have any ideas on how to achieve this, or a link to a tutorial I could follow? I can't imagine that this has never been done before, this seems like such a common-sense UI interface.
What you need actually is a Tree Navigator. The UWP has no such a built-in control for us. You could use the third-party control like Syncfusion TreeNavigator.
See the code sample on GitHub: https://github.com/syncfusion/uwp-demos/tree/master/Navigation

Nodes in Windows Forms

So I have experience in C++ and I am now messing around in C# .NET with the Windows Forms. I know how to create a new Form, which I can use as a new window. And that you can also create user control, a component or a normal class.
Now I made an application in C++ but I want to convert it to C# .NET. In C++ I made the whole gui myself. But I want to do that now in C# .NET for practice.
In that application, the user could create nodes (Like you can in unreal engine 4 in the blueprints, see example picture)
Now I am unsure what would be the best way to do this in Windows forms.
Making a new form doesn't seem like the correct way. Because the nodes have to be inside of the main screen. And you should be able to move the grid which hold the nodes. So nodes shouldnt be able to exit the main screen that holds them.
Is it better to create it from scratch myself in a class? Or can I achieve this with a user control or component class? I do not understand what the best use of these classes are and what they are used for.
So I want to make something like this, and the question is what is the best type of class to make the nodes with?:
I think you should use WPF to obtain node-base UI. I developed a program with such an interface in WPF and it was pretty simple (I didn't have any experience in WPF):
You can create almost every layout you want using grids, borders, stackpanels, dockpanels, paths etc.

How to list all the elements of an application?

I'm trying to click a button on a windows application from other application. Basically, I want to click app B's button from app A's code.
I can use winapi findWindow to get a handler. The problem is that I have no idea the name of the button on the app B. Is this possible to list all the names or ids of an application?
I'm using c# to make it happen.
Since you're looking at suggestions (it's a pretty generic question really, it might or might not work depending on what other app/window is, is it e.g. browser or a 3rd party app etc., does it support automation)
Take a look at this closely related answer (it might be a duplicate but you're kind of 'looking for' still so maybe note).
Accessing Elements from Other Processes
Also this one on how to 'access' other app's 'inputs'
Pinvoke SetFocus to a particular control
I have not tested this. But it looks like a intressting libary. Maybe there is some function you can use. It is called White. This is just a sample:
Application application = Application.Launch("foo.exe");
Window window = application.GetWindow("bar", InitializeOption.NoCache);
Button button = window.Get<Button>("save");
button.Click();
You can use tool such as Spy++ (included in any Visual Studio except Express editions) to find name and class of that button and then use these information as parameters of FindWindow().

Available class events C#

in c# how can I get the available events of a class in order to begin programming code inside of it. I know that in form or usercontrol you can select the control and click the events button and click on the selected event to begin coding, but I mean a derived class which I want to code its methods or events.
Thanks!
The simplest way is to look in the documentation, to be honest.
If you're within the designer, your approach of using the properties window will work for other controls (buttons, textboxes etc) as well... and if you're in the IDE, you can type this. from any instance context (e.g. the constructor) and get a list of members up, including the events.
I would still suggest reading the documentation though - MSDN allows you to look at all members, or just the events (or methods, or whatever) at any one time. It's not terribly hard to peruse the list that way - and you can then check the details of the event so you can make sure you're using it properly, rather than just by guessing based on the name.
EDIT: As Aren mentions, there's also the Object Browser. Not my personal preference, but it's an option.
The events are listed in the IntelliSense popup window you'll get when you type the class reference variable name followed by a dot. They have a lightning bolt icon.
Many more organized ways to know what a class can do. You could read its documentation. Or browse its source code. Or use Reflector if there isn't any.
in Visual Studio 2010, they have got this new Help Library Manager where you can check for MSDN updates and download any updates or go to online directly. (you can also install Vendor API docs quite easily as well)

Is it possible to load 2 file explorer windows in 1 form?

I would like to have a form that has 2 windows file explorer(explorer.exe) views.
I know I could code a file browser in a few days, but I much rather just use instances of explorer. I dont need to re-invent the wheel, just two windows connected by a form.
Is this possible in C#?
You can use this controller and then just too 2 of them in the same window
There is no means by which to "host" an explorer window, as you want to do. The only way to come close is to use an OpenFileDialog, but that is obviously unsuited to what you're going for. There is no API around the explorer window; no matter what approach you take, you're going to have to use an actual control. There are plenty available online, such as the one linked to by Baget, but nothing built into .NET.
You need to use embeddable controls like Shell MegaPack for this.

Categories