TL;DR: When browsing a program's DataGridView control's properties using ManagedSpy it causes that program to allocate its DataGridView data as XML in its memory. How can I cause that same thing to happen from my program? (it's not quite a DataGridView, the control is called Infragistics.Win.UltraWinGrid.UltraGrid)
Full Story:
I'm using ManagedSpy (http://msdn.microsoft.com/en-us/magazine/cc163617.aspx) to spy on a program that we'll refer to as DataProgram. Please refer to Figure 2 on that page for a screenshot of ManagedSpy.
DataProgram has a DataGridView-ish full of information that I need. It also has an option to export that info to an excel file. I'd rather have the option to export it to CSV into my Clipboard.
When I walk through DataProgram's controls on ManagedSpy's treeview, I can find the exact DataGridView that I need the info from. I know it's the right one because I can right-click it and choose "Show Window" and it'll flash a box around the control.
Here's the weird part: Right when I left-click it to view its properties on the right side of ManagedSpy's window, something magical happens. The whole table is allocated inside DataProgram's memory as XML, so that with the help of a memory scanner I can see that the whole table is right there in front of my eyes... and then the Garbage Collector takes it away. But it's there for some good 30 seconds or so (of course it varies, with the GC being non-deterministic). By the way, the control class is Infragistics.Win.UltraWinGrid.UltraGrid, and it's like a beefed up DataGridView (I imagine).
Here's my question: As you can see I want to read DataProgram's memory at the precise point it has the XML table allocated. I know how to read the memory already (using ReadProcessMemory). I'd like to learn how I can trigger DataProgram to allocate that XML table from my program just like ManagedSpy does. Mind you, ManagedSpy's source code is available from the website but I'm not able to debug it because it only runs as administrator and for some reason I can't make it run. I just need to know how I can, from my program, provoke DataProgram to create that XML info so that I can read it from its memory.