Win Api to MacOs Api

Mac OSX specific forum
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Win Api to MacOs Api

Post 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
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Win Api to MacOs Api

Post 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)
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Post by JoRo »

A bit short that snippet, to proof it.
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Post by JoRo »

But your are right, I IsWindow is working fine!
so first Api function replaced!
JoRo
User
User
Posts: 70
Joined: Sat May 10, 2003 2:03 pm
Location: Essen, Germany
Contact:

Post by JoRo »

with PB 4 except the get keystate functions, all other api calls were no longer necessary.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Win Api to MacOs Api

Post 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.
Post Reply