I tried to embed external app, not only notepad but also mstsc (remote desktop), within a tpanel in my delphi application.
With CreateProcess i run application and with Windows.SetParent i embed first app window.
I get problems with next windows opened by then external app (for instance file-open window in notepad or next login window and main window in remote desktop).
Timing a call to enumwindows for the external process is a solution, but enumwindows list every window of the process (also popup & controls).
Is there a way identify only process' windows (forms) to be relocated, or a way to embed the process once for all within the panel?
Thanks
Related
I'm trying to automate a windows desktop application and everything is fine until in one of the steps in my application, I have to click on a "Browse" buttom that opens a windows explorer window to select an image and load it.
The thing is that I do not know how to make WinAppDriver focus in this new window, to be able to select the image and load it.
This is a part of the desktop application, and when sending click on Browse:
You probably need winappdriver to change its current handle to the one from the new explorer window. I'm not sure about the Python syntax, but in C# you do it like this:
driver.SwitchTo().Window(Driver.WindowHandles.Last());
The Last() function just selects the most recent added windowHandle.
Make sure you keep your previous window handle around, so you can switch back once the explorer window closes.
Also take a look at these posts. Its about webdriver but the functions are similar:
webdriver C#
webdruver java
I have a dll that is injected in a process and this dll contains a Form where i want use MessageBox() (or some other type of dialog) to alert the user about some operations.
Eg:
Application.MessageBox('successful operation!','Information',mb_Ok+mb_IconInformation);
Happens that everytime that this is showed, also is showed the icon of target application in Windows taskbar, and i not want this.
Then i want display these messages without show application icon in taskbar.
How make this?
In Delphi 7, Application.MessageBox() calls the Win32 API MessageBox() function specifying the Application.Handle as the owner window 1.
Inside a DLL, Application.Handle is 0 by default, so your MessageBox dialog is being displayed without an owner window assigned to it. That explains why it is able to appear on the Taskbar, as only a top-level unowned window (with the APP_EX_APPWINDOW extended style) can appear there.
So, the simplest solution is to call the Win32 API MessageBox() function yourself, specifying an owner HWND that belongs to the app you have injected your DLL into. Or, if you want to keep using Application.MessageBox(), assign such an HWND to the Application.Handle property after the DLL has been injected.
But either way, make sure the thread that is calling MessageBox() is attached to the message queue of the chosen owner HWND. If you are calling MessageBox() in a separate thread, use AttachThreadInput() to make that attachment before calling MessageBox(), and again to remove the attachment after MessageBox() exits.
1: In later Delphi versions, Application.MessageBox uses the Application.OnGetActiveFormHandle event, the Win32 GetActiveWindow() function, and the Win32 GetLastActivePopup() function (in that order) to find a suitable owner window before resorting to using the Application.Handle.
I am coding up a VST plugin dll. I have no trouble with the plugin until I use a PageControl and place controls on it.
Specifically, my dll seems to have trouble receiving mouse clicks if the control I click on is in a tabsheet, and has code to execute in a mouse onclick or onChange event. However, this ONLY occurs when the hosting program gives control back to my plugin. I can interact perfectly fine with the plugin before the hosting program implements the settings I select, but once it tries to hand back control, I can only click on, seemingly, any control that does not implement any written mouse event code (Tlabel clicks are fine, tabsheet changes are fine too).
The plugin works fine as long as I don't try to make changes to the settings through the controls after the hosting program hands back control to the dll. I can use the same settings over and over again with no problem. I can change them as much as I want until I let the hosting program implement the plugin values (which works perfectly).
This is really tricky to debug since the program is in a dll.
I have tried using Delphi XE2 and Delphi 2009.
Any clues?
With Windows 7/8, this very nice ole2 interface IWebBrowserDisp is no more working properly, for some reason it now opens the IExplorer Window behind the actual currently running delphi application, not to the front of the screen as it used to be work earlier.
This makes the application to fail as user cannot see the opening web page without manually switching to Iexplorer and locating the correct window.
The code that I use to launch the link is:
WB : TEmbeddedWB;
wb.Navigate(URL,x,x,x,x);
This problem does not exist in older Windows or while I use my Delphi IDE ( I use Delphi4 and run it as ADMIN).
I was wondering if it was possible in Delphi to implement some items added to the right-click menu of an EXE file, specifically a Windows Service Application EXE which has not yet been registered or installed anywhere. The menu options would allow user to install/uninstall the EXE as a windows service. Is this possible? If so, then how? It's OK if it's only compatible with Windows Vista+.
There would be 2 menu items:
Install (or Uninstall)
Start (or Stop)
If you're referring to the Shell Context Menu (the right-click window in Windows Explorer), you cannot. You can add to the menu that will be displayed for all .exe files, but not for an individual one.
You could register a context menu handler for all executables, and then filter the filename passed to see if you needed to handle it or not, but this would mean that for every one of the hundreds (or thousands) of executable files on your machine, your filter would run on the slim chance it was your application that was right-clicked.
A possible workaround would be to put a file with a custom extension in your service's folder, and add a context menu handler for that file instead. When that file is right-clicked, the menu items would simply call your service with the appropriate command-line parameters.
(Of course, the best solution is to use the Control Panel's Services applet to manage your service, which is what it's designed specifically do do.)
It is possible, and you need to write shell extensions for Windows Explorer.
References:
http://delphi.about.com/library/bluc/text/uc071701a.htm
http://www.andreanolanusse.com/en/shell-extension-for-windows-32-bit-and-64-bit-with-delphi-xe2/
http://www.codeproject.com/Articles/441/The-Complete-Idiot-s-Guide-to-Writing-Shell-Extens