Accessing elements of Office clipboard programmatically - winapi

As Office clipboard is different from System (windows) clipboard in a way that it can contain multiple items.
Is it possible to iterate over the elements of office clipboard programmatically?
Thanks.
Shakti

There is no API or documentation for the Office Clipboard.
Here's an article from 2010 that explores accessing MSO.dll directly to use the Office Clipboard.
I have not tested the code myself.

Related

Does anyone know what this is called on Visual Studio?

I want to figure out what this is called on visual studio.
I am trying to develop a small program that shows different lists depending on the time. This list references a database
I am trying to change the list that appears when i right click the program on the background task. Similar to this example where i right click outlook's background app and receive a list
This (system tray icon and its context menu) dates back at least two decades, and has been extensively covered in Windows programming books a long while ago.
You can still find legacy materials like NotifyIcon in Windows Forms,
https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/notifyicon-component-windows-forms?view=netframeworkdesktop-4.8
If you are going to write your own program, make sure you choose a proper UI framework first (Windows Forms is too old but still supporteD), and then use the equivalent control to achieve the same functionalities.

Program to drive a windows application

I would like to know is there a way to drive an existing windows application? I want to execute operations in an application like filling out text fields in a form, hitting next and submit buttons, etc. Basically what a user would do, I wanted to automate those operations. What would be the best way to achieve this?
Thanks
Mukul
It is possible (with limitations and quirks), if that particular Windows application uses native windows (so-called) controls (UI elements). Qt, for example, paints UI elements "by hand", while MFC applications uses Win API UI native (and expanded) elements. So, it depends.
You can explore application and it's UI elements using Spy++ tool inside Visual Studio (there are free alternatives available). Using these tools, you can look up target window class name, ID and other attributes that would help you to find and identify elements of interest using Windows API functions.
One can use EnumDesktopWindows, FindWindowEx, FindWindow, and others, to find window and it's inner control of your interest. Then, using SendMessage you can send various messages to set focus, emulate mouse clicks, set text for Edit control, simulate button clicks, etc, etc.
You can write such a program using UI Automation, which allows a program to discover and use the GUI of another application. It's how accessibility tools like screen readers interact with your applications.

How can I access menu items of a given program?

Given a program process (say Visual Studio 2012), how can I access it's menu items programmatically?
I'm not at all sure what APIs I would use or how to even Google this.
Thanks in advance.
Start with GetMenu(): http://msdn.microsoft.com/en-us/library/windows/desktop/ms647640(v=vs.85).aspx and over on the left are all the other menu functions. (Assuming you're talking Win32 API.)
Since it appears you have the process ID, you can find the main window's HWND from here: Win32 - Get Main Wnd Handle of application
unfortunately, more and more programs don't use the traditional "menu" subsystem. The answer given by Graham will work for some simple application, as calc.exe and notepad.exe, but not for VS2012.
I suggest using UIautomation.
The Windows SDks come with an "accessibility" tool, Inspect, that will show you if you can expect good support of UIAutomation by applications.
Microsoft now recommends using Accessibility Insigths instead:
https://learn.microsoft.com/en-us/windows/win32/winauto/inspect-objects?redirectedfrom=MSDN

OSX List of all Valid Open Windows in All Spaces?

I'm wondering if there's a way to reliably retrieve all open VALID windows in all spaces?
The problem I'm encountering now is that on programs like Microsoft Word for Mac there are lots of child windows, resulting in my list being muddied by blank windows with no title, or windows that just don't lead anywhere. For example, for Word I'm getting these 3 windows when I only have 1 document open:
Document 1
Microsoft Word
Desktop
All are from Microsoft Word, and same goes for Excel and Powerpoint, the problem seems to be pretty exclusive to the Microsoft Office suite. Any ideas on how to deal with windows that don't actually have anything?
You can try to correlate with Accessibility (you don't mention how you're getting the window list right now), or just use some heuristics (ignore windows with no title, no workspace number, look at the window tag bits, etc.). Pull up the window list in Quartz Debug, browse around and you'll see some differences. If the window is visible, you can also hold down Control-Option with Quartz Debug in the background to get a pop up HUD with some more detailed information about the window underneath the cursor.
If you're really desperate you could grab the window contents and see if they're all transparent or white.

Excel 2003 Workbook Form Controls sometimes resize when viewed through a Virtual Machine

I develop for clients who are still using Excel 2003 on Windows XP systems. Therefore we develop within a Virtual Machine running XP and Office 2003.
I often create menu or control sheets within files using Form Control objects, mainly button controls. Sometimes when I open these workbooks up, the controls resize themselves (bigger, smaller and/or out of proportion). On occasions I have had a control that when you click it, it gets smaller and smaller.
If you save the file after this has occurred, the changes are kept the next time the workbook is opened.
The big concern is that this could occur on an end user machine as well if they ever migrated to a different version of Windows and used the designed sheets within a VM.
Any suggestions greatly appreciated.
Sounds like this bug: http://support.microsoft.com/kb/838006/en-us

Resources