Clipper Code:
- Code: Select all Expand view
MsgInfo( "In Clipper Prog" )
::oRect := CRect():New( GetWorkRect(), 'Options',,, .t. ) // SPI_GETWORKAREA
GetWorkRect() is the function that I have created in C:
- Code: Select all Expand view
#include <extend.api>
#include <ClipApi.h>
// #include <WinSock.h>
#include <fwmsgs.h>
typedef struct _RECT {
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;
BOOL
SystemParametersInfoA(
UINT uiAction,
UINT uiParam,
PVOID pvParam,
UINT fWinIni);
/*
* GetWorkRect()
*
* Wrapper to SystemParametersInfo(SPI_GETWORKAREA,...
* Retrieves the size of the work area on the primary display monitor.
* The work area is the portion of the screen not obscured by the system taskbar
* or by application desktop toolbars. The pvParam parameter must point to a RECT
* structure that receives the coordinates of the work area, expressed in virtual
* screen coordinates.
*/
CLIPPER GETWORKREC() // --> { nTop, nLeft, nBottom, nRight }
{
RECT rct;
rct.top = 0;
rct.left = 0;
rct.bottom = 0;
rct.right = 0;
#define SPI_GETWORKAREA 48
SystemParametersInfoA(SPI_GETWORKAREA,0,&rct,0);
hb_reta( 4 );
_storni( rct.top, (WORD)-1, 1 );
_storni( rct.left, (WORD)-1, 2 );
_storni( rct.bottom, (WORD)-1, 3 );
_storni( rct.right, (WORD)-1, 4 );
}
When I link using vc98 results are:
- Code: Select all Expand view
c:\dev\pcr5>link @KEYLESS\build\pcrHBH.lnk /nologo /subsystem:windows /force:multiple /NODEFAULTLIB:libcmt /LIBPATH:C:\HarbourM\lib /OUT:C:\DEV\PCR5\KEYLESS\EXE\HB\PCREGW.EXE
hbrtl.lib(tgetint.obj) : warning LNK4006: _HB_FUN_GETNEW already defined in FiveHM.lib(TCLIPGET.obj); second definition ignored
hbw32.lib(win_dll.obj) : warning LNK4006: _HB_FUN_CALLDLL already defined in FiveHCM.lib(CALLDLL.obj); second definition ignored
CPCREG.OBJ : error LNK2001: unresolved external symbol _HB_FUN_GETWORKRECT
COPYDATA1.obj : error LNK2001: unresolved external symbol "int __cdecl SystemParametersInfoA(unsigned int,unsigned int,void *,unsigned int)" (?SystemParametersInfoA@@YAHIIPAXI@Z)
C:\DEV\PCR5\KEYLESS\EXE\HB\PCREGW.EXE : fatal error LNK1120: 2 unresolved externals
Question 1:
How do I resolve the unresolved external? I do include the GetWorkRect OBJ file in the link.
Question 2:
How do I resolve the problem with SystemParametersInfoA?
Just to be sure, I did remove the reference to SystemParametersInfoA and complied the OBJ again. When I link with that OBJ, I only have the first unresolved external _HB_FUN_GETWORKRECT.
Question 3:
I'd like to get rid of the warnings, but for now, I'm still able to run the resulting EXE if I delete the code that creates the unresolved Externals up to the point where I call the MsgInfo() function.
Thanks,
Paul