Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: fonts boxes
;font button change ;Guido 02/02 ;api functions #DefineFunction GetStockObject(nIndex) DLLName = StrCat(DirWindows(1), "gdi32.dll") rslt = DLLCall(DLLName, long:"GetStockObject", long:nIndex) Return rslt #EndFunction #DefineFunction GetDlgItem(hwndDlg, id) sDLLName = StrCat(DirWindows(1), "USER32.dll") hcontrol = DLLCall(sDLLName, long:"GetDlgItem", long:hwndDlg, long:id) Return hcontrol #EndFunction #DefineFunction CreateFont(H, WI, E, O, WE, I, U, S, C, OP, CP, Q, PF, F) sDLLName = StrCat(DirWindows(1), "gdi32.dll") rslt = DLLCall(sDLLName, long:"CreateFontA", long:H, long:WI, long:E, long:O, long:WE, long:I, long:U, long:S, long:C, long:OP, long:CP, long:Q, long:PF, lpstr:F) Return rslt #EndFunction ;api constants ANSI_FIXED_FONT = 12 SYSTEM_FONT = 14 ;OEM_FIXED_FONT = 11 WM_SETFONT = 48 ;box handle hwnd = dllhwnd("") ;get matisse font handle hmat = CreateFont(20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Matisse ITC") ;get system font handles hansi = GetStockObject(ANSI_FIXED_FONT) hsystem = GetStockObject(SYSTEM_FONT) ;hoem = GetStockObject(OEM_FIXED_FONT) ;; sample code for BoxButtonDraw bDraw1=1 ;real id 100 bDraw2=2 ; 101 bDraw3=3 ; 102 BoxDrawText(1, "0,210,1000,1000", "WinBatch Box Example - Font Change", @FALSE, 1) BoxButtonDraw(1, bDraw1, "Matisse", "100,450,300,550") BoxButtonDraw(1, bDraw2, "System", "400,450,600,550") BoxButtonDraw(1, bDraw3, "Ansi", "700,450,900,550") ;get buttons handle based on buttons real ids hb1 = GetDlgItem(hwnd, 100) hb2 = GetDlgItem(hwnd, 101) hb3 = GetDlgItem(hwnd, 102) ;set font IntControl(22, hb1, WM_SETFONT, hmat, "") ;matisse IntControl(22, hb2, WM_SETFONT, hsystem, "");system IntControl(22, hb3, WM_SETFONT, hansi, "") ;ansi BoxesUp("100,100,900,900", @normal) bWho=0 while bWho == 0 for x =1 to 3 if BoxButtonStat(1,x) then bWho=x next endwhile Message("Excuse Me", "Please, don't push my buttons") BoxDestroy(1) ;end script
Article ID: W15115
File Created: 2002:09:05:13:49:44
Last Updated: 2002:09:05:13:49:44