Announcement

Collapse
No announcement yet.

Is DDT slow?

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

  • Is DDT slow?

    I am reading a loggfile, and updating a listbox with entrys that match a certain criteria.
    This is done from a worker-thread (via a callback)
    -------
    My original app's GUI is SDK-style, my testapp has its GUI proggrammed in DDT.
    -------
    Problem: SDK-style is 500% faster than DDT.
    With this I mean that I read and display 5 hits in a second with SDK
    and only read and display 1 hit per second when using DDT.
    -------
    I must stress the fact that the function reading the loggfile reside in a DLL,
    and I use the same DLL for both apps...

    Someone having experienced this before?



    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

  • #2
    Fred,

    CreateDialog is already an encapsulation of CreateWindowEx
    and DDT is itself an encapsulation of CreateDialog, this could
    explain the difference in speed you get when compared to pure
    SDK coding.


    ------------------
    Patrice Terrier
    mailto[email protected][email protected]</A>
    Patrice Terrier
    www.zapsolution.com
    www.objreader.com
    Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

    Comment


    • #3
      I agree that this may *contribute* to the difference in speed, but without see how Fred has constructed his application, it is not possible to say absolutely. Especially as Fred states there is a 5:1 relationship in performance... this factor seems too high.

      Therefore, we'd need to see the code to see if there are ways of improving the performance of the app just by optimizing the code or changing the strategy the app uses.



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

      Comment


      • #4
        Lance, the code is here. Hope it is not too long
        As I said, it is the same code for SDK/DDT with that diffrence
        SDK use 'SendMessage' and DDT use 'Control Send'
        ----
        I was very humble in the first posting. The diffrence is sometimes
        1000% and more. (DDT choke for 5 seconds, but SDK go on ticking )
        Ther is not much to change.. Look at bold text in code
        Code:
        This is the Thread-entry code in the PROD-LOG DLL
          
        Function PROD_SCAN(udt As Typ_ThreadStatus Ptr)Export As Long
        Local LM As LogMsg_Typ
        Local Rc&,secs&
        Static IniChange As Double
        Local CB_Master As DWord
        
          On Error Resume Next
          glbAbort = 0                               
          @udt.ID      = GetCurrentThreadId
          @udt.Running = 1
          glbCB_Logg   = @udt.CBLogg        'global in dll
          CB_Master    = @udt.CBMaster      
          hWnd_Master  = @udt.hWndMaster    'global in dll
        
          If IniChange < FSO_GetVariantFileTime(gIniFil) Then
           IniChange = FSO_GetVariantFileTime(gIniFil)
           Call PROD_INIT(gIniFil)
           LM.TransNr  = "--------"
           LM.Filnamn  = "------------"
           LM.Modul    = "PRODLOGG"
           LM.Funktion = "INICHANG"
           LM.Text     = "Tråden PRODLOGG uppdaterar sina inställningar "
           If CB_Master <> 0 Then Call DWord CB_Master Using proto_Loggevent(LM)
          End If
          rc& = BARR_ScanLogg()
          If rc& = 200 Or glbAbort <> 0 Then Rc& = 200:GoTo ErrExit
          Sleep 100
          rc& = XFP_ScanLogg()
          If rc& = 200 Or glbAbort <> 0 Then Rc& = 200:GoTo ErrExit
          Sleep 100
          rc& = CD_ScanLogg()
          If rc& = 200 Or glbAbort <> 0 Then Rc& = 200:GoTo ErrExit
          @udt.ExitCode = 0
          Exit Function
        ErrExit:  
          @udt.ExitCode = rc&
        End Function  
           
        --------------
        This is the actual function for reading one type of loggfile
        The messages are in swedish, sorry
        This function is called from XFP_ScanLogg() whitch hold the list of loggfiles to read.  
        
        Function XFP_ReadLogg(ByVal Fil$) As Long
        Dim dbLog  As LogInfo
        Local yy%,mm%,dd%,hh%,mi%,ss%
        Local FilNr&,InRad$,Sync$
           
        '..open in binary mode to get a snapshot.............................
           On Error Resume Next
           If FSO_FileExists(Fil$) = 0 Then Function = 100: GoTo ErrExit
           FilNr& = GetFreeFile
           ErrClear:Open Fil$ For Binary Access Read Shared As FilNr&
           If ErrClear > 0 Then Function = 100: GoTo ErrExit
        '..Read the snapshot.................................................
           dbLog.FilNamn = Fil$
           ErrClear:Get FilNr&,1, dbLog.Sync
           If ErrClear > 0 Then Close FilNr&: Function = 101: GoTo ErrExit
           Close FilNr&
        '..Compare with last snapshot in database............................
           If DBLOG_GetInfo(Fil$, ByCopy dbLog.Sync, dbLog) = %False Then Function = 102: GoTo ErrExit
        '..Reopen file for Reading in shared mode............................
           ErrClear:Open Fil$ For Input Lock Shared As FilNr& 
           If ErrClear > 0 Then Function = 100: GoTo ErrExit
           If dbLog.FilePos >= Lof(FilNr&) Then Close FilNr&: Function = %True: GoTo ErrExit
        '..Jump to last saved position in file...............................
           ErrClear:Seek FilNr&, dbLog.FilePos
        '..loopa until no more data in file..................................
        Local XR As XfpRadTyp
           Do While Not Eof(FilNr&)
            Sleep 0
            If glbAbort <> 0 Then
             Call DBLOG_SaveInfo(dbLog)
             Close FilNr&:Function = 200:Exit Function
            End If
            ErrClear:Line Input #FilNr&,InRad$
            If ErrClear > 0 Then Close FilNr&: Function = 101: GoTo ErrExit
            dbLog.FilePos = Seek(FilNr&)
            LSet XR = UCase$(InRad$)
            If Instr(XR.DxFil, "OFFLINE") > 0 Then Iterate Do
            If (Instr(XR.DxMag, "X")> 0) And _
               (Len(RTrim$(XR.DxFil,any Chr$(0,32)))> 0) Then GoSub NyttXFPEntry
           Loop
        '..End of file,update last filepos in database,close.................
           ErrClear:dbLog.FilePos = Seek(FilNr&)
           Call DBLOG_SaveInfo(dbLog)
           Close FilNr&
           Function = 0
        ErrExit:
           Exit Function
        
        '--SUBRUTIN----------------------------------------------------------
        NyttXFPEntry:
           Replace any "./-" With "---" In XR.Datum
           Replace any "./-" With ":::" In XR.Tid
        '--LoggDate--------------------------------------
            yy% = Val(Parse$(XR.Datum,"-",1))
            mm% = Val(Parse$(XR.Datum,"-",2))
            dd% = Val(Parse$(XR.Datum,"-",3))
            dbLog.LogDate = VbDateSerial(yy%,mm%,dd%)
        '--LoggTime--------------------------------------
            hh% = Val(Parse$(XR.Tid,":",1))
            mi% = Val(Parse$(XR.Tid,":",2))
            ss% = Val(Parse$(XR.Tid,":",3))
            dbLog.LogTime = VbTimeSerial(hh%,mi%,ss%)
        '--Save  entry ----------------------------------
           Call DBLOG_SaveInfo(dbLog)
        '--get this files transaction from database------
        Dim T As UtCmdTyp
        Local LM As LogMsg_Typ,XM As XfpMsg_Typ
        Local TransNr$,TransIdx$
           LM = ClrLM
           XM = ClrXM
           TransNr$ = Trim$(XR.DxFil,any Chr$(0,32))
           TransIdx$ = TransNr$
           LM.Modul = "XFPLOG"
           LM.Funktion = "NY POST"
           LM.FilNamn = TransIdx$
           XM.Datum   = RTrim$(XR.Datum,any Chr$(0,32))
           XM.Tid     = RTrim$(XR.Tid,any Chr$(0,32))
           XM.DxId    = RTrim$(XR.DxId,any Chr$(0,32))
           XM.Rutin   = RTrim$(XR.Rutin,any Chr$(0,32))
           XM.OrderNr = Format$(Val(XR.DxOrder),"0000000")
           
           If IsFalse TRANS_GetRecord(TransNr$,T) Then
            If IsFalse TRANS_FindTrans(TransIdx$,T) Then
             LSet LM.Text = XM & "*VARNING* Kan inte finna transaktionen"
        'SendMessage hWnd_Master,%LOG_PROD,ByVal VarPtr(LM),0
             If glbCB_Logg <> 0 Then Call DWord glbCB_Logg Using proto_LoggEvent(LM)
             Return
            End If
           End If
        '--Create message-index--------------------------
        Local Tidx As TransIdxTyp,Tmp$
           TransNr$ = RTrim$(T.TransNr,any Chr$(0,32))
           TIdx.TransNr = T.TransNr
           TIdx.FilNamn = T.FilNamn
        '--Create LogMessage-----------------------------
           LM.Funktion = "NY POST "
           LM.TransNr = TransNr$
           Tmp$ = FSO_GetBaseName(RTrim$(T.InFil,any Chr$(0,32)))
           If Len(Tmp$) > 8 Then Tmp$ = Mid$(Tmp$,1,8)
           Tmp$ = Tmp$ & "." & FSO_GetExtensionName(RTrim$(T.InFil,any Chr$(0,32)))
           LM.FilNamn = Tmp$
        '--Update Transaction-database--------------------
           T.ProdDatum = dbLog.LogDate
           T.ProdTid   = dbLog.LogTime
           T.PrintId   = XR.DxId
           If Val(XR.DxOrder) > 0 Then T.OrderNr = Val(XR.DxOrder)
           T.DXRutin   = XR.Rutin
           T.DXOrginal = Val(XR.DXOrginal)
           T.DXPages   = Val(XR.DXPages)
           T.DXCopies  = Val(XR.DXCopies)
        '--Connect to database----------------------------
           If IsFalse TRANS_UpDateRecord(T) Then
            LSet LM.Text  = XM & " *ERROR* Kan inte uppdatera transaktionen"
        'SendMessage hWnd_Master,%LOG_PROD,ByVal VarPtr(LM),0
            If glbCB_Logg <> 0 Then Call DWord glbCB_Logg Using proto_LoggEvent(LM)
            Return
           End If
        '--Alles Ok Create Msg to 'buissness-rules'-------
           Call MSG_PCSTvaPost(TransNr$,TIdx)
           LSet LM.Text = XM 
        'SendMessage hWnd_Master,%LOG_PROD,ByVal VarPtr(LM),0
           If glbCB_Logg <> 0 Then Call DWord glbCB_Logg Using proto_LoggEvent(LM)
           Return
        End Function
          
        =========THIS FUNCTION CREATES THE LIST-MESSAGES============
          
        Function MAST_LoggEvent(LM As LogMsg_Typ) As Long
        Local Datum$,Msg$,UtMsg$,ListCount&,Li&,chkStatus&
        Local Nu As Double
          On Error Resume Next
          Nu = Now()
          Msg$ = Space$(SizeOf(LM))
          LSet Msg$ = LM
          Replace Chr$(0) With Chr$(32) In Msg$
          Msg$ = RTrim$(Msg$)
        '--format msg for listbox------------------------
          Datum$ = FormatDateTime(Nu,"YYMMDD HH:MM:SS")
          UtMsg$ = Datum$ & " " & Msg$
          EnterCriticalSection CS_GateList
        '--Only 10,000 msg in list-----------------------
          Control Send ghDlg_Gate,%Listbox,%LB_GETCOUNT,0,0 To ListCount&
          If ListCount& > 10000 Then
           Control Send ghDlg_Gate,%Listbox,%WM_SETREDRAW,0&,0&
           For Li& = 1 To 1000
            Control Send ghDlg_Gate,%Listbox,%LB_DELETESTRING, 0, 0
           Next 
           Control Send ghDlg_Gate,%Listbox,%WM_SETREDRAW,1&,0&
          End If
        '--add msg to list--------------------------------
          Control Send ghDlg_Gate,%Listbox,%LB_ADDSTRING,0,StrPtr(UtMsg$) To ListCount&
        '--If not ScrollOff then set focus to listitem----
          Control Get Check ghDlg_Gate,%Scroll To chkStatus&
          If chkStatus& = 0 Then
           Control Send ghDlg_Gate,%Listbox,%LB_SETCURSEL , ListCount&+1, 0 To Li&
          End If
          LeaveCriticalSection CS_GateList
          If Instr(UtMsg$,"*ERROR*") = 0 Then GoTo ExitDone
        
        '--*ERROR* we need to alert operator-------------
          EnterCriticalSection CS_ErrorList
        '--only 10,000 listitems-------------------------
          Control Send ghDlg_ErrList,%Listbox,%LB_GETCOUNT,0,0 To ListCount&
          If ListCount& > 10000 Then
           Control Send ghDlg_ErrList,%Listbox,%WM_SETREDRAW,0&,0&
           For Li& = 1 To 1000
            Control Send ghDlg_ErrList,%Listbox,%LB_DELETESTRING,0,0
           Next 
           Control Send ghDlg_ErrList,%Listbox,%WM_SETREDRAW,1&,0&
          End If
        '--time to add the message------------------------
          Control Send ghDlg_ErrList,%Listbox,%LB_ADDSTRING,0,StrPtr(UtMsg$)
        '--If not ScrollOff,setfocus to listitem----------
          Control Get Check ghDlg_ErrList,%Scroll To chkStatus&
          If chkStatus = 0 Then
           Control Send ghDlg_ErrList,%Listbox,%LB_SETCURSEL , ListCount&+1,0 To Li&
          End If
          LeaveCriticalSection CS_ErrorList
        ExitDone:
        '--It has to be written to apps logfile-----------
          Datum$ = FormatDateTime(Nu,"YYYYMMDD HH:MM:SS")
          UtMsg$ = Datum$ & " " & Msg$
          Call LOG_MasterLogg(Msg$)
        End Function
        ------------------
        Fred
        mailto:[email protected][email protected]</A>
        http://www.oxenby.se



        [This message has been edited by Fred Oxenby (edited March 18, 2001).]
        Fred
        mailto:[email protected][email protected]</A>
        http://www.oxenby.se

        Comment


        • #5
          Code:
          This is from program loggfile
          Some UDT-members have changed place, in order to give a more readable looks
            
          As you can see ratio (GUI/DDT) is almost 1/5
             
          20010318 22:23:22 XFPLOG VARNING          FLY141.BQE   2000-01-25 15:11:15 XFP1 FLY141   0000000  Kan inte finna transaktionen
          20010318 22:25:04 XFPLOG VARNING          BIP512.IG8   2000-03-21 15:22:37 XFP1 BIP512   0000000  Kan inte finna transaktionen
          Total        1:42    
             
          20010318 22:30:11          FLY141.BQE   XFPLOG   NY POST  2000-01-25 15:11:15 XFP1 FLY141   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:37:56          BIP512.IG8   XFPLOG   NY POST  2000-03-21 15:22:37 XFP1 BIP512   0000000  *VARNING* Kan inte finna transaktionen
          Total        7:45
             
          When Windows handle a message from another thread, it has to switch to that thread and execute the code
          It seems that DDT message-handler (in comarising to SDK-message handler) performs poorly in situations like this.
          ---
          My reason for wanting DDT-GUI was to be able to take advantage of EZGUI-Designer 
          Mr Boss, Is your SDK-style designer in sight..?
             
              
          ======================
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART MASTER.EXE
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART MASTER-FILESERVER = \\NTSERVER\DATA\
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART MASTER-BIBLIOTEK  = \\NTSERVER\DATA\SPIDER\MASTER20\
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART MASTER ID= 20
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART Kontrollerar/skapar SPIDER biblioteks-struktur
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART RUNTIME DLL INIT OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART FOX_OPT.DLL INIT OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART GATEKEEPER DLL INITIERAD OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART ALERT DLL INITIERAD OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART CONSOL DLL INITIERAD OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART MAIL DLL INITIERAD OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART MESSAGE-QUE DLL INITIERAD OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART PCS DATA-QUE DLL INITIERAD OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART PRODUKTIONSLOGG INITIERAD OK
          20010318 22:22:02 -------- ------------ MASTER20 PRGSTART Programmet startar om 30 sekunder
          20010318 22:22:33 -------- ------------ SCRIPT20 CHECKDIR Kontrollerar Script/Bibliotek
          20010318 22:22:33 2001-02-08 03:52:10 *WARNING* FIL I QUEDIR \\NTSERVER\CAPELLA\!\QUE\TEST.1GC
          20010318 22:22:33 2001-03-15 20:44:29 *WARNING* FIL I QUEDIR \\NTSERVER\CAPELLA\!\QUE\Capella2.1GD
          20010318 22:22:34 2001-03-15 20:44:31 *WARNING* FIL I QUEDIR \\NTSERVER\CAPELLA\!\QUE\loggar.1GE
          20010318 22:22:34 -------- ------------ SCRIPT20 CHECKDIR Scriptkontroll avslutad
          20010318 22:23:22 XFPLOG VARNING          FLY141.BQE   2000-01-25 15:11:15 XFP1 FLY141   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          FLY141.BQS   2000-01-26 10:33:35 XFP1 FLY141   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          TDA010.C45   2000-01-26 12:53:06 XFP1 TDA010   0102387  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          BSP015.C32   2000-01-26 14:30:50 XFP1 BSP015   0102401  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          BSP016.C35   2000-01-26 16:22:49 XFP1 BSP016   0102402  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          CAP200.C6U   2000-01-26 16:29:30 XFP1 CAP200   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          MAG002.C48   2000-01-26 16:45:50 XFP1 MAG002   0102264  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          MAG002.C4B   2000-01-26 16:54:47 XFP1 MAG002   0102405  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          MAG002.C4E   2000-01-26 16:55:40 XFP1 MAG002   0102406  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          TIP009.C6C   2000-01-26 17:01:23 XFP1 TIP009   0102419  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          TIP009.C6J   2000-01-26 17:02:30 XFP1 TIP009   0102420  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          BDA008.C6H   2000-01-26 17:12:21 XFP1 BDA008   0102422  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          FIN310.C3Q   2000-01-26 17:33:54 XFP1 FIN310   0102337  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          FIN310.C3T   2000-01-26 17:46:29 XFP1 FIN310   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          ESO018.C4S   2000-01-27 03:52:01 XFP1 ESO028   0102407  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          ESO028.C4V   2000-01-27 04:06:32 XFP1 ESO028   0102409  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          ESO034.C4T   2000-01-27 04:13:06 XFP1 ESO034   0102408  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          ESO020.C53   2000-01-27 04:13:54 XFP1 ESO020   0102410  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          ESO032.C54   2000-01-27 04:14:35 XFP1 ESO032   0102412  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          ESO033.C55   2000-01-27 04:18:11 XFP1 ESO033   0102411  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          ESO030.C58   2000-01-27 04:24:55 XFP1 ESO030   0102413  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          TDA010.C7L   2000-01-27 04:30:55 XFP1 TDA010   0102424  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          CAP200.C2I   2000-01-27 09:55:20 XFP1 CAP200   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          TIP009.C99   2000-01-27 10:41:20 XFP1 TIP009   0102432  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          RAH002.C9G   2000-01-27 11:26:02 XFP1 RAH002   0102434  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          KLS050.C94   2000-01-27 11:52:21 XFP1 KLS050   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          VVS001.BSD   2000-01-27 15:02:59 XFP1 VVS001   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          VVS010.BSF   2000-01-27 15:09:41 XFP1 VVS010   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          MOC002.C9Q   2000-01-27 16:05:56 XFP1 MOC002   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          SKM009.C5U   2000-01-27 16:51:41 XFP1 SKM009   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          HKN001.C6B   2000-01-27 16:55:08 XFP1 HKN001   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          TRE001.C64   2000-01-27 17:01:11 XFP1 TRE001   0000000  Kan inte finna transaktionen
          20010318 22:23:22 XFPLOG VARNING          SKA120.C6T   2000-01-27 17:36:53 XFP1 SKA120   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          VVL001.BST   2000-01-27 18:36:11 XFP1 VVL001   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          VVL010.BSV   2000-01-27 18:37:00 XFP1 VVL010   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          VVT001.BTC   2000-01-27 18:58:25 XFP1 VVT001   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          VVT010.BTE   2000-01-27 18:59:04 XFP1 VVT010   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          FRY001.BHO   2000-01-28 09:13:46 XFP1 FRY001   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          FRY001.BHO   2000-01-28 09:31:44 XFP1 FRY001   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          FRY001.BHO   2000-01-28 09:40:55 XFP1 FRY001   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIP501.C66   2000-01-28 15:58:05 XFP1 BIP501   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIP502.C67   2000-01-28 15:58:52 XFP1 BIP502   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIP511.C68   2000-01-28 15:59:32 XFP1 BIP511   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIP512.C69   2000-01-28 16:00:14 XFP1 BIP512   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIG501.C1T   2000-01-28 17:08:48 XFP1 BIG501   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIG502.C1U   2000-01-28 17:09:33 XFP1 BIG502   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIG511.C1V   2000-01-28 17:10:25 XFP1 BIG511   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BIG512.C20   2000-01-28 17:11:18 XFP1 BIG512   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          TIP009.CBA   2000-01-28 17:16:11 XFP1 TIP009   0102447  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BLA003.CBD   2000-01-28 17:17:11 XFP1 BLA003   0102444  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BLA002.CBG   2000-01-28 17:42:11 XFP1 BLA002   0102443  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          SKS010.BHH   2000-01-28 17:44:01 XFP1 SKS010   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          HAN040.C2E   2000-01-28 17:58:12 XFP1 HAN040   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          HAN041.C2F   2000-01-28 17:59:29 XFP1 HAN041   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          HAN041.C2G   2000-01-28 18:00:54 XFP1 HAN041   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          BTR101.CB2   2000-01-28 18:09:59 XFP1 BTR101   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          SLA011.C75   2000-01-28 18:17:52 XFP1 SLA011   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          SKA050.C2V   2000-01-28 18:35:30 XFP1 SKA050   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          TRI301.CC7   2000-01-31 10:05:40 XFP1 TRI301   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          FRT010.BRK   2000-01-31 10:33:16 XFP1 FRT010   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          FRT011.BRL   2000-01-31 10:34:21 XFP1 FRT011   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          FRT012.BRM   2000-01-31 10:35:35 XFP1 FRT012   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          SKM101.C1C   2000-01-31 10:49:42 XFP1 SKM101   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          MOC001.CB0   2000-01-31 10:54:18 XFP1 MOC001   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          TVA311.CBT   2000-01-31 11:19:50 XFP1 TVA311   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          TVA321.CBP   2000-01-31 11:30:17 XFP1 TVA321   0000000  Kan inte finna transaktionen
          20010318 22:23:23 XFPLOG VARNING          TVA311.CBQ   2000-01-31 11:32:47 XFP1 TVA311   0000000  Kan inte finna transaktionen
          ===
          ===
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-20 14:58:21 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-20 15:01:30 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-20 15:11:08 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-20 15:15:07 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-20 15:23:48 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          TDA010.IA7   2000-03-21 01:58:08 XFP1 TDA010   0102999  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          TIP009.IAA   2000-03-21 02:12:30 XFP1 TIP009   0102993  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          TIP009.IAD   2000-03-21 02:22:05 XFP1 TIP009   0102994  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          TIP009.IAO   2000-03-21 02:26:50 XFP1 TIP009   0102995  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-21 07:50:04 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-21 08:09:57 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-21 08:22:28 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-21 08:37:46 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SKM101.I9E   2000-03-21 08:54:53 XFP1 SKM101   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-21 08:59:49 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          FRY001.I9T   2000-03-21 09:13:51 XFP1 FRY001   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          FRY002.I9U   2000-03-21 09:15:44 XFP1 FRY002   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          FLY117.IDS   2000-03-21 09:20:59 XFP1 FLY117   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA045.I2E   2000-03-21 09:47:36 XFP1 SLA045   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          CAP200.CSP   2000-03-21 10:16:56 XFP1 CAP200   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          CAP200.CSP   2000-03-21 12:31:37 XFP1 CAP200   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          CAP200.CSP   2000-03-21 13:06:12 XFP1 CAP200   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          OPC001.EOE   2000-03-21 13:14:36 XFP1 OPC001   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          CAP200.CSP   2000-03-21 13:38:40 XFP1 CAP200   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          OPC001.EOE   2000-03-21 13:40:01 XFP1 OPC001   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA010.IF6   2000-03-21 13:50:15 XFP1 SLA010   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          SLA040.IFR   2000-03-21 14:34:41 XFP1 SLA040   0000000  Kan inte finna transaktionen
          20010318 22:25:03 XFPLOG VARNING          OPC001.EOE   2000-03-21 14:42:44 XFP1 DEF3211  0000000  Kan inte finna transaktionen
          20010318 22:25:04 XFPLOG VARNING          OPC001.EOE   2000-03-21 14:44:37 XFP1 OPC001   0000000  Kan inte finna transaktionen
          20010318 22:25:04 XFPLOG VARNING          OPC001.EOE   2000-03-21 14:54:24 XFP1 OPC001   0000000  Kan inte finna transaktionen
          20010318 22:25:04 XFPLOG VARNING          BIP511.IG4   2000-03-21 15:20:28 XFP1 BIP511   0000000  Kan inte finna transaktionen
          20010318 22:25:04 XFPLOG VARNING          BIP501.IG6   2000-03-21 15:21:16 XFP1 BIP501   0000000  Kan inte finna transaktionen
          20010318 22:25:04 XFPLOG VARNING          BIP502.IG7   2000-03-21 15:21:56 XFP1 BIP502   0000000  Kan inte finna transaktionen
          20010318 22:25:04 XFPLOG VARNING          BIP512.IG8   2000-03-21 15:22:37 XFP1 BIP512   0000000  Kan inte finna transaktionen
          20010318 22:28:07 -------- ------------ MASTER20 PRGSTOPP Operatören stoppade programmet
          ==
          == HERE END READING LOGFILE (GUI in SDK STYLE )
          ================================================================================================
          == HERE START PROGRAM (GUI in DDT-STYLE)
          ==
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART RUNTIME DLL INIT OK
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART INITIERING AV GATEKEEPER OK
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART INITIERING AV QUE/HOLD ALERT OK
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART INITIERING AV MASTER-LOGG OK
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART INITIERING AV MAILTO: OK
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART INITIERING AV MEDDELANDE-KÖER OK
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART INITIERING AV PCS/DATA-KÖER OK
          20010318 22:29:59 -------- ------------ MASTER20 PRGSTART INITIERING AV PRODUKTIONS-LOGG OK
          20010318 22:30:03 -------- ------------ ALERTS   INICHANG Tråden ALERT har uppdaterat sina inställningar
          20010318 22:30:03 -------- ------------ MAILTO   INICHANG Tråden MAILTO har uppdaterat sina inställningar
          20010318 22:30:03 2001-02-08 03:52:10 *WARNING* FIL I QUEDIR \\NTSERVER\CAPELLA\!\QUE\TEST.1GC
          20010318 22:30:03 2001-03-15 20:44:29 *WARNING* FIL I QUEDIR \\NTSERVER\CAPELLA\!\QUE\Capella2.1GD
          20010318 22:30:03 -------- ------------ JOBQUE   INICHANG Tråden JOBQUE har uppdaterat sina inställningar
          20010318 22:30:03 2001-03-15 20:44:31 *WARNING* FIL I QUEDIR \\NTSERVER\CAPELLA\!\QUE\loggar.1GE
          20010318 22:30:03 -------- ------------ PRODLOGG INICHANG Tråden PRODLOGG uppdaterar sina inställningar
          20010318 22:30:03 -------- ------------ PCSQUE   INICHANG Tråden PCSQUE har uppdaterat sina inställningar
          20010318 22:30:03 -------- ------------ GATE20   INICHANG Tråden GATEKEEPER har uppdaterat sina inställningar
          20010318 22:30:03 -------- ------------ SCRIPT20 CHECKDIR Skapar Biblioteks-lista från script
          20010318 22:30:04 -------- ------------ SCRIPT20 CHECKDIR Bibliotek access-kontroll
          20010318 22:30:06 -------- ------------ SCRIPT20 CHECKDIR Script-kontroll accessbara bibliotek
          20010318 22:30:06 -------- ------------ SCRIPT20 CHECKDIR Scriptkontroll avslutad
          20010318 22:30:11          FLY141.BQE   XFPLOG   NY POST  2000-01-25 15:11:15 XFP1 FLY141   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:30:12          FLY141.BQS   XFPLOG   NY POST  2000-01-26 10:33:35 XFP1 FLY141   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:30:13          TDA010.C45   XFPLOG   NY POST  2000-01-26 12:53:06 XFP1 TDA010   0102387  *VARNING* Kan inte finna transaktionen
          20010318 22:30:13          BSP015.C32   XFPLOG   NY POST  2000-01-26 14:30:50 XFP1 BSP015   0102401  *VARNING* Kan inte finna transaktionen
          20010318 22:30:14          BSP016.C35   XFPLOG   NY POST  2000-01-26 16:22:49 XFP1 BSP016   0102402  *VARNING* Kan inte finna transaktionen
          20010318 22:30:15          CAP200.C6U   XFPLOG   NY POST  2000-01-26 16:29:30 XFP1 CAP200   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:30:15          MAG002.C48   XFPLOG   NY POST  2000-01-26 16:45:50 XFP1 MAG002   0102264  *VARNING* Kan inte finna transaktionen
          20010318 22:30:16          MAG002.C4B   XFPLOG   NY POST  2000-01-26 16:54:47 XFP1 MAG002   0102405  *VARNING* Kan inte finna transaktionen
          20010318 22:30:17          MAG002.C4E   XFPLOG   NY POST  2000-01-26 16:55:40 XFP1 MAG002   0102406  *VARNING* Kan inte finna transaktionen
          20010318 22:30:17          TIP009.C6C   XFPLOG   NY POST  2000-01-26 17:01:23 XFP1 TIP009   0102419  *VARNING* Kan inte finna transaktionen
          20010318 22:30:18          TIP009.C6J   XFPLOG   NY POST  2000-01-26 17:02:30 XFP1 TIP009   0102420  *VARNING* Kan inte finna transaktionen
          20010318 22:30:19          BDA008.C6H   XFPLOG   NY POST  2000-01-26 17:12:21 XFP1 BDA008   0102422  *VARNING* Kan inte finna transaktionen
          20010318 22:30:19          FIN310.C3Q   XFPLOG   NY POST  2000-01-26 17:33:54 XFP1 FIN310   0102337  *VARNING* Kan inte finna transaktionen
          20010318 22:30:20          FIN310.C3T   XFPLOG   NY POST  2000-01-26 17:46:29 XFP1 FIN310   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:30:20          ESO018.C4S   XFPLOG   NY POST  2000-01-27 03:52:01 XFP1 ESO028   0102407  *VARNING* Kan inte finna transaktionen
          20010318 22:30:21          ESO028.C4V   XFPLOG   NY POST  2000-01-27 04:06:32 XFP1 ESO028   0102409  *VARNING* Kan inte finna transaktionen
          20010318 22:30:22          ESO034.C4T   XFPLOG   NY POST  2000-01-27 04:13:06 XFP1 ESO034   0102408  *VARNING* Kan inte finna transaktionen
          20010318 22:30:22          ESO020.C53   XFPLOG   NY POST  2000-01-27 04:13:54 XFP1 ESO020   0102410  *VARNING* Kan inte finna transaktionen
          ==
          == CHOPPED OFF
          ==
          20010318 22:37:54          OPC001.EOE   XFPLOG   NY POST  2000-03-21 14:54:24 XFP1 OPC001   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:37:54          BIP511.IG4   XFPLOG   NY POST  2000-03-21 15:20:28 XFP1 BIP511   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:37:55          BIP501.IG6   XFPLOG   NY POST  2000-03-21 15:21:16 XFP1 BIP501   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:37:56          BIP502.IG7   XFPLOG   NY POST  2000-03-21 15:21:56 XFP1 BIP502   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:37:56          BIP512.IG8   XFPLOG   NY POST  2000-03-21 15:22:37 XFP1 BIP512   0000000  *VARNING* Kan inte finna transaktionen
          20010318 22:38:04 -------- ------------ SPIDLOGG PRGSTOPP Tråden LÄS SPIDER-LOGG har avslutats
          ==
          == END OF READING LOGGFILE (GUI in DDT-STYLE)
          ------------------
          Fred
          mailto:[email protected][email protected]</A>
          http://www.oxenby.se

          Fred
          mailto:[email protected][email protected]</A>
          http://www.oxenby.se

          Comment


          • #6
            Fred --
            In SDK you used SendMessage hWnd_Master,%LOG_PROD,ByVal VarPtr(LM),0
            In DDT - If glbCB_Logg <> 0 Then Call DWord glbCB_Logg Using proto_LoggEvent(LM)
            Looks that in SDK you processed a message by another way.

            If I understood correctly, you want to say that performance of ListBox depends of parent (Dialog/SDK).
            Well, Control Send includes additional operation - GetDlgItem - and it's possible to replace it to SendMessage.

            Dialog as it is can work a little slowly than SDK - this can't be an explanation too.
            On my PC (P-III-800, Win2000), even using DDT and Control Send, I can fill some thousands items per 50-100 bytes in second.

            Can you give clean sample ? (Actually, I think that a problem in different processing).

            ------------------
            E-MAIL: [email protected]

            Comment


            • #7
              Code:
              Semen,
              The app is built like this:
              Main Thread: Graphic Interface for the user. Launching worker-Threads every 30:th second
                           or when there is a need for one.
              Work-Thread: DLL, No GUI, reports back via Callback function in Main exe 
              There are actually 8 diffrent Work-Threads started at diffrent time
              -----
              The SendMessage you saw, was a test to see if there were any speed-advantages
              versus callbacks, and my conclusion was that there is no such advantage
              -----
              The problem here are messages from ANOTHER THREAD.
              Whether you use SendMessage or callbacks, Windows makes this "Thread-switching"
              and that seems to be the problem for 'Dialog based' listboxes.
              -----
              Some years ago,with PBDLL50 I saw a similar problem with GUI created with
              PB Dialog-editor and PowerGen
              I use WinLift today, but my customer wants to buy the code, and I
              cannot sell/reveal the WinLift-code 
              I also want to use a Visual designer, and Chris Boss have a nice one
              ------------------
              Fred
              mailto:[email protected][email protected]</A>
              http://www.oxenby.se

              Fred
              mailto:[email protected][email protected]</A>
              http://www.oxenby.se

              Comment


              • #8
                Fred --
                Threads also are not a problem, if they work correctly (with sleeps).
                Can you look percent of CPU usage ?

                ------------------
                E-MAIL: [email protected]

                Comment


                • #9
                  Fred;

                  I am taking a guess here, but it sounds like a message loop problem.

                  If the message loop doesn't get processed regularly, then updates
                  don't occur fast enough. I don't see any DoEvents code in your code.

                  It is possible that with all the threads you have the message loop
                  doesn't get processed often enough to keep up with the redisplay of the
                  controls and there make be a backlog of WM_PAINT messages.

                  You don't have control of DDTs message loop like you do with SDK style
                  code and it is possible you are doing something that bogs down the
                  DDT message loop. I don't see any actual Dialog code (creation of the Dialog
                  and the Dialog procedure), so it is hard to say what may be the cause
                  of your problem.

                  It is important to give windows time to breath, when making extremely
                  fast updates. You may want to turn off the Redraw state and then turn it
                  on periodically (say every 1/10 sec) and do a DoEvents and then turn it
                  off again until the next interval. You are turning the state on and off
                  but the updates may be occuring at such a fast rate, it may be trying to
                  update faster than windows can handle.

                  Another consideration is can the Listbox keep up with the updates.
                  Fast updates also require the Listbox to allocate and deallocate memory
                  in large chunks very quickly.

                  I guess my point is that the bottleneck can be caused by a variety
                  of things and you haven't honed down where the bottle really is. I doubt DDT
                  would be significantly slower than SDK style code. The slightly extra
                  overhead of using the Dialog engine, would only make a small difference
                  IMO (maybe 1% to 5% at most). I really doubt DDT is 1/5 the speed of SDK
                  code in displaying dialogs. Likely you must make sure you don't
                  work against the DDT engine and the message loop may be a likely candidate.



                  ------------------
                  Chris Boss
                  Computer Workshop
                  Developer of "EZGUI"
                  http://cwsof.com
                  http://twitter.com/EZGUIProGuy

                  Comment


                  • #10
                    CPU-usage 1% to 2%
                    occasionally up to 100% (in this case DDT stop working while SDK ticks on
                    a little slower that is)
                    100% is during 1 to 5 seconds while a new thread starts.
                    During this test, I made sure that the 'other' threads had nothing to do
                    That is they kick in and terminates.
                    ---------------
                    In my test I am reading a OEM-loggfile and "my own" loggfile.
                    "my own" loggfile is dumped to a listbox up to 100 messages a time,
                    and that one creates 100% cpu for the duration of filling the listbox
                    so there are 2 "working" threads, as "my own" loggfile is updated constantly

                    ---------------
                    "my own" loggfile is opened for append, and are updated from several
                    diffrent applications on diffrent workstations, and as I said from 8 diffrent
                    threads in this application, and has no problem.
                    ---------------
                    Just to make sure, writing every message to disk was disabled.
                    Then it took 402 secs vesus 485 secs.
                    That is writing to disk is 83 seconds out of total 485.
                    ---------------
                    This confirm the list above where SDK process 33 msg/sec
                    and DDT only 1.00 something msg/sec
                    ---------------
                    My conclusion is rude, Dialogs, no way in multithreaded apps.
                    Please Mr Boss,,,,,




                    ------------------
                    Fred
                    mailto:[email protected][email protected]</A>
                    http://www.oxenby.se

                    Fred
                    mailto:[email protected][email protected]</A>
                    http://www.oxenby.se

                    Comment


                    • #11
                      Chris, Dialog Doevents is not doing any good, unless it is performed in
                      the thread who has created the Dialogs...
                      In my case the main thread are GUI-thread so it sits on the messageloop
                      waiting for messages..
                      In all the threads I use Sleep 0, 20, 50 depending on the situation
                      --
                      GUI-thread has the same priority as other threads, and OS will treat
                      all threads equally. So maintaining the message-loop is no big deal
                      ---
                      Main dialog is Modal, ChildContainers are Modeless
                      ---
                      Listbox is updated one msg at the time as they are 'TimeStamped' and when I
                      have one message, I dont know if there will be more.
                      Redraw is no problem here, I dont care if the listbox freezes, as long as
                      it does not freeze the running thread or application.


                      Code:
                      Function Create_ListBar(ByVal hParent&,ByVal x&,ByVal y&,Capt$)As Long
                      Local hDlg&
                      Local Style&  ,ExStyle&
                      Local frStyle&,frExStyle&
                      Local lbStyle&,lbExStyle&
                      Dim Lb_List(4) As Local String
                          Style& = %WS_CHILD OR %WS_VISIBLE Or %DS_CONTROL
                          ExStyle& = 0
                          frStyle&   =%WS_CHILD OR %WS_VISIBLE OR %BS_GROUPBOX
                          frExStyle& =%WS_EX_TRANSPARENT
                          lbStyle& =%WS_CHILD Or %WS_VISIBLE Or %LBS_NOTIFY Or %LBS_NOINTEGRALHEIGHT Or _
                                    %WS_VSCROLL Or %WS_HSCROLL Or %WS_TABSTOP Or %WS_BORDER 'LBS_WANTKEYBOARDINPUT
                          lbExStyle& = 0 '%WS_EX_CLIENTEDGE
                      '-----------------
                          Dialog New hParent&, "", 0, 0, 440, 200, Style&, ExStyle& TO hDlg&
                          Control Add Frame,   hDlg&,%Frame, Capt$,        0, 0,440,200,frStyle&,frExStyle&
                          Control Add CheckBox,hDlg&,%Scroll,"Scroll off", 7,10, 75, 12 
                          Control Add ListBox, hDlg&,%ListBox,Lb_List(),   5,25,430,170,lbStyle&,lbExStyle& Call CBF_LISTBOX
                        
                          Control Send hDlg&,%Listbox,%LB_SETHORIZONTALEXTENT,1500&,0
                          Control Send hDlg&,%Frame  ,%WM_SETFONT,App_Font&(6), %TRUE
                          Control Send hDlg&,%Scroll ,%WM_SETFONT,App_Font&(6), %TRUE
                          Control Send hDlg&,%ListBox,%WM_SETFONT,App_Font&(6), %TRUE
                          Dialog Set Loc hDlg&, x&, y&
                      '-----------------
                      Local Txt$,i&
                      '    For i& =1 To 25:Txt$ = "Detta är rad " & Format$(i&) & " " & Capt$
                      '     ListBox Add hDlg&,%Listbox,Txt$
                      '    Next
                          Dialog Show ModeLess hDlg& Call dlgProc_List 
                          Dialog Show State hDlg&,%SW_HIDE
                          Function = hDlg&
                      End Function
                           
                      Function WinMain (ByVal hCurInst      As Long, _
                                        ByVal hPrevInst     As Long, _
                                        lpszCmdLine         As Asciiz Ptr, _
                                        ByVal nCmdShow      As Long)As Long
                      Local Count&
                      Local icc As INIT_COMMON_CONTROLSEX
                       'Call SetPriorityClass(GetCurrentProcess(),%HIGH_PRIORITY_CLASS)
                        
                        icc.dwSize= SizeOf(icc)
                        icc.dwIcc = %ICC_WIN95_CLASSES  Or %ICC_BAR_CLASSES
                        InitCommonControlsEx icc
                      '--Initiera CRITICALSECTION----------------------
                        InitializeCriticalSection CS_GateList
                        InitializeCriticalSection CS_ErrorList
                        InitializeCriticalSection CS_JobbList
                        InitializeCriticalSection CS_DtaQList
                        InitializeCriticalSection CS_AlertHoldList
                        InitializeCriticalSection CS_AlertQueList
                        InitializeCriticalSection CS_LoggList
                          
                      Local Style&, ExStyle&
                      '--Main Dialog-----------------------------------
                        Style& = %WS_POPUP Or %WS_CAPTION OR %DS_CENTER 'Or %WS_SYSMENU 'Border
                        ExStyle& = %WS_EX_CONTROLPARENT 'Or %WS_EX_WINDOWEDGE
                        Dialog New %HWND_DESKTOP, "Spider Master", 0, 0,495,255,Style&,ExStyle& To ghForm&
                      '--Add Splash-window-----------------------------
                        Control Add ImageX,ghForm&,99,"SPLASH", 55,35,420,190
                      '--Add Statusbar---------------------------------
                        Add_StatusBar ghForm&,5,240,485,10 
                      '--Add Menyer------------------------------------  
                        Call Create_Menu(ghForm&)
                      '--AlertBar--------------------------------------
                        ghDlg_Alert  = Create_AlertBar(ghForm&,5,35)
                      '--ToolBar---------------------------------------
                        ghDlg_Button = Create_ToolBar(ghForm&,50,0)
                      '--Listboxar-------------------------------------
                        ghDlg_Gate   = Create_ListBar(ghForm&,50,35," Gate-Keeper ")       
                        Dialog Show State ghDlg_Gate,%SW_HIDE
                        ghDlg_Jobb   = Create_ListBar(ghForm&,50,35," Jobb-köer ")       
                        Dialog Show State ghDlg_Jobb,%SW_HIDE
                        ghDlg_DtaQ   = Create_ListBar(ghForm&,50,35," Data-köer ")       
                        Dialog Show State ghDlg_DtaQ,%SW_HIDE
                        ghDlg_AlertQue  = Create_ListBar(ghForm&,50,35," Filer i QUE-DIR ")       
                        Dialog Show State ghDlg_AlertQue,%SW_HIDE
                        ghDlg_AlertHold = Create_ListBar(ghForm&,50,35," Filer i HOLD-DIR ")       
                        Dialog Show State ghDlg_AlertHold,%SW_HIDE
                        ghDlg_ErrList   = Create_ListBar(ghForm&,50,35," Fel-Lista ")       
                        Dialog Show State ghDlg_ErrList,%SW_HIDE
                        ghDlg_Logg   = Create_ListBar(ghForm&,50,35," Master Logg-Fil ")       
                        Dialog Show State ghDlg_Logg,%SW_HIDE
                      '--Inställningar
                        ghDlg_Options   = Create_OptTab(ghForm&,50,35)
                        Dialog Show State ghDlg_Options,%SW_HIDE
                        ghDlg_Trans     = Create_TransTab(ghForm&,50,35)
                        Dialog Show State ghDlg_Trans  ,%SW_HIDE
                      '--Disable Exit---------------------------------
                        Call EnableMenuItem(ghMnuArkiv&,2,%MF_BYPOSITION Or %MF_Grayed)
                        Call EnableMenuItem(ghMnuArkiv&,4,%MF_BYPOSITION Or %MF_Grayed)
                        Menu Draw Bar ghForm&
                        
                      '--Starta klockan-------------------------------
                        StartKlocka  
                      '--Initiera MASTERS Omgivning-------------------
                        If IsFalse Init_Master() Then 
                           
                         GoTo Init_Error
                        End If  
                      '--Initiera DLL-erna----------------------------
                        If IsFalse Init_DllProgram() Then
                                
                         GoTo Init_Error    
                        End If
                      '--Sätt upp 30 sek klocka-----------------------
                        
                        Call EnableMenuItem(ghMnuArkiv&,0,%MF_BYPOSITION Or %MF_Grayed)
                        Call EnableMenuItem(ghMnuArkiv&,2,%MF_BYPOSITION Or %MF_Enabled)
                        Call EnableMenuItem(ghMnuArkiv&,4,%MF_BYPOSITION Or %MF_Enabled)
                      Init_Error:
                        Dialog Show Modal ghForm& Call DlgProc_Form
                            
                        StoppKlocka
                        
                      '--Radera CRITICAL_SECTIONS----------------------
                        DeleteCriticalSection CS_GateList
                        DeleteCriticalSection CS_ErrorList
                        DeleteCriticalSection CS_JobbList
                        DeleteCriticalSection CS_DtaQList
                        DeleteCriticalSection CS_AlertHoldList
                        DeleteCriticalSection CS_AlertQueList
                        DeleteCriticalSection CS_LoggList
                          
                      End Function
                      ------------------
                      Fred
                      mailto:[email protected][email protected]</A>
                      http://www.oxenby.se



                      [This message has been edited by Fred Oxenby (edited March 18, 2001).]
                      Fred
                      mailto:[email protected][email protected]</A>
                      http://www.oxenby.se

                      Comment


                      • #12
                        I have created a test app with a Dialog, a listbox and a button.
                        In DDT using Chris EZGUI-designer
                        Start thread in button-click event. Only one thread
                        It takes exactly the same time to update listbox.
                        7 minutes and some seconds
                        It has to be the Dialog messageloop not performing very well.


                        ------------------
                        Fred
                        mailto:[email protected][email protected]</A>
                        http://www.oxenby.se

                        Fred
                        mailto:[email protected][email protected]</A>
                        http://www.oxenby.se

                        Comment


                        • #13
                          Fred, no offence to Chris and yourself, but my understanding is that EZGUI uses strings to identify controls, etc, so without seeing this code and whether is uses Chris's DLL's functions to update the controls, we can't confirm the facts of your statement.

                          Can you post the code for review too please? Thanks!


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

                          Comment


                          • #14
                            Hi R&D

                            Adding more DDT controls like Dialogs, CommonDlg, Win32...

                            greets
                            Stephane

                            Ps: PowerBasic is very very good and Powerder of VB.
                            Visual Basic is very slow because I don't used only used
                            in school
                            I'm used C++, TASM, Borland Delphi, and PB

                            greets
                            Stephane



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

                            Comment


                            • #15
                              Fred --
                              below is a bad code. But anyway it works very fast on my PC.
                              Except final step - when too many elements, dialog dies.
                              (change n ... To 10000)
                              Code:
                                 #Compile Exe
                                 #Dim All
                                 #Register None
                                 #Include "WIN32API.INC"
                              
                                 %ID_LIST1 = 101
                                 Global hDlg As Long
                              
                                 Function MyThread (ByVal x As Long) As Long
                                    Dim n As Long, Txt As String
                                                    
                                    For n = 1 To 1000
                                       Txt = Str$(100000 - n) + Str$(n) + Str$(x)
                                       ListBox Add hDlg, %ID_LIST1, Txt
                                       Sleep 1
                                    Next
                                    Dialog Send hDlg, %WM_USER + 401, 0, 0
                                    
                                 End Function
                                 CallBack Function DlgProc
                                    Local i As Long, t2 As Dword, t1 As Dword, hList As Long
                                    Select Case CbMsg
                                       Case %WM_INITDIALOG
                                           Local x As Long
                                           Local s As Long
                                           Dim idThread As Long
                                           hList = GetDlgItem(CbHndl, %ID_LIST1)
                                           For i = 1 To 10
                                              Thread Create MyThread(i) To idThread
                                              Thread Close idThread To idThread
                                              Sleep 1
                                           Next
                                       Case %WM_USER + 401
                                          Dim h As Static Long
                                          Incr h: If h = 10 Then MsgBox "Finished"
                                  
                              
                                    End Select
                                 End Function
                              
                                 Function PbMain
                                   Local i As Long
                                   Dialog New 0, "Listbox", , , 200, 100, %WS_CAPTION Or %WS_SYSMENU To hDlg
                                   Control Add ListBox, hDlg, %ID_LIST1, , 5, 5, 190, 65
                                   Dialog Show Modal hDlg, Call DlgProc
                                End Function
                              BTW, if there are many lines, more effective to use ownerdrawn (to avoid HASSTRINGS)

                              Code:
                                             
                                 #Compile Exe
                                 #Dim All
                                 #Register None
                                 #Include "WIN32API.INC"
                              
                              
                                 %ID_LIST1 = 101
                                 %nEl = 10000
                                 Global arr() As String
                              
                                 CallBack Function DlgProc
                                    Local i As Long, t2 As Dword, t1 As Dword, hList As Long
                                    Select Case CbMsg
                                       Case %WM_INITDIALOG
                                          ReDim arr(%nEl - 1)
                                          For i = 0 To %nEl - 1
                                             arr(i) = "Item" + Str$(i) + String$(100, "-")
                                          Next
                              
                                       Case %WM_COMMAND
                                          If CbCtl = 102 Then
                                             t1 = GetTickCount
                                             Control Handle CbHndl, %ID_LIST1 To hList
                                             For i = 0 To %nEl - 1
                                                SendMessage hList, %LB_ADDSTRING, i, 0
                                             Next
                                             SendMessage hList, %LB_SETCURSEL, 3, 0 ' Item 3
                                             t2 = GetTickCount
                                             SetWindowText CbHndl, Str$(t2 - t1)
                                          End If
                              
                                       Case %WM_DRAWITEM
                                          Local lpdis As DRAWITEMSTRUCT Ptr
                                          lpdis = CbLparam
                                          If @lpdis.itemID = &HFFFFFFFF& Then Exit Function
                              
                                          If IsFalse(@lpdis.itemState And %ODS_SELECTED) Then
                                             FillRect @lpdis.hDC, @lpdis.rcItem, GetStockObject(%WHITE_BRUSH)
                                             SetBkColor @lpdis.hDC, %WHITE
                                             SetTextColor @lpdis.hDC, %BLACK
                                          Else
                                             FillRect @lpdis.hDC, @lpdis.rcItem, GetStockObject(%BLACK_BRUSH)
                                             SetBkColor @lpdis.hDC, %BLACK
                                             SetTextColor @lpdis.hDC, %WHITE
                                          End If
                                          TextOut @lpdis.hDC, 0, @lpdis.rcItem.ntop, ByVal StrPtr(arr(@lpdis.itemID)), Len(arr(@lpdis.itemID))
                                          Function = 1: Exit Function
                                    End Select
                                 End Function
                              
                                 Function PbMain
                                   Local hDlg As Long, i As Long, hList As Long
                                   Dialog New 0, "Listbox", , , 200, 100, %WS_CAPTION Or %WS_SYSMENU To hDlg
                                   Control Add ListBox, hDlg, %ID_LIST1, , 5, 5, 190, 65, _
                                      %WS_CHILD Or %LBS_OWNERDRAWFIXED Or _
                                      %WS_TABSTOP Or %LBS_DISABLENOSCROLL Or %WS_VSCROLL, %WS_EX_CLIENTEDGE
                                    Control Add Button, hDlg, 102, "Add", 50, 75, 90, 15
                                   Dialog Show Modal hDlg, Call DlgProc
                                End Function
                              ------------------
                              E-MAIL: [email protected]



                              [This message has been edited by Semen Matusovski (edited March 19, 2001).]

                              Comment


                              • #16
                                Stephane, je bent een onnozel ventje!
                                Ik dacht dat je eindelijk eens een antwoord ging geven op iemand
                                zijn vraag, maar nee, weeral een onnozele vraag waarin je meer en meer
                                features wilt! Ik hoop echt dat ze je van deze forums verwijderen!!
                                Ik heb deze vraag vroeger reeds gesteld aan de administrator van de
                                powerbasic en de ez-gui forums maar ze zijn, gelukkig voor jou, geduldiger
                                dan ikzelf. Ik hoop echt dat dit het laatste is wat ik van je hoor.
                                :-( :-(

                                En trouwens, ik heb je door kerel. Je zit je voor te doen als een
                                programmeur (die alsmaar extra features aangaande oop vraagt) maar in
                                de nederlandstalige nieuwsgroepen zie ik dan postings staan zoals:

                                --
                                Ik zoek de beknopte theorie over het Object Georienteerd programmeren
                                dus eigenlijk de principes en wat het eigenlijk inhoud maar dan wel
                                erg verstaanbaar.
                                Ik weet dat er boeken bestaan maar staat veel te ingewikkeld op
                                --
                                Ik gebruik nog altijd PowerBasic producten maar begin eerst met
                                PowerBasic for DOS compilers v3.50 en wordt een vervolg gegeven jawel
                                en dan met OOP support.
                                (Ah zo, waar heb je dit opgevangen??)
                                --
                                Of wat dacht je van deze uit be.jobs!!!
                                Programmeren van een groot applicatieprogramma en bètatester in
                                PowerBasic (1998-2000)
                                (Beta-tester?????)
                                --


                                En ik kan zo nog een tijdje doorgaan.
                                Ik hoop echt dat je voorgoed 'verdwijnt' :-(
                                Ik ben je gezever KOTSBEU.

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

                                Comment


                                • #17
                                  Originally posted by stephane fonteyne:
                                  Adding more DDT controls like Dialogs, CommonDlg, Win32...
                                  Stephane, this is completely off-topic for this thread - please try to keep discussions within the scope of the topic at hand.

                                  Regarding your "requests", DDT already offers Dialogs, hence it's name (Dynamic Dialog Tools).

                                  Common Dialog functions are already easily available through the encapsulations in the COMDLG32.INC file.

                                  WIN32? I have no idea what you mean by this, since this is a Win32 compiler for 32-bit Windows.



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

                                  Comment


                                  • #18
                                    > BTW, if there are many lines, more effective to use ownerdrawn (to avoid HASSTRINGS)

                                    ..and by far most efficient, of course, is to use raw array with Virtual Listbox..

                                    A small question on "ON ERROR RESUME NEXT": I have been under the impression that
                                    using "IF ERR THEN.." after critical parts in code is a bit faster/leaner and even
                                    a bit "safer". Is it just something I have dreamt? I sometimes tend to mix things up..


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

                                    Comment


                                    • #19
                                      BTW, Lance - I think Stephane refers to some custom controls that
                                      are implemented in Delphi, under a special WIN32-tab. Speed buttons
                                      and Image buttons, etc.

                                      The idea is not bad though. I too would like to see a Winapi32-button
                                      in next PB, which I simply can press to get all api code written for
                                      me, automatically. Or why not even a Code-button, that writes the
                                      whole darn thing by itself..


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

                                      Comment


                                      • #20
                                        Originally posted by Lance Edmonds:
                                        Fred, no offence to Chris and yourself, but my understanding is that EZGUI uses strings to identify controls, etc, so without seeing this code and whether is uses Chris's DLL's functions to update the controls, we can't confirm the facts of your statement.
                                        Can you post the code for review too please? Thanks!
                                        This is the complete test program

                                        Code:
                                        #Compile Exe "EXE\MASTXX.EXE"
                                        #Register None
                                        #Dim All
                                         %NOANIMATE    = 1
                                         %NOBUTTON     = 1
                                         %NOCOMBO      = 1
                                         %NODRAGLIST   = 1
                                         %NOHEADER     = 1
                                         %NOIMAGELIST  = 1
                                         %NOLIST       = 1
                                         %NOLISTVIEW   = 1
                                         %NOSTATUSBAR  = 1
                                         %NOTABCONTROL = 1
                                         %NOTOOLBAR    = 1
                                         %NOTOOLTIPS   = 1
                                         %NOTRACKBAR   = 1
                                         %NOTREEVIEW   = 1
                                         %NOUPDOWN     = 1
                                        #Include "\!INCLUDE\WIN32API\WIN32API.INC"
                                        #Include "\!INCLUDE\WIN32API\COMMCTRL.INC"
                                        #Include "\!INCLUDE\DECLARES\FOXRUN32.INC"
                                        %LISTBOX            = 100
                                        %BUTTON1            = 105
                                        ' --------------------------------------------------
                                        Declare CallBack Function Form1_DLGPROC
                                        Declare CallBack Function CBF_BUTTON1
                                        '--Tråd-Status UDT-s-----------------------------
                                        Global udtProd  As Typ_ThreadStatus
                                        Global hForm1&    ' Dialog handle
                                        
                                        Global gDisk           As String
                                        Global gMasterDir      As String
                                        Global gMasterId       As Long
                                        Global glbAbort        As Long
                                        
                                        Function PbMain
                                        Local Count&
                                        Local CC1 As INIT_COMMON_CONTROLSEX
                                        
                                          CC1.dwSize=SizeOf(CC1)
                                          CC1.dwICC=%ICC_WIN95_CLASSES
                                          InitCommonControlsEX CC1
                                          Local Style&, ExStyle&
                                          Style& = %WS_POPUP Or %DS_MODALFRAME Or %WS_CAPTION Or %WS_MINIMIZEBOX Or %WS_SYSMENU Or %DS_CENTER
                                          ExStyle& = 0
                                          Dialog New %Hwnd_Desktop, "Your Dialog", 0, 0,  448,  177, Style&, ExStyle& To hForm1&
                                        Dim LList(0) As String
                                          Control Add ListBox, hForm1&,  %LISTBOX, LList(), 0, 2, 448, 150, _
                                            %WS_CHILD Or %WS_VISIBLE Or %LBS_NOTIFY Or %LBS_SORT Or %LBS_NOINTEGRALHEIGHT Or %WS_VSCROLL Or %WS_TABSTOP, _
                                            %WS_EX_CLIENTEDGE
                                          Control Send hForm1&,  %LISTBOX, %WM_SETFONT,GetStockObject(%ANSI_FIXED_FONT), %TRUE
                                          Control Add "Button", hForm1&,  %BUTTON1,  "Button  1", 176, 158, 53, 15, _
                                            %WS_CHILD Or %WS_VISIBLE Or %BS_PUSHBUTTON Or %WS_TABSTOP Call CBF_BUTTON1
                                        
                                          Call RUNTIME_INIT(20,"\\NTSERVER\DATA\SPIDER\MASTER20")
                                          Dialog Show Modeless hForm1& , Call Form1_DLGPROC
                                          Do
                                            Dialog DoEvents To Count&
                                          Loop Until Count&=0
                                        End Function
                                        
                                        CallBack Function Form1_DLGPROC
                                          Select Case CbMsg
                                            ' Common Windows Messages you may want to process
                                            ' -----------------------------------------------
                                            Case %WM_TIMER
                                            Case %WM_HSCROLL
                                            Case %WM_VSCROLL
                                            Case %WM_SIZE
                                            Case %WM_CLOSE
                                            Case %WM_DESTROY
                                            Case %WM_SYSCOMMAND
                                            Case %WM_PAINT
                                            ' -----------------------------------------------
                                            Case %WM_CTLCOLORMSGBOX , %WM_CTLCOLORBTN, %WM_CTLCOLOREDIT,_
                                                 %WM_CTLCOLORSTATIC, %WM_CTLCOLORSCROLLBAR, %WM_CTLCOLORLISTBOX
                                              ' Control colors
                                              Select Case GetDlgCtrlID(CbLparam)
                                                Case Else
                                                  Function=0
                                              End Select
                                            Case %WM_NOTIFY
                                            Case %WM_COMMAND
                                            Case Else
                                          End Select
                                        End Function
                                        
                                        CallBack Function CBF_BUTTON1
                                        Local ThreadId&,Test&,Retry&
                                        If CbCtlMsg=%BN_CLICKED Then
                                        '--PROD-----------------
                                          If udtProd.Running = 0 Then
                                           udtProd.Id          = 0
                                           udtProd.Running     = 0
                                           udtProd.ExitCode    = 0
                                           udtProd.CBLogg      = CodePtr(MAST_LoggEvent)
                                           udtProd.CBMaster    = CodePtr(MAST_LoggEvent)
                                           udtProd.CBError     = CodePtr(MAST_LoggEvent)
                                           udtProd.CBAlertHold = 0
                                           udtProd.CBAlertQue  = 0
                                           udtProd.hWndMaster  = hForm1&
                                           udtProd.CBStatus    = 0 'CodePtr(SetIndicator)
                                           Thread Create Prodscan(VarPtr(udtProd)) To ThreadId&
                                          End If
                                        End If
                                        End Function
                                        
                                        Function MAST_LoggEvent(LM As LogMsg_Typ) As Long
                                        Local Datum$,Msg$,UtMsg$,ListCount&,Li&,chkStatus&
                                        Local Nu As Double
                                          On Error Resume Next
                                          Nu = Now()
                                          Msg$ = Space$(SizeOf(LM))
                                          Lset Msg$ = LM
                                          Replace Chr$(0) With Chr$(32) In Msg$
                                          Msg$ = Rtrim$(Msg$)
                                        '--Formattera meddelandet------------------------
                                          Datum$ = FormatDateTime(Nu,"YYMMDD HH:MM:SS")
                                          UtMsg$ = Datum$ & " " & Msg$
                                          'EnterCriticalSection CS_GateList
                                        '--radera i listan om mer än 10,000 meddelanden--
                                          Control Send hForm1&,%Listbox,%LB_GETCOUNT,0,0 To ListCount&
                                          If ListCount& > 10000 Then
                                           Control Send hForm1&,%Listbox,%WM_SETREDRAW,0&,0&
                                           For Li& = 1 To 1000
                                            Control Send hForm1&,%Listbox,%LB_DELETESTRING, 0, 0
                                           Next
                                           Control Send hForm1&,%Listbox,%WM_SETREDRAW,1&,0&
                                          End If
                                        '--lägg ut meddelandet i listan-------------------
                                          Control Send hForm1&,%Listbox,%LB_ADDSTRING,0,StrPtr(UtMsg$) To ListCount&
                                          Control Send hForm1&,%Listbox,%LB_SETCURSEL , ListCount&, 0 To Li&
                                        '--så skall det ut till loggfilen-----------------
                                          Datum$ = FormatDateTime(Nu,"YYYYMMDD HH:MM:SS")
                                          UtMsg$ = Datum$ & " " & Msg$
                                          Call LOG_MasterLogg(Msg$)
                                        End Function
                                        
                                        Type XfpMsg_Typ
                                         Datum    As String * 11
                                         Tid      As String * 9
                                         DxId     As String * 5
                                         Rutin    As String * 9
                                         OrderNr  As String * 9
                                        End Type 
                                        Global ClrXM As XfpMsg_Typ
                                         
                                        Type XfpRadTyp
                                         Tid       as string * 9      ' 1,9
                                         Datum     as string * 11     '10,11
                                         Rutin     as string * 7      '21,7
                                         x1        as string * 2      '28,2
                                         DxOrginal as string * 7      '30,7
                                         DxPages   as string * 9      '37,9
                                         Unknown   as string * 9      '46,9
                                         DxCopies  as string * 6      '55,6
                                         x2        as string * 4      '61,4
                                         DxId      as string * 5      '65,5
                                         DxMag     as string * 4      '70,4
                                         x3        as string * 25     '74,25
                                         DxFil     as string * 15     '99,15
                                         DxOrder   as string * 8      '114,8
                                         x4        as string * 8      '122,8
                                        End type                      '
                                        Declare Function proto_loggevent(LM As logMsg_Typ)As Long
                                        
                                        Function XFP_ReadLogg(ByVal Fil$,udt&) As Long
                                        Dim dbLog  As LogInfo
                                        Local yy%,mm%,dd%,hh%,mi%,ss%
                                        Local FilNr&,InRad$,Sync$
                                        Local glbCB_Logg As DWord  
                                        Local pUdt As Typ_ThreadStatus Ptr
                                          pUdt = udt&
                                          glbCB_Logg = @pudt.CBLogg
                                        
                                        '..Öppna filen i Binary mode.........................................
                                           On Error Resume Next
                                           If FSO_FileExists(Fil$) = 0 Then Function = 100: GoTo ErrExit
                                           FilNr& = GetFreeFile
                                           ErrClear:Open Fil$ For Binary Access Read Shared As FilNr&
                                           If ErrClear > 0 Then Function = 100: GoTo ErrExit
                                        '..Läs in filens sync................................................
                                           dbLog.FilNamn = Fil$
                                           ErrClear:Get FilNr&,1, dbLog.Sync
                                           If ErrClear > 0 Then Close FilNr&: Function = 101: GoTo ErrExit
                                           Close FilNr&
                                        '..Hämta Logginfo-posten.............................................
                                           If DBLOG_GetInfo(Fil$, ByCopy dbLog.Sync, dbLog) = %False Then Function = 102: GoTo ErrExit
                                        '..Öppna filen i Shared mode.........................................
                                           ErrClear:Open Fil$ For Input Lock Shared As FilNr& 
                                           If ErrClear > 0 Then Function = 100: GoTo ErrExit
                                           If dbLog.FilePos >= Lof(FilNr&) Then Close FilNr&: Function = %True: GoTo ErrExit
                                        '..Gå till sista läsposition.........................................
                                           ErrClear:Seek FilNr&, dbLog.FilePos
                                        '..loopa genom filen till slutet.....................................
                                        Local XR As XfpRadTyp
                                           Do While Not Eof(FilNr&)
                                            Sleep 0
                                            If glbAbort <> 0 Then
                                             Call DBLOG_SaveInfo(dbLog)
                                             Close FilNr&:Function = 200:Exit Function
                                            End If
                                            ErrClear:Line Input #FilNr&,InRad$
                                            If ErrClear > 0 Then Close FilNr&: Function = 101: GoTo ErrExit
                                            dbLog.FilePos = Seek(FilNr&)
                                            LSet XR = UCase$(InRad$)
                                            If Instr(XR.DxFil, "OFFLINE") > 0 Then Iterate Do
                                            If (Instr(XR.DxMag, "X")> 0) And _
                                               (Len(RTrim$(XR.DxFil,any Chr$(0,32)))> 0) Then GoSub NyttXFPEntry
                                           Loop
                                        '..Filslut så uppdatera FilPos och stäng filen.......................
                                           ErrClear:dbLog.FilePos = Seek(FilNr&)
                                           Call DBLOG_SaveInfo(dbLog)
                                           Close FilNr&
                                           Function = 0
                                        ErrExit:
                                           Exit Function
                                        
                                        '--SUBRUTIN----------------------------------------------------------
                                        NyttXFPEntry:
                                           Replace any "./-" With "---" In XR.Datum
                                           Replace any "./-" With ":::" In XR.Tid
                                        '--LoggDatum-------------------------------------
                                            yy% = Val(Parse$(XR.Datum,"-",1))
                                            mm% = Val(Parse$(XR.Datum,"-",2))
                                            dd% = Val(Parse$(XR.Datum,"-",3))
                                            dbLog.LogDate = VbDateSerial(yy%,mm%,dd%)
                                        '--LoggTid---------------------------------------
                                            hh% = Val(Parse$(XR.Tid,":",1))
                                            mi% = Val(Parse$(XR.Tid,":",2))
                                            ss% = Val(Parse$(XR.Tid,":",3))
                                            dbLog.LogTime = VbTimeSerial(hh%,mi%,ss%)
                                        '--Spara entryt----------------------------------
                                           Call DBLOG_SaveInfo(dbLog)
                                        '--hämta transaktionen---------------------------
                                        Dim T As UtCmdTyp
                                        Local LM As LogMsg_Typ,XM As XfpMsg_Typ
                                        Local TransNr$,TransIdx$
                                           LSet LM = Space$(400)
                                           LSet XM = Space$(400)
                                           TransNr$ = Trim$(XR.DxFil,any Chr$(0,32))
                                           TransIdx$ = TransNr$
                                           LM.Modul = "XFPLOG"
                                           LM.Funktion = "NY POST"
                                           LM.FilNamn = TransIdx$
                                           XM.Datum   = RTrim$(XR.Datum,any Chr$(0,32))
                                           XM.Tid     = RTrim$(XR.Tid,any Chr$(0,32))
                                           XM.DxId    = RTrim$(XR.DxId,any Chr$(0,32))
                                           XM.Rutin   = RTrim$(XR.Rutin,any Chr$(0,32))
                                           XM.OrderNr = Format$(Val(XR.DxOrder),"0000000")
                                           
                                           If IsFalse TRANS_GetRecord(TransNr$,T) Then
                                            If IsFalse TRANS_FindTrans(TransIdx$,T) Then
                                             LSet LM.Text = XM & "*VARNING* Kan inte finna transaktionen"
                                        'SendMessage hWnd_Master,%LOG_PROD,ByVal VarPtr(LM),0
                                             If glbCB_Logg <> 0 Then Call DWord glbCB_Logg Using proto_LoggEvent(LM)
                                             Return
                                            End If
                                           End If
                                        '--Skapa index-----------------------------------
                                        Local Tidx As TransIdxTyp,Tmp$
                                           TransNr$ = RTrim$(T.TransNr,any Chr$(0,32))
                                           TIdx.TransNr = T.TransNr
                                           TIdx.FilNamn = T.FilNamn
                                        '--skapa meddelande------------------------------
                                           LM.Funktion = "NY POST "
                                           LM.TransNr = TransNr$
                                           Tmp$ = FSO_GetBaseName(RTrim$(T.InFil,any Chr$(0,32)))
                                           If Len(Tmp$) > 8 Then Tmp$ = Mid$(Tmp$,1,8)
                                           Tmp$ = Tmp$ & "." & FSO_GetExtensionName(RTrim$(T.InFil,any Chr$(0,32)))
                                           LM.FilNamn = Tmp$
                                        '--Uppdatera transaktionen------------------------
                                           T.ProdDatum = dbLog.LogDate
                                           T.ProdTid   = dbLog.LogTime
                                           T.PrintId   = XR.DxId
                                           If Val(XR.DxOrder) > 0 Then T.OrderNr = Val(XR.DxOrder)
                                           T.DXRutin   = XR.Rutin
                                           T.DXOrginal = Val(XR.DXOrginal)
                                           T.DXPages   = Val(XR.DXPages)
                                           T.DXCopies  = Val(XR.DXCopies)
                                        '--Uppdatera transaktionen------------------------
                                           If IsFalse TRANS_UpDateRecord(T) Then
                                            LSet LM.Text  = XM & " *ERROR* Kan inte uppdatera transaktionen"
                                        'SendMessage hWnd_Master,%LOG_PROD,ByVal VarPtr(LM),0
                                            If glbCB_Logg <> 0 Then Call DWord glbCB_Logg Using proto_LoggEvent(LM)
                                            Return
                                           End If
                                        '--Alles Ok skapa JobMsg-------------------------
                                           Call MSG_PCSTvaPost(TransNr$,TIdx)
                                           LSet LM.Text = XM
                                        'SendMessage hWnd_Master,%LOG_PROD,ByVal VarPtr(LM),0
                                           If glbCB_Logg <> 0 Then Call DWord glbCB_Logg Using proto_LoggEvent(LM)
                                           Return
                                        End Function
                                        
                                        
                                        Function PRODSCAN(ByVal udt&)As Long
                                        Local LM As LogMsg_Typ
                                        Local CB_Master As Dword
                                        Local pUdt As Typ_ThreadStatus Ptr
                                          pUdt = udt&
                                          @pudt.ID      = GetCurrentThreadId
                                          @pudt.Running = 1
                                          CB_Master    = @pudt.CBMaster
                                          LM.TransNr  = "--------"
                                          LM.FilNamn  = "------------"
                                          LM.Modul    = "PRODLOGG"
                                          LM.Funktion = "PRGSTART"
                                          LM.Text     = "Tråden PRODUKTIONS-LOGGAR startar "
                                          If CB_Master <> 0 Then Call Dword CB_Master Using proto_Loggevent(LM)
                                          Call Xfp_ReadLogg("\\NTSERVER\DATA\XFPLOG\PRODXFP1.LOG",udt&)
                                            LM.TransNr  = "--------"
                                            LM.FilNamn  = "------------"
                                            LM.Modul    = "PRODLOGG"
                                            LM.Funktion = "PRGSTOPP"
                                            LM.Text     = "Tråden PRODUKTIONS-LOGGAR har avslutats "
                                            If CB_Master <> 0 Then Call Dword CB_Master Using proto_Loggevent(LM)
                                          @pudt.Running = 0
                                        End Function
                                        ------------------
                                        Fred
                                        mailto:[email protected][email protected]</A>
                                        http://www.oxenby.se

                                        Fred
                                        mailto:[email protected][email protected]</A>
                                        http://www.oxenby.se

                                        Comment

                                        Working...
                                        X