Apparently, the borders of some forms don’t get painted correctly on Windows Vista.
When executing a Fox Form, Fox asks Windows to create a window, then sets the BorderStyle of the window. Apparently, under Vista Aero (except as Administrator), the BorderStyle cannot be set after the Window has been created.
To reproduce the problem, start Visual FoxPro (I tried back to VFP7 (released summer 2001))
Amazingly enough, run under Admin mode, and you’ll see the problem disappear. Perhaps a non-admin app changing the BorderStyle might be a security risk: An app might be able to grab a window handle from another process and impersonate a Credentials screen or something.
When Fox runs a form, it reads the Properties and sets them in the order encountered. For a Form, the “DoCreate” pseudo property means to create the window. The BorderStyle happens to be written after the DoCreate, so the BorderStyle setting is ignored
The properties look like this before the fix:
Top = 0
Left = 0
Height = 250
Width = 375
DoCreate = .T.
BorderStyle = 1
Caption = "Form1"
Name = "Form1"
.
So your choices are:
See also
Program starts below (and works in VFP7 too)
CLEAR ALL
CLEAR
FixDir(CURDIR()) && Call recursive program with current directory
*Recursive program to fix all forms found in cPath and subdirectories
* Fix Vista Aero Border painting by changinge DoCreate and BorderStyle order
PROCEDURE FixDir(cPath) && Fix all forms in directory cPath and subdirectories
LOCAL n,aFiles[1],cPath,i,j,cTemp,nBorderStyle,nDoCreate,aProps[1],nLines,nIndex
n=ADIR(aFiles,cPath+"*.scx") && look in current dir for all form files (.SCX)
FOR i = 1 TO n
?cPath+aFiles[i,1]
USE (cPath+aFiles[i,1]) ALIAS SCX && open the form as a table
SCAN FOR !EMPTY(Properties) AND ATC("DoCreate",Properties)>0 && locate the Properties
?Properties
nLines = ALINES(aProps,Properties) && Create an array of all the lines in the Properties
nDoCreate=0
nBorderStyle=0
FOR j = 1 TO nLines && Loop through and record the array indices of DoCreate and BorderStyle
?j,aProps[j]
DO CASE
CASE ATC("DoCreate",aProps[j])>0
nDoCreate=j
CASE ATC("BorderStyle",aProps[j])>0
nBorderStyle=j
ENDCASE
ENDFOR
IF nDoCreate > 0 AND nDoCreate < nBorderStyle && If DoCreate precedes BorderStyle, insert BorderStyle before
cTemp=""
FOR nIndex = 1 TO nLines && now emit the properties in the desired order
CASE nIndex = nDoCreate
cTemp=cTemp+aProps[nBorderStyle]+CHR(13)+CHR(10)
cTemp=cTemp+aProps[nDoCreate]+CHR(13)+CHR(10)
CASE nIndex = nBorderStyle
* do nothing: already added
OTHERWISE
cTemp=cTemp+aProps[nIndex]+CHR(13)+CHR(10)
REPLACE Properties WITH cTemp && and update
?properties
ENDIF
ENDSCAN
USE IN SCX && close the file
n=ADIR(aFiles,cPath+"*.*","D") && Get any subdirs
IF ATC("D",aFiles[i,5])>0 AND aFiles[i,1] != "."
FixDir(cPath+aFiles[i,1]+"\") && recur
RETURN
</end of program>