2017-09-11 20:36 UTC Viktor Szakats (vszakats users.noreply.github.com)

* contrib/hbwin/hbwin.hbp
  * contrib/hbwin/wapi_winbase.c -> contrib/hbwin/wapi_winbase_1.c
  * contrib/hbwin/wapi_winuser.c -> contrib/hbwin/wapi_winuser_1.c
  * contrib/hbwin/win_misc.c -> contrib/hbwin/win_misc_1.c
  + contrib/hbwin/wapi_winbase_2.c
  + contrib/hbwin/wapi_winuser_2.c
  + contrib/hbwin/win_misc_2.c
    % sync file-splits with 3.4 fork

  * src/rtl/val.c
    * sync with 3.4 fork (no change in functionality)
This commit is contained in:
Viktor Szakats
2017-09-11 20:37:19 +00:00
parent ff3fbd8e40
commit 25e0853a49
9 changed files with 382 additions and 273 deletions

View File

@@ -7,6 +7,19 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */
2017-09-11 20:36 UTC Viktor Szakats (vszakats users.noreply.github.com)
* contrib/hbwin/hbwin.hbp
* contrib/hbwin/wapi_winbase.c -> contrib/hbwin/wapi_winbase_1.c
* contrib/hbwin/wapi_winuser.c -> contrib/hbwin/wapi_winuser_1.c
* contrib/hbwin/win_misc.c -> contrib/hbwin/win_misc_1.c
+ contrib/hbwin/wapi_winbase_2.c
+ contrib/hbwin/wapi_winuser_2.c
+ contrib/hbwin/win_misc_2.c
% sync file-splits with 3.4 fork
* src/rtl/val.c
* sync with 3.4 fork (no change in functionality)
2017-09-11 18:35 UTC Viktor Szakats (vszakats users.noreply.github.com)
* contrib/gtwvg/*.prg
* contrib/gtwvg/gtwgud.c

View File

@@ -36,13 +36,15 @@ wapi_err.c
wapi_misc.c
wapi_mmsystem.c
wapi_shellapi.c
wapi_winbase.c
wapi_winbase_1.c
wapi_winbase_2.c
wapi_winbase_mutex.c
wapi_wingdi.c
wapi_wingdi_font.c
wapi_winnetwk.c
wapi_winnls.c
wapi_winuser.c
wapi_winuser_1.c
wapi_winuser_2.c
wapi_winuser_dlg.c
wce_simc.c
wce_smsc.c
@@ -51,7 +53,8 @@ win_bmpd.c
win_com.c
win_dlg.c
win_evnt.c
win_misc.c
win_misc_1.c
win_misc_2.c
win_osc.c
win_prn1.c
win_prn2.c

View File

@@ -47,11 +47,6 @@
#include "hbwapi.h"
#include "hbapierr.h"
/* For SetErrorMode() */
#if defined( HB_OS_WIN_CE )
#include "hbwince.h"
#endif
HB_FUNC( WAPI_GETCOMMANDLINE )
{
HB_RETSTR( GetCommandLine() );
@@ -62,21 +57,11 @@ HB_FUNC( WAPI_GETCURRENTPROCESS )
hbwapi_ret_raw_HANDLE( GetCurrentProcess() );
}
HB_FUNC( WAPI_GETCURRENTPROCESSID )
{
hb_retnint( GetCurrentProcessId() );
}
HB_FUNC( WAPI_GETCURRENTTHREAD )
{
hbwapi_ret_raw_HANDLE( GetCurrentThread() );
}
HB_FUNC( WAPI_GETCURRENTTHREADID )
{
hb_retnint( GetCurrentThreadId() );
}
HB_FUNC( WAPI_WAITFORSINGLEOBJECT )
{
DWORD dwResult = WaitForSingleObject( hbwapi_par_raw_HANDLE( 1 ), ( DWORD ) hb_parnl( 2 ) );
@@ -186,11 +171,6 @@ HB_FUNC( WAPI_SETPROCESSWORKINGSETSIZE )
hbwapi_ret_L( bResult );
}
HB_FUNC( WAPI_GETLASTERROR )
{
hb_retnl( ( long ) hbwapi_GetLastError() );
}
HB_FUNC( WAPI_SETLASTERROR )
{
DWORD dwLastError = ( DWORD ) hb_parnl( 1 );
@@ -201,7 +181,11 @@ HB_FUNC( WAPI_SETLASTERROR )
HB_FUNC( WAPI_SETERRORMODE )
{
#if defined( HB_OS_WIN_CE )
hb_retni( 0 );
#else
hb_retni( SetErrorMode( ( UINT ) hb_parni( 1 ) ) );
#endif
}
HB_FUNC( WAPI_LOADLIBRARY )
@@ -257,80 +241,6 @@ HB_FUNC( WAPI_GETMODULEHANDLE )
hb_strfree( hModuleName );
}
/* VOID WINAPI Sleep( __in DWORD dwMilliseconds ); */
HB_FUNC( WAPI_SLEEP )
{
Sleep( ( DWORD ) hb_parnl( 1 ) );
}
HB_FUNC( WAPI_OUTPUTDEBUGSTRING )
{
void * hOutputString;
OutputDebugString( HB_PARSTR( 1, &hOutputString, NULL ) );
hb_strfree( hOutputString );
}
HB_FUNC( WAPI_FORMATMESSAGE )
{
void * hSource = NULL;
LPTSTR lpAllocBuff = NULL;
LPTSTR lpBuffer = NULL;
HB_SIZE nSize = 0;
DWORD dwRetVal;
DWORD dwFlags;
dwFlags = ( DWORD ) hb_parnldef( 1, FORMAT_MESSAGE_FROM_SYSTEM );
if( HB_ISBYREF( 5 ) )
{
nSize = hb_parns( 6 );
if( ( dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER ) == 0 )
{
if( nSize == 0 && ! HB_ISNUM( 6 ) )
nSize = hb_parclen( 5 );
if( nSize > 0 )
lpBuffer = ( LPTSTR ) hb_xgrab( nSize * sizeof( TCHAR ) );
else
dwFlags |= FORMAT_MESSAGE_ALLOCATE_BUFFER;
}
}
else
dwFlags = ( DWORD ) ~FORMAT_MESSAGE_ALLOCATE_BUFFER;
if( dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER )
lpBuffer = ( LPTSTR ) &lpAllocBuff;
dwRetVal = FormatMessage( dwFlags,
HB_ISCHAR( 2 ) ? ( LPCVOID ) HB_PARSTR( 2, &hSource, NULL ) : hb_parptr( 2 ),
HB_ISNUM( 3 ) ? ( DWORD ) hb_parnl( 3 ) : hbwapi_GetLastError() /* dwMessageId */,
( DWORD ) hb_parnldef( 4, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ) ) /* dwLanguageId */,
lpBuffer,
( DWORD ) nSize,
NULL /* TODO: Add support for this parameter. */ );
hbwapi_SetLastError( GetLastError() );
hb_retnl( dwRetVal );
if( lpBuffer )
{
if( dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER )
lpBuffer = lpAllocBuff;
else
lpBuffer[ nSize - 1 ] = '\0';
HB_STORSTR( dwRetVal ? lpBuffer : NULL, 5 );
if( lpAllocBuff )
LocalFree( lpAllocBuff );
else if( lpBuffer )
hb_xfree( lpBuffer );
}
hb_strfree( hSource );
}
HB_FUNC( WAPI_MULDIV )
{
hb_retni( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) );
@@ -503,7 +413,7 @@ HB_FUNC( WAPI_QUERYPERFORMANCEFREQUENCY )
/* wapi_GetVolumeInformation( <cRootPath>, @<cVolumeName>, @<nSerial>,
* @<nMaxComponentLength>, @<nFileSystemFlags>,
* @<cFileSystemName> ) -> <lSuccess>
* @<cFileSystemName> ) --> <lSuccess>
*/
HB_FUNC( WAPI_GETVOLUMEINFORMATION )

View File

@@ -0,0 +1,136 @@
/*
* Windows API functions (winbase)
*
* Copyright 2009 Viktor Szakats (vszakats.net/harbour)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file LICENSE.txt. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbwapi.h"
HB_FUNC( WAPI_GETLASTERROR )
{
hb_retnl( ( long ) hbwapi_GetLastError() );
}
HB_FUNC( WAPI_GETCURRENTPROCESSID )
{
hb_retnint( GetCurrentProcessId() );
}
HB_FUNC( WAPI_GETCURRENTTHREADID )
{
hb_retnint( GetCurrentThreadId() );
}
HB_FUNC( WAPI_FORMATMESSAGE )
{
void * hSource = NULL;
LPTSTR lpAllocBuff = NULL;
LPTSTR lpBuffer = NULL;
HB_SIZE nSize = 0;
DWORD dwRetVal;
DWORD dwFlags;
dwFlags = ( DWORD ) hb_parnldef( 1, FORMAT_MESSAGE_FROM_SYSTEM );
if( HB_ISBYREF( 5 ) )
{
nSize = hb_parns( 6 );
if( ( dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER ) == 0 )
{
if( nSize == 0 && ! HB_ISNUM( 6 ) )
nSize = hb_parclen( 5 );
if( nSize > 0 )
lpBuffer = ( LPTSTR ) hb_xgrab( nSize * sizeof( TCHAR ) );
else
dwFlags |= FORMAT_MESSAGE_ALLOCATE_BUFFER;
}
}
else
dwFlags = ( DWORD ) ~FORMAT_MESSAGE_ALLOCATE_BUFFER;
if( dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER )
lpBuffer = ( LPTSTR ) &lpAllocBuff;
dwRetVal = FormatMessage( dwFlags,
HB_ISCHAR( 2 ) ? ( LPCVOID ) HB_PARSTR( 2, &hSource, NULL ) : hb_parptr( 2 ),
HB_ISNUM( 3 ) ? ( DWORD ) hb_parnl( 3 ) : hbwapi_GetLastError() /* dwMessageId */,
( DWORD ) hb_parnldef( 4, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ) ) /* dwLanguageId */,
lpBuffer,
( DWORD ) nSize,
NULL /* TODO: Add support for this parameter. */ );
hbwapi_SetLastError( GetLastError() );
hb_retnl( dwRetVal );
if( lpBuffer )
{
if( dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER )
lpBuffer = lpAllocBuff;
else
lpBuffer[ nSize - 1 ] = '\0';
HB_STORSTR( dwRetVal ? lpBuffer : NULL, 5 );
if( lpAllocBuff )
LocalFree( lpAllocBuff );
else if( lpBuffer )
hb_xfree( lpBuffer );
}
hb_strfree( hSource );
}
/* VOID WINAPI Sleep( __in DWORD dwMilliseconds ); */
HB_FUNC( WAPI_SLEEP )
{
Sleep( ( DWORD ) hb_parnl( 1 ) );
}
HB_FUNC( WAPI_OUTPUTDEBUGSTRING )
{
void * hOutputString;
OutputDebugString( HB_PARSTR( 1, &hOutputString, NULL ) );
hb_strfree( hOutputString );
}

View File

@@ -1,8 +1,8 @@
/*
* Windows API functions (winuser)
*
* Copyright 2009-2014 Viktor Szakats (vszakats.net/harbour)
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* Copyright 2009 Viktor Szakats (vszakats.net/harbour)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@
/* For: ( defined( HB_OS_WIN_CE ) && defined( _MSC_VER ) && ( _MSC_VER <= 1310 ) ) */
#ifndef WS_OVERLAPPEDWINDOW
# define WS_OVERLAPPEDWINDOW ( WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX )
#define WS_OVERLAPPEDWINDOW ( WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX )
#endif
HB_FUNC( WAPI_SETWINDOWPOS )
@@ -103,21 +103,6 @@ HB_FUNC( WAPI_GETDESKTOPWINDOW )
hbwapi_ret_raw_HWND( GetDesktopWindow() );
}
HB_FUNC( WAPI_MESSAGEBOX )
{
void * hStr1;
void * hStr2;
int iResult = MessageBox( hbwapi_par_raw_HWND( 1 ),
HB_PARSTR( 2, &hStr1, NULL ),
HB_PARSTR( 3, &hStr2, NULL ),
hbwapi_par_INT( 4 ) );
hbwapi_SetLastError( GetLastError() );
hbwapi_ret_NI( iResult );
hb_strfree( hStr1 );
hb_strfree( hStr2 );
}
HB_FUNC( WAPI_MESSAGEBEEP )
{
BOOL bResult = MessageBeep( hbwapi_par_UINT( 1 ) );
@@ -211,9 +196,7 @@ HB_FUNC( WAPI_DRAWTEXT )
/* BEGIN SCROLLBAR MANIPULATION WINAPI FUNCTIONS */
/*
BOOL EnableScrollBar( HWND hWnd, UINT wSBflags, UINT wArrows );
*/
/* BOOL EnableScrollBar( HWND hWnd, UINT wSBflags, UINT wArrows ); */
HB_FUNC( WAPI_ENABLESCROLLBAR )
{
BOOL bResult;
@@ -233,10 +216,8 @@ HB_FUNC( WAPI_ENABLESCROLLBAR )
hbwapi_ret_L( bResult );
}
/*
BOOL GetScrollBarInfo( HWND hwnd, LONG idObject, PSCROLLBARINFO psbi );
*/
#if 0
/* BOOL GetScrollBarInfo( HWND hwnd, LONG idObject, PSCROLLBARINFO psbi ); */
HB_FUNC( WAPI_GETSCROLLBARINFO )
{
PSCROLLBARINFO sbi = ( PSCROLLBARINFO ) hbwapi_par_STRUCT( 3 );
@@ -258,9 +239,7 @@ HB_FUNC( WAPI_GETSCROLLBARINFO )
}
#endif
/*
BOOL GetScrollInfo( HWND hwnd, int fnBar, LPSCROLLINFO lpsi );
*/
/* BOOL GetScrollInfo( HWND hwnd, int fnBar, LPSCROLLINFO lpsi ); */
HB_FUNC( WAPI_GETSCROLLINFO )
{
LPSCROLLINFO si = ( LPSCROLLINFO ) hbwapi_par_raw_STRUCT( 3 );
@@ -278,9 +257,7 @@ HB_FUNC( WAPI_GETSCROLLINFO )
hbwapi_ret_L( bSuccess );
}
/*
int GetScrollPos( HWND hWnd, int nBar );
*/
/* int GetScrollPos( HWND hWnd, int nBar ); */
HB_FUNC( WAPI_GETSCROLLPOS )
{
int iResult;
@@ -299,9 +276,7 @@ HB_FUNC( WAPI_GETSCROLLPOS )
hbwapi_ret_NI( iResult );
}
/*
BOOL GetScrollRange( HWND hWnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos );
*/
/* BOOL GetScrollRange( HWND hWnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos ); */
HB_FUNC( WAPI_GETSCROLLRANGE )
{
BOOL bSuccess;
@@ -331,37 +306,29 @@ HB_FUNC( WAPI_GETSCROLLRANGE )
}
#if 0
/*
BOOL ScrollDC( HDC hDC, int dx, int dy, const RECT *lprcScroll, const RECT *lprcClip,
HRGN hrgnUpdate, LPRECT lprcUpdate );
*/
/* BOOL ScrollDC( HDC hDC, int dx, int dy, const RECT * lprcScroll, const RECT * lprcClip,
HRGN hrgnUpdate, LPRECT lprcUpdate ); */
HB_FUNC( WAPI_SCROLLDC )
{
}
/*
BOOL ScrollWindow( HWND hWnd, int XAmount, int YAmount, const RECT *lpRect,
const RECT *lpClipRect );
*/
/* BOOL ScrollWindow( HWND hWnd, int XAmount, int YAmount, const RECT * lpRect,
const RECT * lpClipRect ); */
HB_FUNC( WAPI_SCROLLWINDOW )
{
}
/*
int ScrollWindowEx( HWND hWnd, int dx, int dy, const RECT *prcScroll, const RECT *prcClip,
HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags );
*/
/* int ScrollWindowEx( HWND hWnd, int dx, int dy, const RECT * prcScroll, const RECT * prcClip,
HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags ); */
HB_FUNC( WAPI_SCROLLWINDOWEX )
{
}
#endif
/*
int SetScrollInfo( HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL fRedraw );
*/
/* int SetScrollInfo( HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL fRedraw ); */
HB_FUNC( WAPI_SETSCROLLINFO )
{
LPSCROLLINFO si = ( LPSCROLLINFO ) hbwapi_par_raw_STRUCT( 3 );
@@ -372,23 +339,18 @@ HB_FUNC( WAPI_SETSCROLLINFO )
HB_ISLOG( 4 ) ? hbwapi_par_BOOL( 4 ) : TRUE ) );
}
/*
int SetScrollPos( HWND hWnd, int nBar, int nPos, BOOL bRedraw );
*/
/* int SetScrollPos( HWND hWnd, int nBar, int nPos, BOOL bRedraw ); */
HB_FUNC( WAPI_SETSCROLLPOS )
{
int iResult = SetScrollPos( hbwapi_par_raw_HWND( 1 ),
hbwapi_par_INT( 2 ),
hbwapi_par_INT( 3 ),
hbwapi_par_BOOL( 4 ) );
hbwapi_SetLastError( GetLastError() );
hbwapi_ret_NI( iResult );
}
/*
BOOL SetScrollRange( HWND hWnd, int nBar, int nMinPos, int nMaxPos, BOOL bRedraw );
*/
/* BOOL SetScrollRange( HWND hWnd, int nBar, int nMinPos, int nMaxPos, BOOL bRedraw ); */
HB_FUNC( WAPI_SETSCROLLRANGE )
{
BOOL bResult = SetScrollRange( hbwapi_par_raw_HWND( 1 ),
@@ -396,14 +358,11 @@ HB_FUNC( WAPI_SETSCROLLRANGE )
hbwapi_par_INT( 3 ),
hbwapi_par_INT( 4 ),
HB_ISLOG( 5 ) ? hbwapi_par_BOOL( 5 ) : TRUE );
hbwapi_SetLastError( GetLastError() );
hbwapi_ret_L( bResult );
}
/*
BOOL ShowScrollBar( HWND hWnd, int wBar, BOOL bShow );
*/
/* BOOL ShowScrollBar( HWND hWnd, int wBar, BOOL bShow ); */
HB_FUNC( WAPI_SHOWSCROLLBAR )
{
BOOL bResult;
@@ -458,8 +417,8 @@ HB_FUNC( WAPI_LOADBITMAP )
}
#endif
/* wapi_LoadImage( [<hInstance>], <cName>, [<nType>],
[<nWidth>], [<nHeight>], [<nFlags>] ) -> <hImage> */
/* wapi_LoadImage( [<hInstance>], <cName>|<nID>, [<nType>],
[<nWidth>], [<nHeight>], [<nFlags>] ) --> <hImage> */
HB_FUNC( WAPI_LOADIMAGE )
{
void * hString = NULL;
@@ -480,9 +439,7 @@ HB_FUNC( WAPI_LOADIMAGE )
hbwapi_ret_raw_HANDLE( hImage );
}
/*
* MENU functions
*/
/* MENU functions */
HB_FUNC( WAPI_LOADMENU )
{
@@ -527,7 +484,6 @@ HB_FUNC( WAPI_GETSYSTEMMENU )
HWND hWnd = hbwapi_par_raw_HWND( 1 );
HMENU hMenu = GetSystemMenu( hWnd ? hWnd : GetActiveWindow(),
hbwapi_par_BOOL( 2 ) );
hbwapi_SetLastError( GetLastError() );
hbwapi_ret_raw_HMENU( hMenu );
}
@@ -821,11 +777,12 @@ HB_FUNC( WAPI_CREATEACCELERATORTABLE )
{
HACCEL hAccel = NULL;
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
int iEntries = pArray ? ( int ) hb_arrayLen( pArray ) : 0, i;
int iEntries = pArray ? ( int ) hb_arrayLen( pArray ) : 0;
if( iEntries > 0 )
{
LPACCEL lpAccel = ( LPACCEL ) hb_xgrab( sizeof( ACCEL ) * iEntries );
int i;
for( i = 0; i < iEntries; ++i )
{

View File

@@ -0,0 +1,63 @@
/*
* Windows API functions (winuser)
*
* Copyright 2009-2014 Viktor Szakats (vszakats.net/harbour)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file LICENSE.txt. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbwapi.h"
HB_FUNC( WAPI_MESSAGEBOX )
{
void * hStr1;
void * hStr2;
int iResult = MessageBox( hbwapi_par_raw_HWND( 1 ),
HB_PARSTR( 2, &hStr1, NULL ),
HB_PARSTR( 3, &hStr2, NULL ),
hbwapi_par_INT( 4 ) );
hbwapi_SetLastError( GetLastError() );
hbwapi_ret_NI( iResult );
hb_strfree( hStr1 );
hb_strfree( hStr2 );
}

View File

@@ -2,6 +2,7 @@
* Misc Windows API functions
*
* Copyright 2008-2009 Viktor Szakats (vszakats.net/harbour)
* Copyright 2009 Francesco Saverio Giudice <info / at / fsgiudice.com> (win_SysRefresh())
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,17 +45,6 @@
*
*/
/*
* The following parts are Copyright of the individual authors.
*
* Copyright 2009 Francesco Saverio Giudice <info / at / fsgiudice.com>
* win_SysRefresh()
*
* See COPYING.txt for licensing terms.
*
*/
#include "hbwin.h"
#include "hbwapi.h"
#include "hbapiitm.h"
@@ -62,65 +52,6 @@
#define QS_ALLPOSTMESSAGE 0x0100
#endif
HB_FUNC( WIN_RUNDETACHED )
{
void * hCommandName;
void * hCommandLine;
HB_SIZE nLen;
LPCTSTR lpCommandRO = HB_PARSTR( 2, &hCommandLine, &nLen );
#if ! defined( HB_OS_WIN_CE )
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset( &si, 0, sizeof( si ) );
si.cb = sizeof( si );
memset( &pi, 0, sizeof( pi ) );
#endif
if( CreateProcess(
HB_PARSTR( 1, &hCommandName, NULL ), /* Command name */
HB_STRUNSHARE( &hCommandLine, lpCommandRO, nLen ), /* Command line (Unicode version needs an non-const buffer) */
NULL, /* Process handle not inheritable */
NULL, /* Thread handle not inheritable */
FALSE, /* Set handle inheritance to FALSE */
#if ! defined( HB_OS_WIN_CE )
hb_parl( 4 ) ? CREATE_NO_WINDOW : CREATE_NEW_CONSOLE, /* Creation flags */
#else
CREATE_NEW_CONSOLE, /* Creation flags */
#endif
NULL, /* Use parent's environment block */
NULL, /* Use parent's starting directory */
#if ! defined( HB_OS_WIN_CE )
&si, /* Pointer to STARTUPINFO structure */
&pi ) /* Pointer to PROCESS_INFORMATION structure */
#else
NULL, /* Pointer to STARTUPINFO structure */
NULL ) /* Pointer to PROCESS_INFORMATION structure */
#endif
)
{
hb_retl( HB_TRUE );
#if ! defined( HB_OS_WIN_CE )
hb_stornl( pi.dwProcessId, 3 );
/* Close process and thread handles. */
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
#endif
}
else
{
hb_stornl( -1, 3 );
hb_retl( HB_FALSE );
}
hb_strfree( hCommandName );
hb_strfree( hCommandLine );
}
HB_FUNC( WIN_LOADRESOURCE )
{
HANDLE hInstance = NULL;

106
contrib/hbwin/win_misc_2.c Normal file
View File

@@ -0,0 +1,106 @@
/*
* Misc Windows API functions
*
* Copyright 2008-2009 Viktor Szakats (vszakats.net/harbour)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file LICENSE.txt. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA (or visit https://www.gnu.org/licenses/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbwapi.h"
HB_FUNC( WIN_RUNDETACHED )
{
void * hCommandName;
void * hCommandLine;
HB_SIZE nLen;
LPCTSTR lpCommandRO = HB_PARSTR( 2, &hCommandLine, &nLen );
#if ! defined( HB_OS_WIN_CE )
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset( &si, 0, sizeof( si ) );
si.cb = sizeof( si );
memset( &pi, 0, sizeof( pi ) );
#endif
if( CreateProcess(
HB_PARSTR( 1, &hCommandName, NULL ), /* Command name */
HB_STRUNSHARE( &hCommandLine, lpCommandRO, nLen ), /* Command-line (Unicode version needs an non-const buffer) */
NULL, /* Process handle not inheritable */
NULL, /* Thread handle not inheritable */
FALSE, /* Set handle inheritance to FALSE */
#if ! defined( HB_OS_WIN_CE )
hb_parl( 4 ) ? CREATE_NO_WINDOW : CREATE_NEW_CONSOLE, /* Creation flags */
#else
CREATE_NEW_CONSOLE, /* Creation flags */
#endif
NULL, /* Use parent's environment block */
NULL, /* Use parent's starting directory */
#if ! defined( HB_OS_WIN_CE )
&si, /* Pointer to STARTUPINFO structure */
&pi ) /* Pointer to PROCESS_INFORMATION structure */
#else
NULL, /* Pointer to STARTUPINFO structure */
NULL ) /* Pointer to PROCESS_INFORMATION structure */
#endif
)
{
hb_retl( HB_TRUE );
#if ! defined( HB_OS_WIN_CE )
hb_stornl( pi.dwProcessId, 3 );
/* Close process and thread handles. */
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
#endif
}
else
{
hb_stornl( -1, 3 );
hb_retl( HB_FALSE );
}
hb_strfree( hCommandName );
hb_strfree( hCommandLine );
}

View File

@@ -48,8 +48,8 @@
#include "hbapiitm.h"
#include "hbapierr.h"
/* returns the numeric value of a character string representation of a number */
HB_FUNC( VAL )
/* returns the numeric value of a character string representation of a number */
static void hb_val( HB_BOOL fExt )
{
PHB_ITEM pText = hb_param( 1, HB_IT_STRING );
@@ -63,50 +63,40 @@ HB_FUNC( VAL )
fDbl = hb_valStrnToNum( szText, iLen, &lValue, &dValue, &iDec, &iWidth );
if( ! fDbl )
hb_retnintlen( lValue, iWidth );
else
if( fExt )
{
iLen = hb_parnidef( 2, iLen );
if( fDbl && iDec > 0 )
iLen -= iDec + 1;
if( iLen > iWidth )
iWidth = iLen;
else if( iLen > 0 )
{
while( iWidth > iLen && *szText == ' ' )
{
iWidth--;
szText++;
}
}
}
if( fDbl )
hb_retndlen( dValue, iWidth, iDec );
else
hb_retnintlen( lValue, iWidth );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1098, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
}
HB_FUNC( VAL )
{
hb_val( HB_FALSE );
}
HB_FUNC( HB_VAL )
{
PHB_ITEM pText = hb_param( 1, HB_IT_STRING );
if( pText )
{
const char * szText = hb_itemGetCPtr( pText );
int iWidth, iDec, iLen = ( int ) hb_itemGetCLen( pText );
HB_BOOL fDbl;
HB_MAXINT lValue;
double dValue;
fDbl = hb_valStrnToNum( szText, iLen, &lValue, &dValue, &iDec, &iWidth );
iLen = hb_parnidef( 2, iLen );
if( fDbl && iDec > 0 )
iLen -= iDec + 1;
if( iLen > iWidth )
iWidth = iLen;
else if( iLen > 0 )
{
while( iWidth > iLen && *szText == ' ' )
{
iWidth--;
szText++;
}
}
if( ! fDbl )
hb_retnintlen( lValue, iWidth );
else
hb_retndlen( dValue, iWidth, iDec );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 1098, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
hb_val( HB_TRUE );
}