Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Rahul Moudgill
  Where is Rahul Moudgill?
 Toronto
 Canada
 Rahul Moudgill
 To: Love Foxpro
  Where is Love Foxpro?
 
 Vietnam
 Love Foxpro
 Tags
Subject: RE: How to convert this code for Windows 7
Thread ID: 373613 Message ID: 373619 # Views: 80 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Win32API programming
Date: Sunday, March 24, 2013 8:46:06 AM         
   


> llSucess = InstallSystemFont("C:\WINDOWS\fonts\fontname.TTF")
>
> PROCEDURE InstallSystemFont()
> LPARAMETERS lcFontLocFile
> LOCAL lnNumFontsAdded
>
> DECLARE INTEGER AddFontResource IN GDI32.DLL ;
> STRING @ lpszFileName
> DECLARE INTEGER SendMessage IN USER32.DLL ;
> INTEGER hWnd, ;
> INTEGER Msg, ;
> INTEGER wParameter, ;
> INTEGER lParameter
> #DEFINE HWND_BROADCAST 0xFFFF
> #DEFINE WM_FONTCHANGE 0x001D
>
> lnNumFontsAdded=AddFontResource(lcFontLocFile)
> IF lnNumFontsAdded > 0
> *\\Font added sucessfully, send notification to Windows so apps get updated
> =SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0)
> RETURN .T.
> ELSE
> *\\Unable to add font
> RETURN .F.
> ENDIF
> ENDPROC
>
> This code can run on WinXP but can not run on Windows 7


Make sure you are running your application with Admin Reights

otherwise this code will work on win7 as well

Build your app with Admin Rights
http://www.sweetpotatosoftware.com/spsblog/2009/08/03/ApplyApplicationManifestAtCompileTimeWithProjecthook.aspx

Rahul

ENTIRE THREAD

How to convert this code for Windows 7 Posted by Love Foxpro @ 3/24/2013 5:49:35 AM
RE: How to convert this code for Windows 7 Posted by Rahul Moudgill @ 3/24/2013 8:46:06 AM