Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Removing a Windows Titlebar using the WinApi
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Removing a Windows Titlebar using the WinApi
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2012 R2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01638078
Message ID:
01638078
Views:
94
I wanted to create a standalone VFP SDI application without the standard Windows titlebar so I could theme the entire form. I created my own titlebar control based on ideas from the "ThemedTitleBar" download available on this site. The only problem I had was that once you make a VFP form the top level form VFP adds the titlebar even if you have the property set to zero. The following code shows how you can remove the titlebar using the WinAPI which I thought might be useful for someone else. I have included a screen shot of the themed form to show how it looks once the VFP form has been themed.
* dCUpgrade - Application Upgrade Manager
Declare long GetWindowLong in "user32.dll" long hwnd, long index
Declare long SetWindowLong in "user32.dll" long hWnd, long Index,long dwNewLong
Declare long SetWindowPos In "user32.dll" long hWnd, long hWndInsertAfter, long x, long y, long w, long h, long option
WS_CAPTION=12582912
WS_OVERLAPPED=0
SWP_FRAMECHANGED=32

Local loFrm
Set Procedure to prg\dCFunc.Fxp
Set Path to dbf\,prj\
_Screen.Visible=.N.

loFrm=NewObject("dCUpgrade","dCUPGrade.vcx")

lnStyle=GetWindowLong(loFrm.hWnd,-16)
lnStyle=Bitand(lnStyle,Bitnot(Bitor(0,WS_CAPTION)))
SetWindowLong(loFrm.hWnd,-16,lnStyle) 
SetWindowPos(loFrm.hWnd,0,1,1,1296,976,SWP_FRAMECHANGED)

loFrm.Show

Read Events

loFrm=""
Close Database
If Version(2)=0
   Quit
EndIf   
Simon White
dCipher Computing
Next
Reply
Map
View

Click here to load this message in the networking platform