Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File download dialog
Message
De
26/08/2007 18:39:27
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Divers
Thread ID:
01250080
Message ID:
01250538
Vues:
25
>Below is ClickDlgButton method from my class. It should get you started.
>
>#define GW_HWNDFIRST        0
>#define GW_HWNDLAST         1
>#define GW_HWNDNEXT         2
>#define GW_HWNDPREV         3
>#define GW_OWNER            4
>#define GW_CHILD            5
>
>#define GWL_EXSTYLE 		-20
>#define GWL_STYLE 			-16
>
>#define WS_EX_APPWINDOW  	0x00040000
>
>#define WS_VISIBLE 			0x10000000
>#define WS_POPUP   			0x80000000
>
>#define WM_SETTEXT          0x000C
>#define WM_GETTEXT          0x000D
>
>#define BM_CLICK            0x00F5
>
>	PROCEDURE ClickDlgButton(tvWind, tcButton)
>	LOCAL lhWndDialog, lhWnd, lcText, lnLen, lcBuff, llClicked
>
>	IF VARTYPE(tvWind) = "N"
>		lhWndDialog = tvWind
>	ELSE
>		lhWndDialog = FindWindow(0, tvWind)
>	ENDIF
>
>	IF lhWndDialog = 0
>		RETURN .F.
>	ENDIF
>
>	* Loop through controls until find the button
>
>	lhWnd = GetWindow(lhWndDialog, GW_CHILD)
>
>	llClicked = .F.
>
>	DO WHILE lhWnd > 0
>		lcBuff = SPACE(512)
>		lnLen = SendMessage(lhWnd, WM_GETTEXT, 512, @lcBuff)
>		lcText = LEFT(lcBuff, lnLen)
>		IF UPPER(CHRTRAN(lcText, "&", "")) == UPPER(tcButton)
>			= SetForegroundWindow(lhWndDialog)
>			= SendMessage(lhWnd, BM_CLICK, 0, 0)
>			llClicked = .T.
>			EXIT
>		ENDIF
>
>		lhWnd = GetWindow(lhWnd, GW_HWNDNEXT )
>	ENDDO
>
>	RETURN llClicked
>
>
>>I was trying to use FindWindowEx to get a handle to a button and then SendMessage to click on it but could not get it working. If that is corect approach could you help with that?
>>
>>Thanks

Thanks a lot for help, looks like it's working.
What you say it's not reliable, what do you mean?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform