macoslib and win32

Hello,
macoslib has got a smoothResize function that works all right in Cocoa, but after building a win32 app on the Mac, when I launch a win32 compiled app (on a PC running Windows 8) I get two messages saying that the “WindowsLib” library could not be loaded.
Any idea how to solve the problem? Thanks,
Carlo

Here is the win32 part of the method:

Sub SmoothResize(extends w as Window, Width as Integer, Height as Integer, Align as Integer = 4)
dim err, t, l as integer
dim rect as MemoryBlock

 Declare Function TransitionWindow Lib "WindowsLib" (window as WindowPtr, effect as Integer, action as Integer, rect as Ptr) as Integer
 Declare Function GetWindowBounds  Lib "WindowsLib" (window As WindowPtr, regionCode As Integer, globalBounds As Ptr) as Integer

// we get the old window region
rect = New MemoryBlock(8)
err = GetWindowBounds(w, 32, rect)

t = w.Top // Need to know where the top and left of the window go
l = w.Left
Select Case align // Use deltas in measurements, not absolutes
Case 0 // Lock upper left
rect.Short(4) = rect.Short(4) + (height - w.height)
rect.Short(6) = rect.Short(6) + (width - w.width)
Case 1 // Lock upper right
rect.Short(2) = rect.Short(2) - (width - w.width)
rect.Short(4) = rect.Short(4) + (height - w.height)
l = l - (width - w.width) // Left side moves
Case 2 // Lock lower left
rect.Short(0) = rect.Short(0) - (height - w.height)
rect.Short(6) = rect.Short(6) + (width - w.width)
t = t - (height - w.height) // Top side moves
Case 3 // Lock lower right
rect.Short(0) = rect.Short(0) - (height - w.height)
rect.Short(2) = rect.Short(2) - (width - w.width)
t = t - (height - w.height) // Top side moves
l = l - (width - w.width) // Left side moves
Case 4 // Lock top center
rect.Short(2) = rect.Short(2) - (width - w.width) / 2
rect.Short(4) = rect.Short(4) + (height - w.height)
rect.Short(6) = rect.Short(6) + (width - w.width) / 2
l = l - (width - w.width)/2 // Both sides move
Case 5 // Lock left center
rect.Short(0) = rect.Short(0) - (height - w.height) / 2
rect.Short(4) = rect.Short(4) + (height - w.height) / 2
rect.Short(6) = rect.Short(6) + (width - w.width)
t = t - (height - w.height) / 2 // Top moves
Case 6 // Lock bottom center
rect.Short(0) = rect.Short(0) - (height - w.height)
rect.Short(2) = rect.Short(2) - (width - w.width) / 2
rect.Short(6) = rect.Short(6) + (width - w.width) / 2
t = t - (height - w.height) // Top moves
l = l - (width - w.width) / 2 // Left moves
Case 7 // Lock right center
rect.Short(0) = rect.Short(0) - (height - w.height) / 2
rect.Short(2) = rect.Short(2) - (width - w.width)
rect.Short(4) = rect.Short(4) + (height - w.height) / 2
t = t - (height - w.height) / 2// Top moves
l = l - (width - w.width) // Left moves
case 8 // Lock center center
rect.Short(0) = rect.Short(0) - (height - w.height) / 2
rect.Short(2) = rect.Short(2) - (width - w.width) / 2
rect.Short(4) = rect.Short(4) + (height - w.height) / 2
rect.Short(6) = rect.Short(6) + (width - w.width) / 2
t = t - (height - w.height) / 2// Top moves
l = l - (width - w.width) / 2// Left moves

End Select // If none of these, don’t change

// transition
err = TransitionWindow(w, 3, 4, rect)

// have to manually set the window’s new height after resizing the window
w.Top = t
w.Left = l
w.Width = width
w.Height = height

w.refresh

End Sub

[quote=196727:@Carlo Rubini]macoslib has got a smoothResize function that works all right in Cocoa, but after building a win32 app on the Mac, when I launch a win32 compiled app (on a PC running Windows 8) I get two messages saying that the “WindowsLib” library could not be loaded.
Any idea how to solve the problem? Thanks,[/quote]

Your code for Win32 looks like a strange creole of MacOSLib. There is no such thing as “WindowsLib” or TransitionWindow in the whole Microsoft Developer Network documentation. You cannot use MacOSLib for Windows executables.

You need to use declares specifically built for Windows, such as what you find in the Windows Functionality Suite which you can download at https://github.com/arbp/WFS . It is the same kind of library as MacOSLib, but for Windows. There is no guarantee you will find exactly the same functions as in MacOSLib, and you will have to learn how to use it.

Most code in macoslib is Mac-related, yet there are functions addressing Windows and Linus.
From what you say, it may be that the “creole” thing is some legacy-code from old.
As for WFS, I already use it; unfortunatelly it hasnt have this kind of function.

[quote=196735:@Carlo Rubini]Most code in macoslib is Mac-related, yet there are functions addressing Windows and Linus.
From what you say, it may be that the “creole” thing is some legacy-code from old.
As for WFS, I already use it; unfortunatelly it hasnt have this kind of function.[/quote]

A first glimpse, and not precluding the (remote) possibility that a Win32 system call be constructed exactly the same way as a Mac OS Carbon one, and pending the authorized opinion of a Windows declare guru, I find it extremely peculiar that the declare for Windows is word for word identical to the Carbon one, including the system function call.

One thing is absolutely certain, there is no such thing as a “WindowsLib” in Windows. So the error you are getting is quite normal.

As for smooth resize, from what I see running MacOSLib on my Mac, it seems possible to emulate it with a timer on Windows. It may even be nicer with my RubberViews.com than with the simple locking of buttons used in MacOSLib.

[code] #elseif TargetCarbon or TargetWin32 then

dim err, t, l as integer
dim rect as MemoryBlock

#if TargetCarbon then
  Declare Function TransitionWindow Lib CarbonLib (window as WindowPtr, effect as Integer, action as Integer, rect as Ptr) as Integer
  Declare Function GetWindowBounds  Lib CarbonLib (window As WindowPtr, regionCode As Integer, globalBounds As Ptr) as Integer
#else
  Declare Function TransitionWindow Lib "WindowsLib" (window as WindowPtr, effect as Integer, action as Integer, rect as Ptr) as Integer
  Declare Function GetWindowBounds  Lib "WindowsLib" (window As WindowPtr, regionCode As Integer, globalBounds As Ptr) as Integer
#endif[/code]