From 37e8299b9d2cb893ccfbb19b29a6f355f19a1387 Mon Sep 17 00:00:00 2001 From: Maurilio Longo Date: Fri, 24 Aug 2001 14:41:55 +0000 Subject: [PATCH] 2001-08-24 16:40 GMT+2 Maurilio Longo * contrib/os2pm/os2pm.c * moved here functions from mainpm.c * * contrib/os2pm/tform.prg + added new methods * source/vm/mainpm.c - removed a couple of helper functions which belong to os2pm.c --- harbour/ChangeLog | 8 +++++++ harbour/contrib/os2pm/os2pm.c | 42 +++++++++++++++++++++++++++++++++ harbour/contrib/os2pm/tform.prg | 7 ++++-- harbour/source/vm/mainpm.c | 28 +++------------------- 4 files changed, 58 insertions(+), 27 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 25e359d028..36d9fed518 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +2001-08-24 16:40 GMT+2 Maurilio Longo + * contrib/os2pm/os2pm.c + * moved here functions from mainpm.c + * * contrib/os2pm/tform.prg + + added new methods + * source/vm/mainpm.c + - removed a couple of helper functions which belong to os2pm.c + 2001-08-24 16:03 GMT+2 Maurilio Longo + contrib/os2pm + contrib/os2pm/os2pm.c diff --git a/harbour/contrib/os2pm/os2pm.c b/harbour/contrib/os2pm/os2pm.c index 6d6c49d5a9..4a5b60932b 100644 --- a/harbour/contrib/os2pm/os2pm.c +++ b/harbour/contrib/os2pm/os2pm.c @@ -66,3 +66,45 @@ HB_FUNC( NOR ) hb_retnl( lRet ); } + + +HB_FUNC( WINSETWINDOWTEXT ) +{ + hb_retl( WinSetWindowText( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ) ) ); +} + + +HB_FUNC( WINGETTEXT ) +{ + BYTE bBuffer[ 255 ]; + + WinQueryWindowText( ( HWND ) hb_parnl( 1 ), 254, bBuffer ); + hb_retc( bBuffer ); +} + + +HB_FUNC( MSGINFO ) +{ + HWND hWnd = WinQueryActiveWindow( HWND_DESKTOP); + PSZ szCaption = ( hb_pcount() > 1 && ISCHAR( 2 ) ? hb_parc( 2 ) : "Information"); + + hb_retnl( WinMessageBox( HWND_DESKTOP, hWnd, hb_parc( 1 ), szCaption, + 0, MB_INFORMATION | MB_OK | MB_MOVEABLE | MB_APPLMODAL ) ); +} + + +HAB hb_pm_GetHab() { + + HWND hWnd = WinQueryActiveWindow( HWND_DESKTOP); + return WinQueryAnchorBlock(hWnd); + +} + + +HB_FUNC( GETHAB ) +{ + hb_retnl( ( LONG ) hb_pm_GetHab() ); +} + + + diff --git a/harbour/contrib/os2pm/tform.prg b/harbour/contrib/os2pm/tform.prg index 07ae6ac222..3db1ffeb58 100644 --- a/harbour/contrib/os2pm/tform.prg +++ b/harbour/contrib/os2pm/tform.prg @@ -13,9 +13,12 @@ CLASS TForm CLASSDATA lRegistered - METHOD New() + METHOD New() + METHOD ShowModal() + METHOD cCaption() INLINE WinGetText( ::hWnd ) - METHOD ShowModal() + METHOD _cCaption( cNewCaption ) INLINE ; + WinSetWindowText( ::hWnd, cNewCaption ) ENDCLASS diff --git a/harbour/source/vm/mainpm.c b/harbour/source/vm/mainpm.c index cd427707df..8ea04d46d6 100644 --- a/harbour/source/vm/mainpm.c +++ b/harbour/source/vm/mainpm.c @@ -58,11 +58,12 @@ #include "hbapi.h" #include "hbvm.h" -static HAB hab; /* Anchor Block handle */ -static HMQ hmq; /* Message Queue handle */ int main( int argc, char * argv[] ) { + HAB hab; /* Anchor Block handle */ + HMQ hmq; /* Message Queue handle */ + hab = WinInitialize( 0 ); hmq = WinCreateMsgQueue( hab, 0 ); @@ -78,27 +79,4 @@ int main( int argc, char * argv[] ) } -/* NOTE: We don't need to have global HAB and HMQ */ -HAB hb_pm_GetHab( void ) { - return hab; -} - - -HB_FUNC( GETHAB ) -{ - hb_retnl( ( LONG ) hb_pm_GetHab() ); -} - - -/* NOTE: Just a test, to remove */ -HB_FUNC( MSGINFO ) -{ - HWND hWnd = WinQueryActiveWindow( HWND_DESKTOP); - PSZ szCaption = ( hb_pcount() > 1 && ISCHAR( 2 ) ? hb_parc( 2 ) : "Information"); - - hb_retnl( WinMessageBox( HWND_DESKTOP, hWnd, hb_parc( 1 ), szCaption, - 0, MB_INFORMATION | MB_OK | MB_MOVEABLE | MB_APPLMODAL ) ); -} - -