Page 1 of 1

Win Api to MacOs Api

Posted: Tue Jun 20, 2006 11:50 am
by JoRo
If have only some Api calls to replace:
GetSystemTime_(st)
GetWindowRect_(Fenster3,pos)
SetWindowPos_(WindowID(),#HWND_TOPMOST,WindowX(),WindowY(),WindowWidth(),WindowHeight(),0)
ShowWindow_(Fenster1,#SW_MAXIMIZE)
GetfileTime_(ReadFile(1,GetPath(#GetPath_Windows)+"bootstat.dat"),0,0,stf)
FileTimeToSystemTime_(@stf,stfa)
getkeystate_(#VK_RBUTTON)
getasynckeystate_(#VK_RBUTTON)
FindWindow_(0,Sprache_v1(218))
GetFullPathName_("GeoControl.exe",255,Buffer,path.s)
InvalidateRect_(Fenster1,0,1)
UpdateWindow_(Fenster1)
For hints where to find and how to do, I really would be thankful.
Remarks:
The PB function "IsWindow" delivers #true, if the window was opened once, but does not check, whether is was closed in between.
The mousebuttons are needed, because I have a lot of drawing in Windowoutput (image sizes usually form 1024*1024 to 4096*4096)


Johannes

Re: Win Api to MacOs Api

Posted: Tue Jun 20, 2006 1:35 pm
by Trond
JoRo wrote: The PB function "IsWindow" delivers #true, if the window was opened once, but does not check, whether is was closed in between.
That's not correct. Just check this:

Code: Select all

OpenWindow(0, 0, 0, 400, 300, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
Debug IsWindow(0)
CloseWindow(0)
Debug IsWindow(0)

Posted: Tue Jun 20, 2006 5:05 pm
by JoRo
A bit short that snippet, to proof it.

Posted: Fri Jun 23, 2006 11:01 am
by JoRo
But your are right, I IsWindow is working fine!
so first Api function replaced!

Posted: Mon Jun 26, 2006 10:39 am
by JoRo
with PB 4 except the get keystate functions, all other api calls were no longer necessary.

Re: Win Api to MacOs Api

Posted: Mon Jun 26, 2006 12:42 pm
by Trond
GetSystemTime_(st): Can be replaced by the functions in the date library.

GetWindowRect_(Fenster3, pos): Cannot be directly replaced because it accounts for window decoration. But chances are that you don't need to know about window decoration, so this can be replaced by WindowX(), WindowY(), WindowWidth() and WindowHeight().

SetWindowPos_(WindowID(),#HWND_TOPMOST,WindowX(),WindowY(),WindowWidth(),WindowHeight(),0): Better replace with StickyWindow(). As you do it know, you make the window smaller because PB's window functions does not calculate with window borders and decoration while SetWindowPos_() does.

ShowWindow_(Fenster1, #SW_MAXIMIZE): Replace with PB call SetWindowState().

GetfileTime_(): Replace with GetFileDate()

ReadFile(1,GetPath(#GetPath_Windows)+"bootstat.dat"),0,0,stf): Chances are that bootstat.dat is a windows only file if it is in the windows directory.

getkeystate_(#VK_RBUTTON)
getasynckeystate_(#VK_RBUTTON)
FindWindow_(0,Sprache_v1(218))
GetFullPathName_("GeoControl.exe",255,Buffer,path.s)
InvalidateRect_(Fenster1,0,1)
UpdateWindow_(Fenster1)
Don't know.