Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Removing the Toolbar line
Message
De
06/06/2003 09:03:01
Dorin Vasilescu
ALL Trans Romania
Arad, Roumanie
 
 
À
03/06/2003 14:53:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00795843
Message ID:
00797179
Vues:
13
This message has been marked as the solution to the initial question of the thread.
I've done a procedure for this, using Windows API. It was interesting.
You can test it as follow:
oT = newobject('{sometoolbar}','{toolbarclasslib}')
oT.Dock(0)
ClearToolbarMover(oT, _VFP.hWnd)
The code:
PROCEDURE ClearToolbarMover
LPARAMETERS toToolbarRef, tnParenthWnd
*toToolbarRef		toolbar reference
*tnParenthWnd		screen or top level form hwnd property value
IF toToolbarRef.DockPosition = -1		
	RETURN
ENDIF
LOCAL i,j
DeclareAPI()
lnToolbarHwnd = GetToolbarHwnd(toToolbarRef, tnParenthWnd)	&&get toolbar hWnd
thDC = GetWindowDC(lnToolbarHwnd)				&&get toolbar DC
DO case
CASE INLIST(toToolbarRef.DockPosition,0,3)
	FOR i=2 TO 6
		FOR j=2 TO toToolbarRef.height - 4
			setpixel(thDC,i,j,toToolbarRef.backcolor)
		NEXT
	NEXT
CASE INLIST(toToolbarRef.DockPosition,1,2)
	FOR i=2 TO toToolbarRef.width - 4
		FOR j=2 TO 6
			setpixel(thDC,i,j,toToolbarRef.backcolor)
		NEXT
	NEXT
ENDCASE
ReleaseDC(thDC,lnToolbarHwnd)
CLEAR DLLS "GetWindow","GetWindowText","GetWindowDC","SetPixel","ReleaseDC"
RETURN


PROCEDURE GetToolbarHwnd
PARAMETERS toToolbarRef, tnParenthWnd
lcToolbarCaption = toToolbarRef.Caption
IF VARTYPE(tnParenthWnd) = 'L'
	lnVFPHnd = _VFP.hWnd 
ELSE
	lnVFPHnd = tnParenthWnd 
ENDIF
lnToolbarWhnd = 0
GetWindows(lnVFPHnd, 0,0)
RETURN lnToolbarWhnd


PROCEDURE GetWindows
LPARAMETERS lnHandle,lnParent,lnLevel
#DEFINE GW_HWNDNEXT   2 
#DEFINE GW_CHILD      5 
LOCAL WinCaption, hWindow, hParent, lvl
LOCAL hChild, oChild, hNext, oNext 
WinCaption = ''
hWindow = 0
hParent = 0
lvl = 0
IF lnHandle = 0 
	RETURN .F. 
ENDIF 
lvl = lnLevel 
hWindow = lnHandle 
hParent = lnParent 
WinCaption = GetWinText(lnHandle)
IF TRIM(WinCaption) = TRIM(lcToolbarCaption)
   	lnToolbarWhnd = hWindow
endif
hChild = GetWindow(hWindow, GW_CHILD) 
oChild = GetWindows( hChild, hWindow, lvl+1)
IF lnParent <> 0 
    hNext = GetWindow(hWindow, GW_HWNDNEXT) 
    oNext = GetWindows(hNext, hParent, lvl) 
ENDIF 


FUNCTION  GetWinText(hWindow) 
    LOCAL lcBuffer, lnResult 
    lcBuffer = Space(250) 
    lnResult = GetWindowText(hWindow, @lcBuffer, Len(lcBuffer)) 
RETURN Left(lcBuffer, lnResult) 



FUNCTION DeclareAPI
DECLARE INTEGER GetWindow IN user32 INTEGER hwnd, INTEGER wFlag 
DECLARE INTEGER GetWindowText IN user32; 
	INTEGER hwnd, STRING @lpString, INTEGER cch 
DECLARE INTEGER SetPixel IN gdi32 integer hDc, INTEGER x, INTEGER y, INTEGER nColor
DECLARE INTEGER GetWindowDC IN user32 INTEGER hwnd 
DECLARE INTEGER ReleaseDC IN user32 INTEGER hwnd, INTEGER hdc 
>Hi Everyone,
>
>Anybody knows how to use the Windows API in order to remove the VFP toolbar line when it is being docked?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform