From 9302977cad16c631a2bc249121bab8d71fe58021 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 9 May 2011 10:27:07 +0000 Subject: [PATCH] 2011-05-09 12:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/gtwvg/gtwvg.c * contrib/gtwvg/wvgwin.c ! fixed to use GetModuleHandle() instead of LoadModule() on user32.dll and kernel32.dll. safer and faster. --- harbour/ChangeLog | 6 ++++++ harbour/contrib/gtwvg/gtwvg.c | 27 +-------------------------- harbour/contrib/gtwvg/wvgwin.c | 2 +- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4498361cb3..97bd853af6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,12 @@ The license applies to all entries newer than 2009-04-28. */ +2011-05-09 12:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/gtwvg/gtwvg.c + * contrib/gtwvg/wvgwin.c + ! fixed to use GetModuleHandle() instead of LoadModule() on + user32.dll and kernel32.dll. safer and faster. + 2011-05-09 12:06 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbwin/wapi_winbase.c * contrib/hbwin/hbwin.hbx diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 2d051394bb..4c9fca704c 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -2624,31 +2624,6 @@ static HB_BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) if( !pWVT->hWnd ) hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL ); - /* An experimental call - processed at WndProc to recognize pWVT off hWnd */ - #if 0 - SetWindowLongPtr( pWVT->hWnd, GWL_USERDATA, ( LONG_PTR ) pWVT ); - #endif - -#if 0 - if( ! GetSystemMetrics( SM_REMOTESESSION ) ) - { - typedef BOOL ( WINAPI * P_SLWA )( HWND, COLORREF, BYTE, DWORD ); - - P_SLWA pSetLayeredWindowAttributes = ( P_SLWA ) - GetProcAddress( GetModuleHandle( TEXT( "user32.dll" ) ), - "SetLayeredWindowAttributes" ); - - if( pSetLayeredWindowAttributes ) - { - SetWindowLongPtr( pWVT->hWnd, GWL_EXSTYLE, GetWindowLongPtr( pWVT->hWnd, GWL_EXSTYLE ) | WS_EX_LAYERED ); - pSetLayeredWindowAttributes( pWVT->hWnd, - ( COLORREF ) 0 /* COLORREF crKey */, - 255 /* BYTE bAlpha */, - LWA_ALPHA /* DWORD dwFlags */ ); - } - } -#endif - hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS ); /* Set icon */ @@ -4365,7 +4340,7 @@ static void hb_wvt_gtLoadGuiData( void ) } } - h = LoadLibraryEx( TEXT( "user32.dll" ), NULL, 0 ); + h = GetModuleHandle( TEXT( "user32.dll" ) ); if( h ) { s_guiData->pfnLayered = ( wvtSetLayeredWindowAttributes ) GetProcAddress( h, "SetLayeredWindowAttributes" ); diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index 0a2e79ebc0..d0d05551b0 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -1148,7 +1148,7 @@ HB_FUNC( WVG_SETLAYEREDWINDOWATTRIBUTES ) HINSTANCE h; wvtSetLayeredWindowAttributes pfnLayered; - h = LoadLibraryEx( TEXT( "user32.dll" ), NULL, 0 ); + h = GetModuleHandle( TEXT( "user32.dll" ) ); if( h ) { pfnLayered = ( wvtSetLayeredWindowAttributes ) GetProcAddress( h, "SetLayeredWindowAttributes" );