I think I've solved this problem. At least this procedure is working for me now. I can now erase the temp font file.
*************************************************************
* adds/removes temp fonts
* found basis of code ( I have modified) at:
*
* and
*
* and lots of code/help from agoeddeke on Tek=Tips
* para:
* whichaction = 'add', 'remove'
* processfontname = full font name
*
* NOTE!!!
* the parameter processfontname must also incude the
* file path if the font is NOT
* in the default windows/font folder - this applies
* for add or remove
* IE:
* do AddRemoveFont with "add',"t\baxter.ttf"
* where 't\' is a subdir that has the font file
* under some circumstances you must use
* CLEAR RESOURCES 'fontname' before calling this
* procedure to remove a font
*************************************************************
Procedure AddRemoveFont
Lparameters whichaction,processfontname
failed=.F.
* add the font
Do Case
Case whichaction="add"
Declare AddFontResource In GDi32.Dll String
If AddFontResource(processfontname)
Wait Window Nowait "Font Installed..."
Else
Wait Window "Addition Failed..." Nowait
failed=.T.
Endif
* not sure if this is correct
Clear Dlls "AddFontResource"
* Removing the resource file is done with
* RemoveFontResource which resides
* in the same DLL and has the same parameter
Case whichaction="remove"
Declare RemoveFontResource In GDi32.Dll String
If RemoveFontResource(processfontname)
Wait Window Nowait "Font Removed..."
Else
Wait Window "Removal Failed..." Nowait
failed=.T.
Endif
* not sure if this is correct
Clear Dlls "RemoveFontResource"
Endcase
* message to other win apps of the modified
* font selections
If Not failed
Declare Integer SendMessage In USER32.Dll ;
INTEGER HWnd, ;
INTEGER Msg, ;
INTEGER wParameter, ;
INTEGER Lparameter
#Define HWND_BROADCAST 0xFFFF
#Define WM_FONTCHANGE 0x001D
=SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0)
Endi
Return .T.