This question pertains to VBA Internet Explorer automation
What I have is an Internet Explorer window that loads a dialog box with buttons when the page loads.
Here are the givens:
The dialog box is of the "Internet Explorer_TridentDlgFrame" class
It isn't considered an app window like its originating IE window.
Its "form" and button "ID's are obtainable but not within DOM of the originating IE document
So, referencing said IDs to interact with them does not work.
Similarly, injecting JavaScript attached to its buttons does not work
The dialog box can't be bypassed by closing it. A "continue" button must be pressed.
So I figured I'd use another method:
If I cycle through all windows, I can obtain the dialog box's window handle via its window title.
With that said, is there a way to late-bind "Object A" to the dialog box's window via handle?
And if so, is it then possible to late-bind "Object B" to "Object A's" document/form in order to interact with it?
This would be like accessing an existing instance of an open Excel workbook and late binding an object to it in order to interact with the workbook itself.
Note: I have used Selenium in the past, and while it may be a better solution to get around this dialog box, translating the rest of my (already) written program into Java would be a nightmare.
Note2: Using winHttp or other "headless" methods isn't an option
Any help is appreciated! Thanks!
Related
I tried to select/display the builtin pagesetup dialog highlighting the pagesetup tab in 'spreadsheetgear workbook explorer' window. In the .exe provided by spreadsheetgear, it is shown but not in the sample code provided by them, can anyone from the expert group who uses the spreadsheetgear advice me how to select the specific tab in the workbook explorer of spreadsheetgear through code.
If you are trying to pre-select a particular "Page Setup" node for a particular worksheet in the TreeView of the Workbook Explorer dialog when you instantiate this dialog yourself, i.e., something like...
WorkbookExplorer explorerDialog = new WorkbookExplorer(workbookView.ActiveWorkbookSet);
//explorerDialog.SelectPageSetupNode(...); // This API doesn't exist.
explorerDialog.Show();
...then this is not possible, as there are no public APIs to do this.
The SpreadsheetGear2017ForWindows.exe application can do this because it has access to internal APIs to make such a selection. We do collect feature requests to expose public APIs to perform such tasks (I work for SpreadsheetGear), so I can add one for you, although I cannot comment on if or when such a feature would be added to our product.
I have a task involving Outlook 2013 and the Skype for Business add-in (formerly known as Lync).
The add-in has a button which changes an appointment into a "Skype meeting".
Pic of button
Upon clicking this button, the following is added to the email body.Pic of default text
My goal is to change this default text (it isn't editable anywhere else). The way I planned to do this is by creating a macro to call the same function which the "Skype Meeting" button does, and then edit the body of the message after the default meeting text has been placed.
I checked for the "name" of the button via the 'Customize the ribbon' window, and within the 'Skype Meeting' group the 3 buttons had the same description (Macro: OnUCAppointmentOnAction)
Using VBA's object explorer I found the details of the method OnUCAppointmentOnAction:
Sub OnUCAppointmentOnAction(asIRibbonControlPtr As Object)
Member of UCAddinLib.UCAddinCallbackInterface
method OnUCAppointmentOnAction
I have added the library reference within VBA to UCaddin.dll (it's called Office Communicator W14 Type Library), yet when I try to call the macro OnUCAppointmentOnAction I get the error "Sub or Function not defined"
Where am I going wrong? Is there is a better way?
Don't do that. That method is implemented by the COM object implementing the IDTExtensibility2 interface that Outlook creates on startup when it loads the addin. In theory, you can do the same, but nobody known what will happen if there are two instances of the addin object instantiated. Simulate a click on the button, then edit the appointment body.
I am trying to automate a ribbon control in power point. In that ribbon there are popup windows which contains settings information, when I try to automation those setting popup windows using Coded UI, I got error message like "the control cannot be located playback fail to find control with give search properties", But Coded UI can find the popup window but it fails to find any controls inside it.I have already tried with
SearchConfiguration.AlwaysSearch and setfocus()
Does any one have solutions, it will be very helpful for me!
Find the parent object, i.e the popup window, and enumerate through the children objects manually if codedUI is not able to locate the objects.
IEnumerator<UITestControl> appt = uiMainWindowControl.GetChildren().GetEnumerator();
I am writing a word add-in in VB .NET (using Add-in Express, but I don't think that's relevant).
I have created shortcuts, but I only want them to take effect if the document itself is in focus, not a dialog - for example, "Find and replace" or any other.
How do I determine if a dialog has focus?
The "Selection" property of the application points to the selection in the document, even if a dialog is currently selected. I can't find any "HasFocus"-equivalent property anywhere either. I'm running out of ideas :o)
Thanks!
This workaround worked for me:
My add-in keeps a reference to the handle of the most recently activated Word window, by using the GetActiveWindow API during the WindowActivate event of the Word application. This is necessary since, up until Office 2013, the Window object does not expose a handle property.
When a shortcut is triggered, I compare that to the handle of the currently active window, using the same API. If they don't match, I simply don't proceed :o)
I have a windows application with a tabcontrol. One of the tab of the tabcontrol has a webbrowser control.Now the issue that I am facing is when the focus is inside the webbrowser control, the normal Ctrl+Tab functionality of the tabcontrol is not working.I want the Ctrl+Tab to change the selected tab of tabcontrol even when the focus is inside webbrowser control in selected tab.How to achieve this ?
I have already tries overriding ProcessCmdKey.but it does not get hit when focus is inside webbrowser control.
I also tried registerhotkey method ,it works but it locks the Ctrl+Tab hotkey within my application & system doesn't respond to any other Ctrl+Tab presses outside my application when application is running, which is expected behaviour of registerhotkey.
Here is the code you need:
If WB.ContainsFocus Then
MsgBox("We have focus, disappearing...")
WB.Document.Body.RemoveFocus()
End If
Now, the question is, when to run that code. If you put it in the WebBrowser1_GotFocus event, you'll need to turn it on and off. Turn the code off if the user is interacting with the WB Control, and turn it back on when they are not and when you expect to be experiencing the problem you've mentioned.
Of course, you could add another line to ensure a particular control/tab/panel etc gets focus after you remove focus from the body. Also, here are 3 other SO questions that have answers which may help you, but these will take you in directions different to the direction I've provided, probably due to the fact that the questions are not identical to yours, but are similar enough to be useful (not listed in order of preference).
Prevent WebBrowser control from stealing focus?
Webbrowser steals focus
Focusing WebBrowser control in a C# application
UPDATE:
I just wanted to add, instead of the .Body.RemoveFocus() you could do this:
WB.Document.Body.Parent.RemoveFocus()
Which I prefer, since the .Document object didn't have an explicit .RemoveFocus method on the intellisense I was gettign in VS2012 RC. This is probably referring to the HTML tag (and not the .Document object) and since the html tag is the only parent to the body tag, it makes sense, and there is no "HTML" object directly available in the intellisense under object, since you can get it via other means, so it's just more convenient doing it this way.
Cheers, and let me know if you need more info on anything.