Is it possible to do "Window Actions" through Code?

prabha_friend

Prabhakaran Karuppaih
Local time
Today, 21:12
Joined
Mar 22, 2009
Messages
940
Like "Sorting a Folder"...

For Example:
Sort By -> Date Modified
 
Hi Ran,

So far, I am able to see only posts on topic relating to "Reading the Properties" of a folder but what am I interested to learn is "Executing an Action on a folder" like "Sorting". Simply said: My venture is on to know how to Automate the windows itself otherwise atleast the folder actions. Possible?

Thanks for the reply...
 
As far as I recall you can open File Explorer to a certain directory, but I'm not sure you can do much else with it and since nothing the user selected would pass back to the VBA code it's kinda useless from a programming point of view.

You can build your own file browser in a form.
You can use whatever file browsers an application allows you access to.
You can reference third party controls / the common dialog control.
 
prabha_friend, you cannot sort a folder unless the folder is on-screen - because what you see in the query is like a query or like a datasheet view of a table. Sorting is for the gui presentation, not for the underlying data. If the folder is not presented to a gui, there IS no sort operation to be performed. Directories have a fixed order and you don't change that order when you sort by a particular column.

Having said that, the first thing you would need to know is the handle of the window that you wanted to sort. Since window handles are allocated and released, there is no such thing as a permanent handle, so you would need to find the window, then determine its handle, then work with window presentation. However, since there is a perfectly good GUI to do this, the sorting features will be questionable.

IF they exist at all, you would need to look up the COM interface for Windows Explorer, since THAT is the GUI you will have to control.
 

Users who are viewing this thread

Back
Top Bottom