Announcement

Collapse
No announcement yet.

DLL Changes from 7.04 to 8.04

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

  • DLL Changes from 7.04 to 8.04

    Hello all!

    In my main source code, which eventually gets compiled into an EXE, I create a dialog using DIALOG NEW.
    This source code then calls a SUB (passing it the handle of the dialog BYREF).
    The SUB adds a few controls to the dialog and returns.
    The SUB gets compiled into a DLL because these are standard controls I use for many dialogs in many applications.

    When the DLL is compiled using PBEdit.EXE Ver 7.04, the controls created by the SUB show up fine when my program runs.
    When the DLL is compiled using PBEdit.EXE Ver 8.04, the controls created by the SUB do not show up when the program runs.
    When I move the SUB from the DLL source code directly into my main source code and compile using PBEdit.EXE, everything works fine.

    I have tried to strip my code down to the most simple example. This is my first attempt at posting a code example so I hope it works.

    Code:
    #COMPILE EXE
    
    #INCLUDE "G:\CTS\Library\WIN32API.INC"
    
    DECLARE SUB  CommonControls LIB "CommCtrl.DLL" ( BYREF hDlg AS DWORD )
    
    '--------------------------------------------------------------------
    
    CALLBACK FUNCTION DlgProc() AS LONG
    
    END FUNCTION
    
    '--------------------------------------------------------------------
    
    FUNCTION PBMAIN () AS LONG
    
        LOCAL hDlg                   AS DWORD
    
        DIALOG NEW 0, "Title",,, 100, 100, %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg
    
        CommonControls ( BYREF hDlg )
    
        DIALOG SHOW MODAL hDlg, CALL DlgProc
    
    END FUNCTION
    
    '--------------------------------------------------------------------
    '--------------------------------------------------------------------
    Code:
    $COMPILE DLL "CommCtrl"
    $DEBUG ERROR ON
    $DIM ALL
    %console = 0
    
    ' DECLARE SUB  CommonControls LIB "CommCtrl.DLL" ( BYREF hDlg AS DWORD )
    
    
    SUB CommonControls ( BYREF hDlg AS DWORD ) EXPORT
    
        CONTROL ADD LABEL, hDlg, 140, "STATION" ,  6, 7, 50,  9
    
    END SUB
    I would like to keep the SUB that builds controls in a DLL.
    I would like to create the DLL using PBEdit.EXE Ver 8.04

    Does anyone know of anything I can do to accomplish my above 2 objectives?

  • #2
    DDT has never supported any statement (eg CONTROL ADD LABEL) for a dialog created in another code module.

    That it "worked" in one version ==> luck.

    about all you can do is arrange for all the DDT statements to appear in the same code module.

    OR... eschew DDT syntax and use the native Windows syntax (eg DialogBox or CreateDialog) as native Windows' syntax has no such 'code module' restrictions.

    MCM
    Last edited by Michael Mattias; 28 Jan 2008, 12:39 PM.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Michael is correct. Either use SDK (i.e. CreateWindow/CreateWindowEX) or if you use DDT keep all the DDT statements in the same module (exe or dll).
      Sincerely,

      Steve Rossell
      PowerBASIC Staff

      Comment


      • #4
        Thank you Gentlemen, much appreciated!

        Jim...

        PS: Have to tell someone...just purchased a diamond ring today for my (hopefully) fiancée. Have to wait to see her reaction though. She gets it on March 13.

        Comment


        • #5
          Dut . . . Dut . . . Dut

          . . . And another one bites the dust...

          (with apologies to the copyright holders)

          Congrats guy
          John,
          --------------------------------
          John Strasser
          Phone: 480 - 273 - 8798

          Comment

          Working...
          X