Enhancing your Xbase++ applications
Home Contact Info
 
©2006. Pablo Botella

The main purpose of ot4xb.dll is not only to manage structures an memory pointers on your Xbase++ PRGs but also extend the Xbase++ features at C/C++ and PRG levels. Include all the source code.

At PRG level you only need to include the ot4xb.ch header and include the import library ot4xb.lib in your project or link file.

At C/C++ level you will need to link also the import library ot4xbCpp.lib and include the ot4xb_api.h header in your C or C++ source files.

#include "ot4xb.ch"
#include "dll.ch"
// ---------------------------------------------------------------------------
function Main()
local oRect := GetDesktopRect()
? "Desktop Rect:"
? "              Left  : " ; ?? oRect:left
? "              Top   : " ; ?? oRect:top
? "              Right : " ; ?? oRect:right
? "              Bottom: " ; ?? oRect:bottom
inkey(0)
return NIL
// ---------------------------------------------------------------------------
BEGIN STRUCTURE Rect
   MEMBER LONG left
   MEMBER LONG top
   MEMBER LONG right
   MEMBER LONG bottom
END STRUCTURE
// ---------------------------------------------------------------------------
DLLFUNCTION GetWindowRect( hWnd , pRect ) ;
USING STDCALL FROM User32.DLL
// ---------------------------------------------------------------------------
DLLFUNCTION GetClientRect( hWnd , pRect ) USING STDCALL FROM User32.DLL
// ---------------------------------------------------------------------------
DLLFUNCTION GetDesktopWindow() USING STDCALL FROM User32.DLL
// ---------------------------------------------------------------------------
function GetDesktopRect()
local oRect := Rect():New() // Create the instance
local aSize
oRect:_alloc_() // Alloc _XGrab() memory for the struct 
GetClientRect( GetDesktopWindow() , oRect:_addressof_() )
oRect:_free_()  // Release the memory pointer 
 // but copy the content to an Xbase buffer
 // so still can access the members        
return oRect
// ---------------------------------------------------------------------------