Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: text alignment boxdrawtext
Here is my sample code:
box_count=3 name_list=StrCat("Username",@TAB,"Password",@TAB,"Flags") for i = 1 to box_count BoxColor(1,"128,128,128",0) box_coord=StrCat('"',x+75,",",y-25,",",x+185,",",y+135,'"') BoxDrawRect(1,%box_coord%, 2) item=ItemExtract(i,name_list,@TAB) BoxDrawText(1,%box_coord%,item,@TRUE, 0|1) sDLLName = StrCat(DirWindows(1), "User32.DLL") sEntry = StrCat("long:", '"CreateWindowExA"') sArgs = "long:dwExStyle" sArgs = StrCat(sArgs, ", lpstr:lpClassName") sArgs = StrCat(sArgs, ", long:lpWindowName") sArgs = StrCat(sArgs, ", long:dwStyle") sArgs = StrCat(sArgs, ", long:x") sArgs = StrCat(sArgs, ", long:y") sArgs = StrCat(sArgs, ", long:nWidth") sArgs = StrCat(sArgs, ", long:nHeight") sArgs = StrCat(sArgs, ", long:hWndParent") sArgs = StrCat(sArgs, ", long:hMenu") sArgs = StrCat(sArgs, ", long:hInstance") sArgs = StrCat(sArgs, ", long:lParam") hWndEdit%i% = DLLCall(sDLLName, %sEntry%, %sArgs%) y=y+50 next
When I try to run it it fails immediately. Then I tried some fixes, but no go.
Anyway in looking at it my guess is that you are fighting between the 1000x1000 virtual co-ordinates that WinBatch uses and the real screen co-ordinates that CreateWindowA uses.
Basicaly you have to scale one to the other depending on screen resolution. Use WinMetrics 0 and 1 to get screen resolution.
Map one to the other.
virtualx=realx*1000/WinMetrics(0) virtualy=realy*1000/WinMetrics(1)
realx=virtualx*WinMetrics(0)/1000 realy=virtualy*WinMetrics(0)/1000Also watch out for how the points are defined. In WinBatch the co-ordinates are usually:
upper-left-x upper-left-y lower-right-x lowerright=yHowever in Create Window it is more like:
upper-left-x upperleft-y x-width y-heightSo besides converting real to virtual, you also have to worry about the meaning of each co-ordinate.
Article ID: W15113
File Created: 2002:09:05:13:49:44
Last Updated: 2002:09:05:13:49:44