read/capture Windows pop-up message in vb6? - vb6

Problem: Need to read/capture the text of Windows pop-up messages that is generated by non-VB applications.
Situation:
I've a VB6 app, part of which requires processing an excel workbook. A non vb-6 pop-up window (as attached screen) "FILE CONVERSION IN PROGRESS" comes up, while opening an new version of excel-sheet from an old MS Excel app. And automatically it closes alos.
Requirement: I want to capture that pop-up occurance in the code. And then write a conditional statement code for the 'cancel' button click event of that non vb-6 pop-up.
Can anyone suggest something?

You can access other applications with the following APIs:
FindWindow() to locate the main window of what you're looking for
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499%28v=vs.85%29.aspx
GetWindow() to navigate through the HWNDs of the application so you can get to the button
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633515%28v=vs.85%29.aspx
GetWindowText() to access the text from a control (it cannot be an Edit control)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633520%28v=vs.85%29.aspx
You'll want to use Spy++ (which can be downloaded) to see what the class name you're looking for when it comes up and to figure out the hierarchy to navigate properly.
You'll need to use the API Text Viewer to get the API declarations so you can use them in VB6 properly.

Related

Need SendMessage Command to get List from a VB6 application

Hi I have a program that is built using VB6(I do not have the sourcecode, only executable), that has a listbox and will have couple of items in that listbox. I need to read contents of it using SendMessage. Please let me know if that is possible.
It's possible if it's a standard or at least documented listbox control. Usually one would use a "spy" program to examine the target app and obtain window titles/classes/etc. used to programmatically locate the window that is the listbox control. Then you just use SendMessage() to talk directly to the HWND of that control and get the info you need.
See similar question:
Read listbox content of from another application C#

VBScript - create button in the notepad window

Using VBScript, I want to add an additional button to Notepad labeled “send” . The send button should be located near the help menu in the Notepad window
Please advise if it is possible to add a button inside Notepad. And if it possible then how can I create the button using VBScript?
Note - why I need to add the send button: The purpose of the send button is to send the file opened in Notepad to a remote Linux machine over the network.
This is not possible with VBScript. You could possibly manage to add the button, but you couldn't hook anything to respond to it being clicked.
You could probably hack something together using the native Win32 API, but it's more work to do that than it would be to write your own simple editor in any other language and use it instead of Notepad. (Notepad is simply a thin wrapper around a multiline edit control provided by the Windows API.)
It's Impossible via VBScript but with help of more serious languages like c# or c++ freely:
for example see project of my friend:
http://www.codeproject.com/KB/COM/automatingwindowsapps.aspx

How to use AutoIt to click a window dialog in a different language

On Windows 7, when we install an unsigned driver, it will pop-up a Windows security dialog. It is easy to have it be clicked on by AutoIt. Just search the window dialog with the specified window title.
But now, I want to use it on another platform with a different language. The window title will be changed to the local language, not the 'Windows security'.
How can I create the AutoIt script, which can handle the Windows security dialog in different language?
Fix this issue by finding a child handle from the security window class.
Try to use a class on Tittle. Title = [CLASS:notepad]
for more information visit here http://autoitsourcecode.blogspot.com/2013/04/autoit-control-send.html
Use the "AutoIt v3 Window Information" Tool provided by the "AutoIt full installation" and try to get some unique information like a Class name which is occuring in each different language dialog window as descirbed in advanced window descriptions. Then use these to search for the proper security window.
I'd suggest, you use the WinWaitActive("[REGEXPTITLE:Windows Security|Windows Sicherheit]") function with regular expressions for being able to wait for multiple windows with different titles.

Where do default MessageBox caption in Windows applications come from?

MessageBox.Show (.NET framework) or MessageBox (e.g. VBA) opens a modal message box from the window of the current application.
My questions are:
If I do not specify the caption (i.e. what appears in the top-left hand corner) of the message box in the arguments, does the default vary according to the application being run?
For example, if a message box pops up in Internet Explorer, would the default caption always say "Microsoft Internet Explorer"? Is this also true for other Microsoft applications such as Excel, Word, etc.?
Where does the default caption come from? Where does the system get the name "Microsoft Internet Explorer" from? Does the name come from the caption of the application window, or does it come from the register in task manager? I cannot find any documentation in the Microsoft website.
If you don't specify a caption nothing appears. There is no default.
By default, the message box displays an OK button. The message box does not contain a caption in the title.
Source
If an application is showing a title then it must be calling the overload that requires the caption as well as the message.
Thank you. I have just done a simple experiment using VBA on Excel. A statement like the following was added to the macro:
MsgBox("Test")
As you can see, the title was not specified (it is the 3rd variable). The title came up as "Microsoft Excel".
So the conclusion seems to be that there is a default, and it is the name of the application which invokes the message box.

How to launch "Choose Application" dialog on Mac?

I am using LSOpenItemsWithRole() to open any file from my application. It works fine for all files which has a default application on Mac, but for the files which cannot be opened with any default application this method returns an error kLSApplicationNotFoundErr and does nothing.
For such cases, I want my application to launch the "Choose Application" dialog box, so that end users can choose any application from there to open the file. This dialog box pops up whenever any such file is directly opened by double clicking. Is there is any direct API call to do the same?
I don't want to use Objective C call, is there any way to do it using Carbon API calls?
You should use an NSOpenPanel, starting the user in the Applications folder use and the panel:shouldEnableURL: delegate method to filter out paths that don't end in .app. You can use setAccessoryView: to add any custom options to the dialog. This is what the Finder is doing when you click on the "Other..." option when selecting which application to use.
I think you can do it by using NavCreateChooseFileDialog, with NavCustomControl to set the initial location and NavDialogSetFilterTypeIdentifiers to filter out non-apps. (Why don't you want to use Objective-C? You know that you can mix Carbon and Cocoa in one app, right?)

Resources