2 simple questions regarding window (form) creation (OpenInsight Specific)
At 29 NOV 1997 05:00:35PM Dave Pociu wrote:
1. When starting a window (using Start_Window or Dialog_Box) how can I programatically position the window BEFORE it is visible on the screen.
I tried doing if before forward_event in the CREATE event but the window is already up at the time. Making it invisible, positioning it and making it visible again creates annoying flickering.
All I want is that the first time the user sees the window open, that window is already positioned. (No flickering or window movement)
2. How can I start a window maximized or minimized? Also , how can I maximize, minimize a window (regular or MDI child) programatically?
Thanks
At 30 NOV 1997 01:45AM Don Bakke wrote:
Dave,
1. When starting a window (using Start_Window or Dialog_Box) how can I programatically position the window BEFORE it is visible on the screen…
Assuming you are using the SIZE property to reposition the window (e.g. I do this all the time to center a window) then you don't need to set the VISIBLE property. Invoking the SIZE property automatically makes a window visible, but after the repositioning has taken affect. Therefore keep the window invisible and use the SIZE property during the CREATE event.
2. How can I start a window maximized or minimized? Also , how can I maximize, minimize a window (regular or MDI child) programatically?
For MDI Child windows use the initialappearancemode parameter of the
Start_MDIChildfunction. For general coding adjustments use the Window's API function
ShowWindowfunction. If you need parameters and tips on how to use this function let me know.
At 30 NOV 1997 11:49AM Gene Gleyzer Revelation wrote:
Don,
in addition to what you wrote, the same value you would use with
ShowWindow(hwnd, nCmdShow)could be used with VISIBLE property:
Set_Property(winId, 'VISIBLE', nCmdShow)that is translated into exactly the same Windows API call
Gene
At 01 DEC 1997 03:16AM Oystein Reigem wrote:
Dave,
Making it invisible, positioning it and making it visible again creates annoying flickering.
You must make it invisible in Form Designer. From how you describe it I assume you do it in the Create handler.
- Oystein -
At 01 DEC 1997 04:07AM Andrew P McAuley wrote:
Assuming the window is invisible from the form designer - on the create event setting the VISIBLE property to 3 will maximise the window, 2 will minimise.
World Leaders in all things RevSoft (Except VIP)
At 01 DEC 1997 08:18AM Dave Pociu wrote:
Thanks to everyone that answered.
Since it came up in the answers, some more info on what parameters ShowWindow takes would be welcome. Is this function going to be documented in 3.5 ?
At 01 DEC 1997 08:37AM Don Bakke wrote:
Since it came up in the answers, some more info on what parameters ShowWindow takes would be welcome. Is this function going to be documented in 3.5
It is doubtful that this function (as with all the Window's API functions) will be documented, other than in passing, because you can pick up a good API manual from most bookstores. Especially ShowWindow since apparantly setting the VISIBLE property is a shell around ShowWindow anyways.
Anyways, the second, nCmdShow, parameter of ShowWindow has these options:
SW_HIDE…Hides the window
SW_MINIMIZE…Minimizes the window
SW_RESTORE…Activates and displays the window
SW_SHOW…Activates and displays the window in its current size and position
SW_SHOWMAXIMIZED…Activates and maximizes the window
SW_SHOWMINIMIZED…Activates and minimizes the window
SW_SHOWMINNOACTIVE…Displays and minimizes the window. The currently active window remains active.
SW_SHOWNA…Displays the window, but does not change which window is active.
SW_SHOWNNOACTIVE…Displays the window, but does not change which window is active.
SW_SHOWNORMAL…Activates and displays the window. If the window was minimized or maximized, the window is returned to its previous size and position.
SW_HIDE=0
SW_MINIMIZE=6
SW_RESTORE=9
SW_SHOW=5
SW_SHOWMAXIMIZED=3
SW_SHOWMINIMIZED=2
SW_SHOWMINNOACTIVE=7
SW_SHOWNA=8
SW_SHOWNNOACTIVE=4
SW_SHOWNORMAL=1
At 01 DEC 1997 08:42AM Don Bakke wrote:
Gene,
Set_Property(winId, 'VISIBLE', nCmdShow) … is translated into exactly the same Windows API call
That nice to know, thanks. BTW, how does OI determine the handle of a particular window? I've never been able to get FindWindow to work correctly by passing it the title bar caption so I've been forced to always get the Class of a particular window using another tool and then use that in FindWindow.
Any suggestions on how to successfully use the former method?
Thanks,
At 01 DEC 1997 12:48PM Aaron Kaplan wrote:
How about
hWindow=GET_PROPERTY( windowName, 'HANDLE')
At 01 DEC 1997 07:15PM Don Bakke wrote:
How about hWindow=GET_PROPERTY( windowName, 'HANDLE')
I meant for external application windows. I'm figuring that even
hWindow=GET_PROPERTY( windowName, 'HANDLE')must eventually resort to FindWindow.
One of my applications launches the BMP editor of choice for the end user. I've gathered the classes of most popular ones and have hardcoded those so OI can manipulate them as needed using FindWindow and ShowWindow, but if the end user specifies an editor I've never worked on then I can't get the handle of this external application using its class. I can, however, use it's title bar caption (which the documentation says FindWindow can use) but I've never been able to get it to work at all or work without crashing.
At 02 DEC 1997 07:36AM Cameron Revelation wrote:
Don,
I'm figuring that even hWindow=GET_PROPERTY( windowName, 'HANDLE') must eventually resort to FindWindow.
That is not the case. Presentation Server keeps track of the window ID vs its handle.
I can, however, use it's title bar caption (which the documentation says FindWindow can use) but I've never been able to get it to work at all or work without crashing.
With the Windows API function FindWindow, you must always specify a class and you can optionally specify a caption.
Use the Spy++ tool that comes with VC++ 1.52c to determine the class of a window.
Cameron Purdy
—————————–40372639128339–
At 02 DEC 1997 09:03AM Don Bakke wrote:
Cameron,
That is not the case. Presentation Server keeps track of the window ID vs its handle.
Okay, I'll buy that. However…
With the Windows API function FindWindow, you must always specify a class and you can optionally specify a caption.
This is where I'm having trouble understanding. Although I'm the first to admit that I'm still treading uncharted waters with the Windows API, here is what I've researched:
1. In The Windows API Bible it says the following -
FindWindow finds the window's handle given the class name and/or the window's title (emphasis mine)
lpClassName LPSTR: Pointer to a null-terminated string containing the window's class name. If this parameter is NULL, all classes will be searched to find the window name. (emphasis mine)
lpWindowName LPSTR: Pointer to a null-terminated string containing the window's title. If this value is NULL, all names will be searched to find the class name.
Example
hWindow=FindWindow (NULL, "File Manager")2. In The Visual Basic Programmer's Guide to the Windows API Bible it says the following -
FindWindow finds the first window in the window list that meets the specified conditions.
lpClassName Long or String-Pointer to null terminated (C language) string containing the name of the class for the window, or zero to accept any class. (emphasis theirs)
lpWindowName Long or String-Pointer to null terminated (C language) string containing the name of the window text (or title), or zero to accept any window title. (emphasis theirs and then mine))
3. Many windows can have the same class, no? For instance, don't Visual Basic forms generally (if not always) have the class ThunderForm or something similar? How do I distinguish between multiple running windows of the same class?
4. This still doesn't help me where I don't (and won't ever) know the specific Windows application that the end user is working with that OI needs to manipulate. Since I don't know the class how do I ever get the hWnd in this kind of scenario?
Use the Spy++ tool that comes with VC++ 1.52c to determine the class of a window.
I have several third party Spy tools that do the job just fine. It's the above situation that has me stumped.
As always, thanks for your input. Any further light shed on the above will be greatly appreciated.
At 02 DEC 1997 07:05PM Alex Eloquent wrote:
Has anyone had any luck getting preferences (like the default association for .BMP files) out of Windows? How about Windows 95?
We export data to web pages and would like to launch the user's default web browser (without having to ask where it is!) but have had no luck so far with GetPrivateProfileString.
At 03 DEC 1997 07:46AM Oystein Reigem wrote:
Alex,
If you want to bring up an app (e.g a browser), I assume you've got a document as well (an html-page) and not just want to bring up the app. Try to RUNWIN the doc instead of the app.
E.g, I have JPGs associated with PhotoShop, and I can bring up PhotoShop with
RetVal=UTILITY( "RUNWIN", "C:\TEST.JPG", 0 )as long as C:\TEST.JPG exists.
- Oystein -
At 04 DEC 1997 09:13AM Don Bakke wrote:
Cameron or Gene,
I was wonder if you had a chance to review my responses in this message concerning FindWindow and had any ideas on using it in an alternative way.
Thanks,