Note that there are some explanatory texts on larger screens.

plurals
  1. POVBA to Prevent Keyboard Input While a Package Object (XML) is Read into ADODB Stream?
    primarykey
    data
    text
    <p>I am developing an application which opens and reads an XML document previously embedded in a PowerPoint presentation, or a Word document. In order to read this object (<code>xmlFile as Object</code>) I have to do:</p> <p><code>xmlFile.OLEFormat.DoVerb 1</code></p> <p>This opens the package object, and I have another subroutine that gets the open instance of Notepad.exe, and reads its contents in to ADODB stream.</p> <p><strong>An example of this procedure is available on Google Docs:</strong></p> <p><a href="https://docs.google.com/file/d/0B1v0s8ldwHRYWnpzR0E0ajZHYXc/edit?usp=sharing" rel="nofollow noreferrer">XML_Test.pptm</a>.</p> <p>During this process there is a few seconds window where the Notepad.exe gains focus, and an inadvertent keystroke may cause undesired results or error reading the XML data.</p> <p>I am looking for one of two things:</p> <ol> <li>Either a method to prevent the user from inadvertently inputting (via keyboard/mouse/etc) while this operation is being performed. Preferably something that does not take control of the user's machine like <code>MouseKeyboardTest</code> subroutine, below. Or,</li> <li>A better method of extracting the XML data into a string variable.</li> </ol> <p><strong>For #1:</strong> this is the function that I found, which I am leery of using. I am wary of taking this sort of control of the users system. ##Are there any other methods that I might use?##</p> <pre><code>Private Declare Function BlockInput Lib "USER32.dll" (ByVal fBlockIt As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Sub MouseKeyboardTest() 'both keyboard and mouse blocked BlockInput True ' Turns off Keyboard and Mouse ' Routine goes here Sleep 5000 ' Optional coding BlockInput False ' Turns on Keyboard and Mouse End Sub </code></pre> <p><strong>For #2:</strong> Some background, but the issue seems to be the inability to extract the embedded object reliably using any method other than <code>DoVerb 1</code>. Since I am dealing with an unsaved document in an application (Notepad) that is immune to my VBA skillz, this seems to be the only way to do this. Full background on that, here:</p> <p><a href="https://stackoverflow.com/questions/14745056/extracting-an-oleobject-xml-document-from-powerpoint-vba">Extracting an OLEObject (XML Document) from PowerPoint VBA</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload