Announcement

Collapse
No announcement yet.

Debug Idea with PB/DLL -> PB/CC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Debug Idea with PB/DLL -> PB/CC

    I love PB/DLL but the ability to debug programs with PB/CC
    PRINT/STDOUT command(s) is a huge assett.

    Currently I develop my functions with PB/CC and then port them
    over to PB/DLL.

    I'm wanting to know if this is possible.

    Can I send a message to a console window and have it display the
    text?

    I invision having a blank PB/CC program open that just sits
    and waits for messages, and when a message appears it will
    print it to the screen.

    Any ideas? Similar to #DEBUG PRINT but this is so much
    easier to work with. The debugger takes so long to run.

    This is what I have so far:
    DEBUG.BAS PB/CC 2.0
    ---SNIP------
    Code:
    #COMPILE EXE
    #INCLUDE "win32api.inc"
    
    %INVALID_HANDLE_VALUE  = -1
    %WAIT_FAILED = &HFFFF
    
    FUNCTION PBMAIN() AS LONG
        DIM lcPathSpec AS ASCIIZ * 255
        DIM zShortCookiePath AS ASCIIZ * %MAX_PATH
        lcPathSpec = "D:\debug"
        lbWatchSubtree& = %TRUE
        lihNotify& = FINDFIRSTCHANGENOTIFICATION(lcPathSpec, lbWatchSubtree&, %FILE_NOTIFY_CHANGE_FILE_NAME)
        IF lihNotify& <= %INVALID_HANDLE_VALUE THEN
            EXIT FUNCTION
        END IF
        liWaitReturn& = WAITFORSINGLEOBJECT(lihNotify&, %INFINITE)
        IF liWaitReturn& >= %WAIT_FAILED THEN
            OPEN "D:\debug\debug.txt" FOR INPUT SHARED AS #1
            INPUT #1, sBuffer$
            CLOSE #1: KILL "d:\debug\debug.txt"
            PRINT sBuffer$
            DO
                liWaitReturn& = FINDNEXTCHANGENOTIFICATION(lihNotify&)
                liWaitReturn& = WAITFORSINGLEOBJECT(lihNotify&, %INFINITE)
                IF liWaitReturn& >= %WAIT_FAILED THEN
                    OPEN "D:\debug\debug.txt" FOR INPUT SHARED AS #1
                    INPUT #1, sBuffer$
                    CLOSE #1: KILL "d:\debug\debug.txt"
                    PRINT sBuffer$
                END IF
            LOOP
        END IF
    END FUNCTION
    ---SNIP------

    SAMPLES.BAS PB/DLL 6.0
    ---SNIP------
    Code:
    SUB Debug(sText$)
        #IF %DEF(%pb_cc32)
            PRINT "DEBUG: " & sText$ & " - " & TIME$
        #ENDIF
        
        #IF %DEF(%pb_dll32)
            OPEN "D:\debug\debug.txt" FOR OUTPUT AS #1
            PRINT #1, "DEBUG: " & sText$: CLOSE #1
            'MSGBOX "DEBUG: " & sText$ & " - " & TIME$
        #ENDIF
    END SUB
    ---SNIP------

    My code doesn't work the way I'm wanting. I would rather
    send messages, some type of IPC would be good I think. Any
    ideas?

    ------------------
    -Greg

    [This message has been edited by Gregery D Engle (edited April 19, 2001).]
    -Greg
    [email protected]
    MCP,MCSA,MCSE,MCSD

  • #2
    There was some code recently posted by Semen in this or the Source Code Forum that shows how to create and output data to a console window from a PB/DLL GUI app... search for "AllocConsole" and you should find it ok.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Greg,
      You may find this utility useful.

      www.jcfuller.com/ADPDP.ZIP


      James


      ------------------

      Comment


      • #4
        EZGUI 1.0 HAS DEBUGPRINT


        ------------------

        Comment

        Working...
        X