Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where can I find documentation on ShowWindow and FindWin
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00061740
Message ID:
00062296
Vues:
52
>>>>>>>Gary,
>>>>>>>
>>>>>>>I don't know where you got this code sample, but it doesn't look right. The VFP API function names start with an underscore, e.g. there's a _FindWindow API function. There's a SHOW WINDOW command (space between words), and there's a ShowWindow property for forms and toolbars. To get help on a specific property or method, you can right click on the Property sheet if you're using the Class Designer or Form Designer. If you spell them right, all these things are easily findable in the VFP online help.
>>>>>>>
>>>>>>>Mike
>>>>>>>
>>>>>>>>I can't seem to find help or documentation on:
>>>>>>>>
>>>>>>>> =BringWindowToTop(FindWindow( 0, 'WindowName'))
>>>>>>>> =ShowWindow(FindWindow( 0, 'WindowName'),3)
>>>>>>>>
>>>>>>>>Gary
>>>>>>
>>>>>>Michael
>>>>>>
>>>>>> Those functions do work and I am not using a custom library. I
>>>>>>got them from someone on this forum.
>>>>>>
>>>>>>Gary
>>>>>
>>>>>If you have VFP 3, you can get details about these functions in the Win32API.HLP file in the VFP directory.
>>>>>
>>>>>If you have VFP 5...?
>>>>>
>>>>>:0)
>>>>
>>>>Gerald
>>>>
>>>> I do still have VFP 3 gathering mold. So I will look it up.
>>>>The code worked great by the way!!! The only problem was that
>>>>the other RUN application wasn't maximized when it came up. I
>>>>guessed at the parameter for that and it worked. Thanks a lot!
>>>>
>>>>Gary
>>>
>>>First, here the declarations for the two functions in question.
>>>
>>>DECLARE INTEGER FindWindow IN Win32API;
>>> STRING @lpClassName, STRING @lpWindowName
>>>
>>>DECLARE SHORT ShowWindow IN Win32API;
>>> INTEGER hwnd, nCmdShow
>>>
>>>The value FindWindow returns is the window hand It takes either or both of the parameters, the class name or the title text can be passed. The class name can be rather difficult to determine (to get that you'd have to have the window handle). The title text is easier, but it must match exactly. Since this, in many cases is dynamic, and you may not know at any given moment exactly the content, you might be interested in my functions (Is_Run) in the Files/Win32 & Other APIs section. This will allow you to pass the known portion of the title and get the window handle.
>>>
>>>However, if you know the exact title you would call the function in this manner:
>>>
>>>lnHWnd = FindWindow(0, @lctitletext)
>>>
>>>ShowWindow can be used to programmatically control how an exterior window is displayed. It takes the window handle, and one of the following values:
>>>
>>>#define SW_HIDE 0
>>>#define SW_SHOWNORMAL 1
>>>#define SW_NORMAL 1
>>>#define SW_SHOWMINIMIZED 2
>>>#define SW_SHOWMAXIMIZED 3
>>>#define SW_MAXIMIZE 3
>>>#define SW_SHOWNOACTIVATE 4
>>>#define SW_SHOW 5
>>>#define SW_MINIMIZE 6
>>>#define SW_SHOWMINNOACTIVE 7
>>>#define SW_SHOWNA 8
>>>#define SW_RESTORE 9
>>>#define SW_SHOWDEFAULT 10
>>>#define SW_MAX 10
>>>
>>>BTW, it's not generally a good idea to embed Windows function calls.
>>>
>>>hth,
>>>
>>>George
>>
>>George
>>
>> Why is it not a good idea to embed windows function calls? Also
>>thanks for the declarations.
>>
>>Gary
>
>Gary,
>
>If a function fails, for example, FindWindow() returns 0, passing an invalid window handle to ShowWindow, could have unexpected results. Perhaps even causing a GPF. I'm not saying that it would necessarily, but given all the complexities of Windows, why take a chance? Further, you might need the value returned from the function for later operations. This is especially true with the window handle. Lastly, if there is a problem with the function call, determining it's nature becomes impossible if it's embedded.
>
>hth,
>
>George

Thanks for the info, that makes sense.

Gary
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform