External program execution with RUN() command breaks wopen/wclose console windowing subsystem for MS Windows platforms.

383 views
Skip to first unread message

zaka

unread,
Jul 23, 2012, 4:36:22 PM7/23/12
to harbou...@googlegroups.com
Hi!
I have a serious problem with porting an old legacy clipper program written with wopen/wclose console windowing subsystem.
This problem affects only MS Windows of platforms (tested on WinXP and Win7 32bit) while Linux is not affected (Mageia 1 64bit).
After external program execution with RUN() command, WCLOSE() command fails to properly close window (window content remains on screen).
Here is my small test program 'extapptest.prg'. Build command - 'hbmk2 -lhbct extapptest.prg'. Tested with hb30 and latest hb32.
Please, can someone confirm or maybe refuse it? Maybe some workaround for this issue?
Regards, Alexander.

function main()
    local w1, w2, w3

    setcolor("w+/b")
    save screen
    clear screen

    w1 := wopen(1, 1, 5, 15, .t. )
    wbox(2)
    @1, 0 say padc( 'Window 1.', 14 )
    w2 := wopen(4, 11, 8, 25, .t. )
    wbox(2)
    @1, 0 say padc( 'Window 2.', 14 )

    alert( 'Press OK to run external application.' )
    if 'Linux' $ OS()
        run( 'kwrite' )
        //run( 'gedit' )
    elseif 'Windows' $ OS()
        run( 'notepad' )
    endif

    alert( 'Press OK to close Window 1.' )
    wclose( w1 )
    alert( 'Press OK to close Window 2.' )
    wclose( w2 )

    alert( 'Press OK to exit.' )
    restore screen
return

Giovanni Di Maria

unread,
Jul 23, 2012, 5:13:13 PM7/23/12
to harbou...@googlegroups.com
Hi
Your  source is OK.
Only, add this line AFTER local statement:

function main()
    local w1, w2, w3

setmode(25,80)               <-------------------

    setcolor("w+/b")
    save screen
    clear screen

.......
.......


and compile it with:

hbmk2 test.prg xhb.hbc


Regards
Giovanni Di Maria


Giovanni Di Maria

unread,
Jul 23, 2012, 6:26:23 PM7/23/12
to harbou...@googlegroups.com
..... and use:

RETURN .T.

because you are using a function..... :-)
Giovanni

zaka

unread,
Jul 24, 2012, 2:40:06 AM7/24/12
to harbou...@googlegroups.com


вторник, 24 июля 2012 г., 4:26:23 UTC+6 пользователь Giovanni Di Maria написал:

Thank you for your reply, but it does not solve my problem. :(
SETMODE() seems to be not crossplatform because it breaks Linux 'konsole' terminal app.
It is usefull for Windows console, but it does not solve the WOPEN/RUN/WCLOSE issue.
By the way, one message above about the difference for the RUN() in hb30 and hb32, there is a suggestion to
use 'Wapi_ShellExecute' function/procedure. It seems to be a good workaround for my problem, but I can't
find documentation for it. Is it possible to use it to launch external editor (OpenOffice for example) with a file
name as a parameter? And also is it a crossplatform function?
Alexander.

Massimo Belgrano

unread,
Jul 24, 2012, 4:07:40 AM7/24/12
to harbou...@googlegroups.com

Here you find harbour the better harbour documentation on line

--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users



--
Massimo Belgrano


Reply all
Reply to author
Forward
0 new messages