Printing to main window while a form is active in foxpro - visual-foxpro

I'm wondering if it is possible to output text to the main window in foxpro while a form is active? Once the form is up my ? commands get sent to the form but that is not where I want them displayed.

Look into the command
ACTIVATE SCREEN
This should redirect to the main VFP window and not the window you are currently in. I know, it's a pain with these '?' outputs that keep shifting up the visual content within whatever is the current window.

You need to set the AllowOutput property of your form to false.
Setting the AllowOutput property to False (.F.) on a form, changes the following Visual FoxPro behavior.
Painting of the form is redirected to the next output window or desktop. This affects commands, such as ?, ??, DIR, LIST, DISPLAY, CLEAR, and other commands that display output on a form.
The WOUTPUT( ) function does not return the name of the active form. It returns the name of the current output form or desktop.
The BROWSE command does not inherit the window size and window settings of the form.
The MCOL( ) and MROW( ) functions, without the use of their optional parameter, may not be relative to the form they are called on.

Related

How do I know when my Ctrl + C command has been processed?

I need to copy the currently selected text from the currently active window in the currently active app.
If the app support guiInfo.hwndCaret, then I use this.
However, in some cases, the app does not support guiInfo.hwnd_Caret, and I have to fall back to plain copying to clipboard to get the currently selected text.
I am checking the WM_DRAWCLIPBOARD message to see when the content of the clipboard has changed.
However, when nothing is selected in the current active window, this message is not called because the clipboard has not changed.
How would I know that the Ctrl + C has been processed anyways?
Thank you!
From MSDN
Each time the contents of the clipboard change, a 32-bit value known
as the clipboard sequence number is incremented. A program can
retrieve the current clipboard sequence number by calling the
GetClipboardSequenceNumber function. By comparing the value returned
against a value returned by a previous call to
GetClipboardSequenceNumber, a program can determine whether the
clipboard contents have changed.

Is it possible to manually refresh the contents of a .per file?

I have custom .per files used to provide the user a way to interact with an application from Lauterbach. However, once in a while the values of some variables do not update and the only way to get it back to regular functioning is to close the per file and re-open it.
Is there a command that can be called to "self-refresh" the .per file?
Unless you have limited the updating of windows showing memory (e.g. with command MAP.UpdateOnce) all values should be updated periodically (according to SETUP.UpdateRATE).
So I think, there should be no need for a refresh command. Maybe you should contact Lauterbach support and they can help you to find the source, why some values are not updated..
Anyway, the command to force an update of all windows showing memory is Data.UPDATE
If Data.UPDATE is not doing the trick, you could also add a button to your PER window, which allows you to easily re-open the window. To do that, use the following PRACTICE script (cmm-script):
MENU.ReProgram
(
ADD
BUTTONS "per.-W"
(
MENUITEM "[:refresh]refresh"
(
PRIVATE &cmd &left &up
&cmd=WINdow.COMMAND(WinTOP)
&left=WINdow.POSition(WinTOP,LEFT)
&up=WINdow.POSition(WinTOP,UP)
WinCLEAR WinTOP
WinPOS &left &up
&cmd
)
)
)
You need to execute this code before opening the PER window. (I suggest to add this code to the file C:\t32\system-settings.cmm to get it executed on every start of PowerView.)
When opening a new PER window after executing the script, your PER window will have this button:
When clicking the button it will re-open your PER window.
You can add a button for Data.UPDATE to your PER windows in the same way.

How can I get data from dialog of window?

I am a newbie in Xlib world. In my project,I want to share my window to another via Remote desktop protocol, but they only saw content of window and didn't see anything if click on menu item of window. I used XGetImage to get data of specifies window. But If that window contain dialog ( see image here) I couldn't get data of dialog .
I use freeRDP source code, I modify in X11_shadow.c
function:
int x11_shadow_screen_grab(x11ShadowSubsystem* subsystem){
...
image = XGetImage(subsystem->display, 58720435, 0, 0, surface->width,
surface->height, AllPlanes,ZPixmap); //with 58720435 is window id of chrome
... }
In my opinion, the most important here is how can I get data of dialog in Window. I have a solution :
1. get window id of that dialog ( I am not sure the dialog has owner Window ID)
2. Use XGetImage get data of that dialog.
But It's not working.
I works on Linux environment.
Are there any solutions for my problems?
Thank you very much

How can I make a console-like textbox?

I am making a program called "BasicSys". It is a BASIC System simulator that uses a textbox for the console. So far I have everything working great but I need to have the text box act like a command prompt window. It needs to be able to ask for input and retreive the value without allowing the user to modify anything outside of the prompt space (the space where the user should only be able to type is after a ":" or a ">"). Some feilds are password feilds that require either no echoing or having the chartacters replaced by *'s. Is it possible to make a console out of a textbox?
P.S. I also want to know if there are any small BASIC v2 compilers for Win32 so BasicSys can compile and run BASIC programs.
Depending on how realistic you want it to be you can use the API to open a real console window and interact with it. There are many examples available that you can find by searching such as this one. My suggestion though would be to fake it with a multi-line textbox. It would not be very tricky. Set an index every time you draw the prompt, then as long as the cursor is positioned after the index the textbox is read / write. If the user scrolls backwards make the textbox read only. It should be fairly simple using the KeyDown event and setting the ReadOnly property True / False to get a passable "command" window.

Get Context Menu text of specific TaskBar button

I've got some code that grabs the TaskBar buttons and their text from the windows TaskBar using User32.SendMessage with the TB_GETBUTTON message to retrieve a TBBUTTON structure (Win32 API via C# P/Invokes). But I'm trying to figure out how to then, once I have the handle to the button, grab the associated context menu text. There is some status information on there for a specific application that I would like to retrieve. The button text gets me some of it, but I need to the context menu text to complete it.
Any ideas?
This is not completely clear... Context menus don't have text, as such - they have menu items, each one of which will have text. By "context menu text", do you mean the text of the menu items in the taskbar button's popup/context menu? For example, "Restore", "Minimize" etc in the screenshot below?
If so, I suspect you're going about this the wrong way:
This menu doesn't belong to the button, but is the system menu of the window represented by the taskbar button. If the button has a context menu, this is probably for a grouped collection of windows, not one specific window (or even windows for one process.)
Making judgements based on the context menu of a window sounds like a dodgy approach to me, especially based on text since that will change depending on where in the world your user is located. Applications can also change the contents of this menu so there's no guarantee it will contain something you expect to be there. It would be better to check the window style, if it's minimized, etc, to find out the information that also affects the contents of the menu.
I'm going to answer this based on what your needs seem to be from the question, not what you've directly asked, since (a) it's not possible as asked and (b) I think you're trying to do something else. (As a general guideline, in a question it's good to state why you're trying to do something - and even maybe ask about that, ie 'how do I achieve X' - in case there's a better method than the one you're using. Here, X is probably 'find out information about this window' not 'get the text of the context menu', because that's probably only one possible method to get to X.) Also I think extracting data from the internals of a third-party application like Explorer (the taskbar is an Explorer window) is fragile and prone to break in future versions of Windows.
The system menu or window information (whichever one) belongs to application windows. Unless taskbar buttons are grouped (and then it's the subitems) one taskbar button corresponds to one specific window in the system. So what you want to do is find these windows. You do this by:
Using the EnumWindows function
Then for each window that is passed to the callback, checking the extended window style using GetWindowLong with GWL_EXSTYLE to see if the WS_EX_APPWINDOW bit is set
In addition, sometimes other windows are shown: these heuristics should help.
Each one of these windows is a window that should appear on the taskbar, Alt-Tab dialog, etc.
You say you're getting the text of the taskbar button - this is probably the window caption of the window, and GetWindowText is the canonical (read: probably a lot more reliable) way to get the caption of a window belonging to another process.
If you really want the popup menu, then:
Use GetSystemMenu to retrieve the handle for the system menu for the window. Applications can customise this, so if your app is doing this (and that's why you want the popup menu) ensure you pass false to the bRevert parameter
You can then get the number of menu items using GetMenuItemCount and for each one call GetMenuItemInfo to get info about each menu item. Pass true to the fByPosition parameter to indicate you're accessing the menus by position (since you know the count, you're getting item 0, 1, 2... count-1).
This fills a MENUITEMINFO structure, which (I think, I haven't ever had to code this so I haven't tested) will tell you the text associated with an item via the dwTypeData field "if the MIIM_STRING flag is set in the fMask member".
If you really want information about the window status, you can get this information using methods like IsIconic to see if it's minimized, GetWindowLong again to get other information, etc. I'd suggest you ask another SO question about how to get whatever specific information about a window for details.
Hope that helps!

Resources