Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is the xHarbour equivalente of SWPERRLEV

37 views
Skip to first unread message

rdc02271

unread,
Nov 13, 2007, 7:03:40 AM11/13/07
to
Hello all.
I've to quickly figure out if we can use xHarbour to port a DOS app to
Windows/Linux.
This application is using Blinker SWPERRLEV function.
What is the xHArbour equivalent of SWPERRLEV?
I just can't find info on this...

Thanks for your help and attention.
J.C.

N:dlzc D:aol T:com (dlzc)

unread,
Nov 13, 2007, 8:06:25 AM11/13/07
to
Dear rdc02271:

"rdc02271" <rdc0...@yahoo.com> wrote in message
news:1194955420....@o38g2000hse.googlegroups.com...


> Hello all.
> I've to quickly figure out if we can use xHarbour to port
> a DOS app to Windows/Linux.
> This application is using Blinker SWPERRLEV function.
> What is the xHArbour equivalent of SWPERRLEV?
> I just can't find info on this...

I have not had much success with this but:
You have both set and read the DOS error level, so if you check
errorlevel() for a value of between 0 and 255...

You have access to the clipboard, so a value could be written to
and read from the clipboard.

You could direct the child process' output to a text file, and
parse the file.

You have access to the registry, so a value could be written to
and read from the registry.

You have access to OLE, (Word, Excel, Access, OpenOffice
components, etc.) and communications is ongoing...

David A. Smith


Ron Pinkas

unread,
Nov 13, 2007, 6:34:12 AM11/13/07
to
> What is the xHArbour equivalent of SWPERRLEV?

Not tested, but this might probably work:

//--------------------------------//
FUNCTION SwpRunCmd( cCommand, nuMem, cRunPath, cTempPath )

LOCAL nAt, cArgs, cPresetDisk, cPresetDir, nRet

#ifndef DIR_SEPARATOR
#ifdef __PLATFORM__Windows
#define DIR_SEPARATOR '\'
#else
#define DIR_SEPARATOR '/'
#endif
#endif

IF Empty( cRunPath )
nAt := At( ' ', cCommand )

IF nAt > 0
cArgs := SubStr( cCommand, nAt )
cCommand := Left( cCommand, nAt - 1 )
ENDIF

nAt := RAt( DIR_SEPARATOR, cCommand )

IF nAt > 0
cRunPath := Left( cCommand, nAt )
cCommand := SubStr( cCommand, nAt + 1 ) + cArgs
ENDIF
ENDIF

IF cRunPath[2] == ':'
cPresetDisk := DiskName()

IF ! DiskChange( cRunPath[1] )
RETURN Throw( ErrorNew( "Blinker", 0, 1001, ProcName(), "Could not
switch to drive: " + cRunPath[1], HB_aParams() ) )
ENDIF

cRunPath := SubStr( cRunPath, 3 )
ENDIF

IF ! Empty( cRunPath )
cPresetDir := DIR_SEPARATOR + CurDir()

IF DirChange( cRunPath ) != 0
RETURN Throw( ErrorNew( "Blinker", 0, 1002, ProcName(), "Could not
switch to folder: " + cRunPath, HB_aParams() ) )
ENDIF
ENDIF

__Run( cCommand, @nRet )
SwpErrLev( nRet )

IF ! Empty( cPresetDisk )
IF ! DiskChange( cPresetDisk )
RETURN Throw( ErrorNew( "Blinker", 0, 1003, ProcName(), "Could not
switch back to drive: " + cPresetDisk, HB_aParams() ) )
ENDIF
ENDIF

IF ! Empty( cPresetDir )
IF DirChange( cPresetDisk ) != 0
RETURN Throw( ErrorNew( "Blinker", 0, 1004, ProcName(), "Could not
switch back to folder: " + cPresetDir, HB_aParams() ) )
ENDIF
ENDIF

RETURN nRet == 0

FUNCTION SwpErrLev( nLev )

STATIC s_nLastLev := 0

IF ValType( nLev ) == 'N'
s_nLastLev := nLev
ENDIF

RETURN s_nLastLev
//--------------------------------//

Ron


0 new messages