Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't get VFP-Form active in W2K
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00546080
Message ID:
00547286
Vues:
12
Woah!

Because unusual method of searching for application, I would ask you - are you sure aboyt the HWND that you found? Are you sure that it is correct VFP main Screen window?

Also, what VFP version you use? If it is VFP7, it contains 2 or more windows for main screen.

Finally, are you sure there are no ANY process during that that can cause the main VFP window deactivate again?

He-he, I also found a bug:

DO WHILE HWND_W > 0

Is not correct, because W2K can return negative integer number as window handle. I can bet here is a problem why it works in W98 and does not under W2K ;)

HTH.

>Okay, for you as a persistent person (probably nothing better to do ...), here it is. Just run it on the VFP.EXE DE from the command window.
>Please don't look at the variable-names.
>
>Note : This is the normal version which should bring the VFP-window forward and which it already doesn't (W2K only), not to speak about having it active.
>The version which puts all aother tasks to the taskbar, leaves you with the VFP-window brought forward, but again, not active.
>
>Another version with an EnableWindow (one never knows ...) doesn't work too.
>A DoEvents etc. here and there ... nada.
>
>Cheers !
>
>
>
>tim_w = seconds()
>
>do while seconds()-tim_w < 6      && No, don’t use such loops anymore !
>
>  *** Activate another task here (alt-tab etc). ***
>
>enddo
>
>=windtes2('Microsoft Visual FoxPro',.T.)
>
>
>The above calls the below.
>
>
>*** WINDTES2. ***
>
>*** Look for window and activate. ***
>
>PARAMETERS CAPTION_W, EXACT_W
>
>IF (TYPE("CAPTION_W") <> "C") .OR. (TYPE("EXACT_W") <> "L")
>   RETURN .F.
>ENDIF
>
>#DEFINE GW_HWNDNEXT     2
>#DEFINE GW_CHILD        5
>#DEFINE SW_RESTORE      9
>#DEFINE SW_SHOW 	5
>
>DECLARE INTEGER GetWindow IN USER32 INTEGER, INTEGER
>DECLARE INTEGER GetDesktopWindow IN USER32
>DECLARE INTEGER GetWindowText IN USER32 INTEGER, STRING @, INTEGER
>DECLARE INTEGER IsIconic IN USER32 INTEGER
>DECLARE INTEGER SetForegroundWindow IN USER32 INTEGER
>DECLARE INTEGER ShowWindow IN USER32 INTEGER, INTEGER
>
>
>RESULT_W = .F.                         && Succeeded ?
>
>*** Start with the Desktop. ***
>
>HWND_W = GetWindow(GetDesktopWindow(), GW_CHILD)
>
>*** Loop through all Windows. ***
>
>DO WHILE HWND_W > 0
>
>   TITLE_W = REPLICATE(CHR(0), 128)
>   TITLELEN_W = GetWindowText(HWND_W, @TITLE_W, 128)
>   TITLELEN_W = MIN(TITLELEN_W, 128)
>   TITLE_W = SUBSTR(TITLE_W, 1, TITLELEN_W)
>   IF (.NOT. EMPTY(TITLE_W))
>
>      *** Debug. ***
>      ?TITLE_W
>
>      IF EXACT_W .AND. CAPTION_W = TITLE_W
>         RESULT_W = .T.
>         EXIT
>      ENDIF
>
>      IF (.NOT. EXACT_W) .AND. CAPTION_W $ TITLE_W
>         RESULT_W = .T.
>         EXIT
>      ENDIF
>   ENDIF
>
>   *** Next... ***
>
>   HWND_W = GetWindow(HWND_W, GW_HWNDNEXT)
>
>ENDDO
>
>IF RESULT_W                            && Found ?
>
>   *** Activate. ***
>
>   IF IsIconic(HWND_W) > 0
>      =ShowWindow(HWND_W, SW_SHOW)     && Try SW_RESTORE here too.
>      ??chr(7)
>   ENDIF
>
>   =SetForegroundWindow(HWND_W)
>ENDIF
>
>RETURN RESULT_W
>
>
>
>
>
>
>>Hi!
>>
>>Hmm, if I can take a look to that program... Indeed, very strange problem.
>>
>>>Yo !
>>>
>>>All doesn't help;
>>>
>>>We even turned the ShowWindow the other way around : put all other windows to the taskbar. Doesn't help either.
>>>
>>>Let's forward this to Bill (or whoever is in charge there now).
>>>
>>>Thx for helping, but let's give up...
>>>
>>>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform