CallDll32 funny
Posted: Wed Oct 18, 2006 5:16 am
Hi Antonio
I have a Fwh and xHb aplication using latest Sept/Oct2006 Fw28/xHb
This app call the tMutex.prg class Create method below. The tMutex create method calls CallDLL32(.....). In my application when CallDLL32 is called, i get a pop up msgalert "CallDll32", with a title of "calldll.c". I have tracked this down to \fwh\source\winapi\calldll.c which contains
#ifdef __BORLANDC__
..........
#else
CLIPPER CALLDLL32( PARAMS )
{
#ifndef UNICODE
MessageBox( 0, "CallDll32", "CallDll.c", 0 );
#else
MessageBox( 0, L"CallDll32", L"CallDll.c", 0 );
#endif
}
It seems the above CLIPPER CALLDLL32 is being called in error?
In addition, if I ignore the above msgalert, in the line of code below (::hMutex := CallDLL32(...) is set to an array (in stead of a numeric handle), the 2nd element of which is the correct hMutex handle
If I move tMutex.prg to earlier in my xbp link script, the problem is resolved, but that is an unsatisfactory solution
Can you think what might be causing this?
Thanks
Peter
*********************
Method Create( sMutexAttr, lInitialOwner, cName ) Class TMutex
Local hDLL := LoadLib32( iKERNEL )
Local cFarProc, cFunc := "CreateMutexA", cBuffer := Nil
Default lInitialOwner := .F., cName := "FiveWin App"
If ValType( sMutexAttr ) == "O" .and. ;
Upper( sMutexAttr:className() ) == "TSTRUCT"
cBuffer := sMutexAttr:cBuffer
Endif
::cName := cName
If Abs( hDLL ) > 32 /*LPSTR*/ // LPSTR fails under 32bits!
cFarProc := GetProc32( hDLL, cFunc, iASPASCAL, LONG, LONG, LONG, STRING )
::hMutex := CallDLL32( cFarProc, ;
If( cBuffer # Nil, @cBuffer, cBuffer ), ; // lpMutexAttributes, security descriptor structure or nil
Bool2Int( lInitialOwner ), ; // bInitialOwner, initial owner
cName + Chr(0) ) // lpName, object name
FreeLib32( hDLL )
If cBuffer # Nil
sMutexAttr:cBuffer := cBuffer
Endif
Else
::Failed( hDLL, cFunc )
Endif
Return Self
*********************
I have a Fwh and xHb aplication using latest Sept/Oct2006 Fw28/xHb
This app call the tMutex.prg class Create method below. The tMutex create method calls CallDLL32(.....). In my application when CallDLL32 is called, i get a pop up msgalert "CallDll32", with a title of "calldll.c". I have tracked this down to \fwh\source\winapi\calldll.c which contains
#ifdef __BORLANDC__
..........
#else
CLIPPER CALLDLL32( PARAMS )
{
#ifndef UNICODE
MessageBox( 0, "CallDll32", "CallDll.c", 0 );
#else
MessageBox( 0, L"CallDll32", L"CallDll.c", 0 );
#endif
}
It seems the above CLIPPER CALLDLL32 is being called in error?
In addition, if I ignore the above msgalert, in the line of code below (::hMutex := CallDLL32(...) is set to an array (in stead of a numeric handle), the 2nd element of which is the correct hMutex handle
If I move tMutex.prg to earlier in my xbp link script, the problem is resolved, but that is an unsatisfactory solution
Can you think what might be causing this?
Thanks
Peter
*********************
Method Create( sMutexAttr, lInitialOwner, cName ) Class TMutex
Local hDLL := LoadLib32( iKERNEL )
Local cFarProc, cFunc := "CreateMutexA", cBuffer := Nil
Default lInitialOwner := .F., cName := "FiveWin App"
If ValType( sMutexAttr ) == "O" .and. ;
Upper( sMutexAttr:className() ) == "TSTRUCT"
cBuffer := sMutexAttr:cBuffer
Endif
::cName := cName
If Abs( hDLL ) > 32 /*LPSTR*/ // LPSTR fails under 32bits!
cFarProc := GetProc32( hDLL, cFunc, iASPASCAL, LONG, LONG, LONG, STRING )
::hMutex := CallDLL32( cFarProc, ;
If( cBuffer # Nil, @cBuffer, cBuffer ), ; // lpMutexAttributes, security descriptor structure or nil
Bool2Int( lInitialOwner ), ; // bInitialOwner, initial owner
cName + Chr(0) ) // lpName, object name
FreeLib32( hDLL )
If cBuffer # Nil
sMutexAttr:cBuffer := cBuffer
Endif
Else
::Failed( hDLL, cFunc )
Endif
Return Self
*********************