2008-10-03 09:04 UTC+0200 Viktor Szakats (harbour.01 syenar hu)

* contrib/hbole/oleauto.prg
  * contrib/hbole/ole2.c
  * contrib/hbwin/win_tole.prg
  * contrib/hbwin/win_ole.c
    * OLESHOWEXCEPTION() implemented on the .prg level, using 
      Alert() rather than MessageBox().
    ! All MessageBox()es converted to Alert()s.
    + Added OLEEXCEPTIONSOURCE(), OLEEXCEPTIONDESCRIPTION() 
      to hbole.

  * source/vm/maindllp.c
    ! Changed MessageBox() call to internal error.

  * contrib/gtwvg/gtwvg.c
  * source/rtl/gtwvt/gtwvt.c
    ! Changed MessageBox() calls to internal error.

  * contrib/gtwvg/gtwvg.c
    * Internal error calls synced with GTWVT.

  * source/rtl/hbgtcore.c
    - Removed "Internal error" text from two internal error descriptions.

  * make_vc.mak
    - Removed reference to MessageBox() from comment.

  ; NOTE: No more MessageBox() calls in Harbour.
          (except some wrappers for user .prg code)
This commit is contained in:
Viktor Szakats
2008-10-03 07:06:16 +00:00
parent cd9a7b9a66
commit b7a7705eee
10 changed files with 69 additions and 68 deletions

View File

@@ -8,6 +8,36 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-03 09:04 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbole/oleauto.prg
* contrib/hbole/ole2.c
* contrib/hbwin/win_tole.prg
* contrib/hbwin/win_ole.c
* OLESHOWEXCEPTION() implemented on the .prg level, using
Alert() rather than MessageBox().
! All MessageBox()es converted to Alert()s.
+ Added OLEEXCEPTIONSOURCE(), OLEEXCEPTIONDESCRIPTION()
to hbole.
* source/vm/maindllp.c
! Changed MessageBox() call to internal error.
* contrib/gtwvg/gtwvg.c
* source/rtl/gtwvt/gtwvt.c
! Changed MessageBox() calls to internal error.
* contrib/gtwvg/gtwvg.c
* Internal error calls synced with GTWVT.
* source/rtl/hbgtcore.c
- Removed "Internal error" text from two internal error descriptions.
* make_vc.mak
- Removed reference to MessageBox() from comment.
; NOTE: No more MessageBox() calls in Harbour.
(except some wrappers for user .prg code)
2008-10-03 00:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/rtl/filesys.c
* added workaround for missing S_IREAD, S_IWRITE and S_IEXEC in OS2

View File

@@ -1835,9 +1835,7 @@ static HWND hb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance
if( ! RegisterClass( &wndclass ) )
{
MessageBox( NULL, TEXT( "Failed to register class." ),
s_szClassName, MB_ICONERROR );
return 0;
hb_errInternal( 10001, "Failed to register WVT window class", NULL, NULL );
}
hWnd = CreateWindow(
@@ -1856,8 +1854,7 @@ static HWND hb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance
if( hWnd == NULL )
{
MessageBox( NULL, TEXT( "Failed to create window." ),
TEXT( "HARBOUR_WVG" ), MB_ICONERROR );
hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL );
}
/*
@@ -1898,7 +1895,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
pWVT = hb_gt_wvt_New( pGT );
if( !pWVT )
{
hb_errInternal( 10001, "Cannot allocate new window", NULL, NULL );
hb_errInternal( 10001, "Maximum number of WVT windows reached, cannot create another one", NULL, NULL );
}
HB_GTLOCAL( pGT ) = ( void * ) pWVT;
@@ -1907,10 +1904,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
( HINSTANCE ) s_hPrevInstance,
"", s_iCmdShow );
if( !pWVT->hWnd )
{
/* hb_errRT_TERM( EG_CREATE, 10001, "WINAPI CreateWindow() failed", "hb_gt_wvt_Init()", 0, 0 ); */
hb_errInternal( 10001, "WINAPI CreateWindow() failed", "", "" );
}
return;
#ifndef HB_CDP_SUPPORT_OFF
pWVT->hostCDP = hb_vmCDP();
@@ -3045,7 +3039,7 @@ static int hb_gt_wvt_wnd_Create( PHB_GT pGT, int iTop, int iLeft, int iBottom, i
pWVT = hb_gt_wvt_New( pGT );
if( !pWVT )
{
hb_errInternal( 10001, "Cannot allocate new window", "", "" );
hb_errInternal( 10001, "Cannot allocate new window", NULL, NULL );
}
HB_GTLOCAL( pGT ) = ( void * ) pWVT;
@@ -3069,7 +3063,7 @@ static int hb_gt_wvt_wnd_Create( PHB_GT pGT, int iTop, int iLeft, int iBottom, i
if( !pWVT->hWnd )
{
hb_errInternal( 10001, "WINAPI CreateWindow() failed", "", "" );
hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL );
}
#ifndef HB_CDP_SUPPORT_OFF

View File

@@ -414,20 +414,16 @@ HB_FUNC( CREATEOLEOBJECT ) /* ( cOleName | cCLSID [, cIID ] ) */
hb_retptr( pDisp );
}
HB_FUNC( OLESHOWEXCEPTION )
HB_FUNC( OLEEXCEPTIONSOURCE )
{
if( ( LONG ) s_nOleError == DISP_E_EXCEPTION )
{
#if defined( UNICODE )
MessageBox( NULL, s_excep.bstrDescription, s_excep.bstrSource, MB_ICONHAND );
#else
LPSTR source = WideToAnsi( ( LPWSTR ) s_excep.bstrSource );
LPSTR description = WideToAnsi( ( LPWSTR ) s_excep.bstrDescription );
MessageBox( NULL, description, source, MB_ICONHAND );
hb_xfree( source );
hb_xfree( description );
#endif
}
hb_retc_buffer( hb_oleWideToAnsi( excep.bstrSource ) );
}
HB_FUNC( OLEEXCEPTIONDESCRIPTION )
{
if( ( LONG ) s_nOleError == DISP_E_EXCEPTION )
hb_retc_buffer( hb_oleWideToAnsi( excep.bstrDescription ) );
}
HB_FUNC( OLEINVOKE ) /* ( hOleObject, szMethodName, uParams... ) */

View File

@@ -55,8 +55,6 @@
#include "common.ch"
#include "error.ch"
#translate Alert( <x> ) => MessageBox( 0, <x>, "OLE Error", 0 )
#define EG_OLEEXCEPTION 1001
CLASS TOleAuto
@@ -157,7 +155,7 @@ METHOD Invoke( cMethod, uParam1, uParam2, uParam3, uParam4, uParam5, uParam6 ) C
IF OleIsObject()
RETURN TOleAuto():New( uObj )
ELSEIF Ole2TxtError() == "DISP_E_EXCEPTION"
OLEShowException()
Alert( "OLE exception: " + OleExceptionSource() + ": " + OleExceptionDescription() )
RETURN Self
ELSEIF OleError() != 0
Alert( "OLE error1: " + cMethod + ": " + Ole2TxtError() )
@@ -250,3 +248,9 @@ FUNCTION CreateObject( cString )
FUNCTION GetActiveObject( cString )
RETURN TOleAuto():GetActiveObject( cString )
PROCEDURE OleShowException()
Alert( OleExceptionSource() + ": " + OleExceptionDescription() )
RETURN

View File

@@ -1285,27 +1285,6 @@ HB_FUNC( __OLEENUMSTOP )
pEnumVariant->lpVtbl->Release( pEnumVariant );
}
/* ----------------------------------------------------------------------- */
HB_FUNC( OLESHOWEXCEPTION )
{
if( ( LONG ) s_nOleError == DISP_E_EXCEPTION )
{
#if defined( UNICODE )
MessageBox( NULL, excep.bstrDescription, excep.bstrSource, MB_ICONHAND );
#else
LPSTR source, description;
source = hb_oleWideToAnsi( excep.bstrSource );
description = hb_oleWideToAnsi( excep.bstrDescription );
MessageBox( NULL, description, source, MB_ICONHAND );
hb_xfree( source );
hb_xfree( description );
#endif
}
}
/* ----------------------------------------------------------------------- */
HB_FUNC( OLEEXCEPTIONSOURCE )
{

View File

@@ -63,8 +63,6 @@
#include "hbclass.ch"
#include "error.ch"
#translate Alert( <x> ) => MessageBox( 0, <x>, "OLE Error", 0 )
#ifndef __XHARBOUR__
#define EG_OLEEXCEPTION 1001
@@ -676,4 +674,10 @@ METHOD PROCEDURE __enumStop() CLASS TOleAuto
RETURN
PROCEDURE OleShowException()
Alert( OleExceptionSource() + ": " + OleExceptionDescription() )
RETURN
#endif

View File

@@ -242,7 +242,7 @@ LDFLAGSDLL = /DEBUG $(LDFLAGSDLL)
!if "$(HB_BUILD_WINCE)" == "yes"
STANDARD_SYSLIBS = coredll.lib corelibc.lib winsock.lib ws2.lib
!else
# user32.lib: *Clipboard*(), MessageBox(), CharToOemBuff(), OemToCharBuff(), GetKeyState(), GetKeyboardState(), SetKeyboardState()
# user32.lib: *Clipboard*(), CharToOemBuff(), OemToCharBuff(), GetKeyState(), GetKeyboardState(), SetKeyboardState()
# wsock32.lib: hbinet
# advapi32.lib: GetUserName()
# gdi32.lib: gtwvt

View File

@@ -1555,7 +1555,6 @@ static HWND hb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance
{
HWND hWnd = ( HWND ) 0;
WNDCLASS wndclass;
LPTSTR szAppName = HB_TCHAR_CONVTO( hb_cmdargARGV()[ 0 ] );
HB_SYMBOL_UNUSED( hPrevInstance );
HB_SYMBOL_UNUSED( szCmdLine );
@@ -1575,6 +1574,8 @@ static HWND hb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance
if( RegisterClass( &wndclass ) )
{
LPTSTR szAppName = HB_TCHAR_CONVTO( hb_cmdargARGV()[ 0 ] );
hWnd = CreateWindow(
s_szClassName, /* classname */
szAppName, /* window name */
@@ -1589,18 +1590,18 @@ static HWND hb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance
hInstance, /* instance */
NULL ); /* lpParam */
HB_TCHAR_FREE( szAppName );
if( hWnd )
{
ShowWindow( hWnd, iCmdShow );
UpdateWindow( hWnd );
}
else
MessageBox( NULL, TEXT( "Failed to create window." ), szAppName, MB_ICONERROR );
hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL );
}
else
MessageBox( NULL, TEXT( "Failed to register class." ), szAppName, MB_ICONERROR );
HB_TCHAR_FREE( szAppName );
hb_errInternal( 10001, "Failed to register WVT window class", NULL, NULL );
return hWnd;
}
@@ -1635,9 +1636,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
( HINSTANCE ) s_hPrevInstance,
NULL, s_iCmdShow );
if( !pWVT->hWnd )
{
hb_errInternal( 10001, "WVT window creation failed", NULL, NULL );
}
return;
hb_gt_wvt_InitWindow( pWVT, WVT_DEFAULT_ROWS, WVT_DEFAULT_COLS );
@@ -1656,7 +1655,7 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
/* Set default window title */
{
PHB_FNAME pFileName = hb_fsFNameSplit( hb_cmdargARGV()[0] );
PHB_FNAME pFileName = hb_fsFNameSplit( hb_cmdargARGV()[ 0 ] );
hb_gt_wvt_SetWindowTitle( pWVT->hWnd, pFileName->szName );
hb_xfree( pFileName );
}

View File

@@ -3127,7 +3127,7 @@ HB_EXPORT BOOL hb_gtLoad( const char * szGtName, PHB_GT_FUNCS pFuncTable )
memcpy( s_gtInit[ iPos ]->pSuperTable, pFuncTable, sizeof( HB_GT_FUNCS ) );
if( !s_gtInit[ iPos ]->init( pFuncTable ) )
{
hb_errInternal( 6001, "Internal error: screen driver initialization failure", NULL, NULL );
hb_errInternal( 6001, "Screen driver initialization failure", NULL, NULL );
}
if( s_gtInit[ iPos ]->pGtId )
*s_gtInit[ iPos ]->pGtId = s_iGtLinkCount;
@@ -3191,7 +3191,7 @@ HB_EXPORT void hb_gtStartupInit( void )
return;
}
hb_errInternal( 9998, "Internal error: screen driver initialization failure", NULL, NULL );
hb_errInternal( 9998, "Screen driver initialization failure", NULL, NULL );
/* force linking HB_GTSYS() */
HB_FUNC_EXEC( HB_GTSYS );

View File

@@ -93,12 +93,7 @@ static FARPROC hb_getProcAddress( LPCSTR szProcName )
}
if( pProcAddr == NULL )
{
LPTSTR lpFuncName = HB_TCHAR_CONVTO( szProcName );
MessageBox( NULL, TEXT( "Cannot find function address" ),
lpFuncName, MB_ICONSTOP );
HB_TCHAR_FREE( lpFuncName );
}
hb_errInternal( 9997, "Cannot find address for function %s", szProcName, NULL );
return pProcAddr;
}