Alessandro, dê uma olhada nesse exemplo que estou enviando. Nele você executa um processo e pode clicar no botão cancela para interromper o processo.
Não faço uso de SAM_Timer somente SalYieldStartMessages e SalYieldStopMessages.
Espero que esse exemplo seja mais ou menos o que você pretende fazer.
Boa sorte.
> Acha que não Humberto, quando eu tenho por exemplo um SAM_TIMER que chama um
> determinado processo e neste processo tem um while por exemplo, ele só
> acionara novamente o SAM_Timer qdo terminar o primeiro processo...
>
>
>
> Fiz um exemplo simples Onde um SAM_timer chapa uma Função de classe que cria
> uma segunda classe onde tem o processo que pretendo executar varias vezes...
> ele abre um form e inicia um while... note que ele só inicia o próximo qdo
> termina o primeiro...
>
>
>
>
>
>
>
> _____
>
> De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Em nome
> de Humberto
> Enviada em: quarta-feira, 5 de abril de 2006 21:28
> Para: sqlwin
> Assunto: Re:[sqlwin] Threads
>
>
>
> Alessandro, para você poder executar mais de um processo ao mesmo tempo, ou
> se quiser poder interromper um while, por exemplo, no Centura existem as
> funções SalYield****. O Help do Centura tem alguns exemplos simples de como
> usar.
>
>
>
> Se tiver alguma dificuldade em usar essas funções, posso te enviar um
> programinha de exemplo.
>
>
>
> Boa sorte,
>
>
>
> Humberto.
>
>
>
> > Pessoal, bom dia !!!
>
> >
>
> >
>
> >
>
> > Alguém poderia me dar algumas informações de como eu poderia aplicar os
>
> > conceitos de threads no sqlwindows ?
>
> >
>
> >
>
> >
>
> > Utilizo o Centura 1.5 e 2000
>
> >
>
> >
>
> >
>
> > Obrigado,
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> Humberto Padua Domingues
>
>
Humberto Padua Domingues
.head 0 + Application Description: Centura SQLWindows Standard Application Template .head 1 - Outline Version - 4.0.32 .head 1 + Design-time Settings .data VIEWINFO 0000: 6F00000001000000 FFFF01000D004347 5458566965775374 6174650400010000 0020: 0000000000A80000 002C000000020000 0003000000FFFFFF FFFFFFFFFFFCFFFF 0040: FFE9FFFFFFFFFFFF FF000000007C0200 004D010000010000 0001000000010000 0060: 000F4170706C6963 6174696F6E497465 6D00000000 .enddata .head 2 - Outline Window State: Normal .head 2 + Outline Window Location and Size .data VIEWINFO 0000: 6600040003002D00 0000000000000000 0000B71E5D0E0500 1D00FFFF4D61696E 0020: 0000000000000000 0000000000000000 0000003B00010000 00000000000000E9 0040: 1E800A00008600FF FF496E7465726E61 6C2046756E637469 6F6E730000000000 0060: 0000000000000000 0000000000003200 0100000000000000 0000E91E800A0000 0080: DF00FFFF56617269 61626C6573000000 0000000000000000 0000000000000000 00A0: 3000010000000000 00000000F51E100D 0000F400FFFF436C 6173736573000000 00C0: 0000000000000000 0000000000000000 .enddata .data VIEWSIZE 0000: D000 .enddata .head 3 - Left: -0.013" .head 3 - Top: 0.0" .head 3 - Width: 8.013" .head 3 - Height: 4.969" .head 2 + Options Box Location .data VIEWINFO 0000: D4180909B80B1A00 .enddata .data VIEWSIZE 0000: 0800 .enddata .head 3 - Visible? Yes .head 3 - Left: 4.15" .head 3 - Top: 1.885" .head 3 - Width: 3.8" .head 3 - Height: 2.073" .head 2 + Class Editor Location .head 3 - Visible? No .head 3 - Left: 0.575" .head 3 - Top: 0.094" .head 3 - Width: 5.063" .head 3 - Height: 2.719" .head 2 + Tool Palette Location .head 3 - Visible? No .head 3 - Left: 6.388" .head 3 - Top: 0.729" .head 2 - Fully Qualified External References? Yes .head 2 - Reject Multiple Window Instances? No .head 2 - Enable Runtime Checks Of External References? Yes .head 2 - Use Release 4.0 Scope Rules? No .head 1 - Libraries .head 1 + Global Declarations .head 2 + Window Defaults .head 3 + Tool Bar .head 4 - Display Style? Etched .head 4 - Font Name: MS Sans Serif .head 4 - Font Size: 8 .head 4 - Font Enhancement: System Default .head 4 - Text Color: System Default .head 4 - Background Color: System Default .head 3 + Form Window .head 4 - Display Style? Etched .head 4 - Font Name: MS Sans Serif .head 4 - Font Size: 8 .head 4 - Font Enhancement: System Default .head 4 - Text Color: System Default .head 4 - Background Color: System Default .head 3 + Dialog Box .head 4 - Display Style? Etched .head 4 - Font Name: MS Sans Serif .head 4 - Font Size: 8 .head 4 - Font Enhancement: System Default .head 4 - Text Color: System Default .head 4 - Background Color: System Default .head 3 + Top Level Table Window .head 4 - Font Name: MS Sans Serif .head 4 - Font Size: 8 .head 4 - Font Enhancement: System Default .head 4 - Text Color: System Default .head 4 - Background Color: System Default .head 3 + Data Field .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Multiline Field .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Spin Field .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Background Text .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Pushbutton .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 3 + Radio Button .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Check Box .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Option Button .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 3 + Group Box .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Child Table Window .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + List Box .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Combo Box .head 4 - Font Name: Use Parent .head 4 - Font Size: Use Parent .head 4 - Font Enhancement: Use Parent .head 4 - Text Color: Use Parent .head 4 - Background Color: Use Parent .head 3 + Line .head 4 - Line Color: Use Parent .head 3 + Frame .head 4 - Border Color: Use Parent .head 4 - Background Color: 3D Face Color .head 3 + Picture .head 4 - Border Color: Use Parent .head 4 - Background Color: Use Parent .head 2 + Formats .head 3 - Number: 0'%' .head 3 - Number: #0 .head 3 - Number: ###000 .head 3 - Number: ###000;'($'###000')' .head 3 - Date/Time: hh:mm:ss AMPM .head 3 - Date/Time: M/d/yy .head 3 - Date/Time: MM-dd-yy .head 3 - Date/Time: dd-MMM-yyyy .head 3 - Date/Time: MMM d, yyyy .head 3 - Date/Time: MMM d, yyyy hh:mm AMPM .head 3 - Date/Time: MMMM d, yyyy hh:mm AMPM .head 2 - External Functions .head 2 + Constants .data CCDATA 0000: 3000000000000000 0000000000000000 00000000 .enddata .data CCSIZE 0000: 1400 .enddata .head 3 - System .head 3 - User .head 3 - Enumerations .head 2 - Resources .head 2 - Variables .head 2 - Internal Functions .head 2 - Named Menus .head 2 + Class Definitions .head 3 + Functional Class: C_PROCESSAMENTO .head 4 - Description: .head 4 - Derived From .head 4 - Class Variables .head 4 + Instance Variables .head 5 - Window Handle: hWndNewForm .head 4 + Functions .head 5 + Function: Calculo .head 6 - Description: .head 6 - Returns .head 6 - Parameters .head 6 - Static Variables .head 6 + Local variables .head 7 - Number: I .head 6 + Actions .head 7 - Set hWndNewForm = SalCreateWindow( frm1, hWndMDI ) .head 7 + While I <= 100000 .head 8 - Set hWndNewForm.df1 = I .head 8 - Set I = I + 1 .head 3 + Functional Class: C_SERIALIZADOR .head 4 - Description: .head 4 - Derived From .head 4 - Class Variables .head 4 - Instance Variables .head 4 + Functions .head 5 + Function: New .head 6 - Description: .head 6 - Returns .head 6 - Parameters .head 6 - Static Variables .head 6 + Local variables .head 7 - FunctionalVar: NewProcess .head 8 - Class: C_PROCESSAMENTO .head 6 + Actions .head 7 - Call NewProcess.Calculo() .head 2 + Default Classes .head 3 - MDI Window: cBaseMDI .head 3 - Form Window: .head 3 - Dialog Box: .head 3 - Table Window: .head 3 - Quest Window: .head 3 - Data Field: .head 3 - Spin Field: .head 3 - Multiline Field: .head 3 - Pushbutton: .head 3 - Radio Button: .head 3 - Option Button: .head 3 - Check Box: .head 3 - Child Table: .head 3 - Quest Child Window: cQuickDatabase .head 3 - List Box: .head 3 - Combo Box: .head 3 - Picture: .head 3 - Vertical Scroll Bar: .head 3 - Horizontal Scroll Bar: .head 3 - Column: .head 3 - Background Text: .head 3 - Group Box: .head 3 - Line: .head 3 - Frame: .head 3 - Custom Control: .head 3 - ActiveX: .head 2 - Application Actions .head 1 + Form Window: frm1 .head 2 - Class: .head 2 - Property Template: .head 2 - Class DLL Name: .head 2 - Title: .head 2 - Icon File: .head 2 - Accessories Enabled? No .head 2 - Visible? Yes .head 2 - Display Settings .head 3 - Display Style? Default .head 3 - Visible at Design time? Yes .head 3 - Automatically Created at Runtime? Yes .head 3 - Initial State: Normal .head 3 - Maximizable? Yes .head 3 - Minimizable? Yes .head 3 - Allow Child Docking? No .head 3 - Docking Orientation: All .head 3 - System Menu? Yes .head 3 - Resizable? Yes .head 3 - Window Location and Size .head 4 - Left: Default .head 4 - Top: Default .head 4 - Width: 6.083" .head 4 - Width Editable? Yes .head 4 - Height: 2.131" .head 4 - Height Editable? Yes .head 3 - Form Size .head 4 - Width: Default .head 4 - Height: Default .head 4 - Number of Pages: Dynamic .head 3 - Font Name: Default .head 3 - Font Size: Default .head 3 - Font Enhancement: Default .head 3 - Text Color: Default .head 3 - Background Color: Default .head 2 - Description: .head 2 - Named Menus .head 2 - Menu .head 2 + Tool Bar .head 3 - Display Settings .head 4 - Display Style? Default .head 4 - Location? Top .head 4 - Visible? Yes .head 4 - Size: Default .head 4 - Size Editable? Yes .head 4 - Docking Toolbar? No .head 4 - Toolbar Docking Orientation: Top | Bottom .head 4 - Font Name: Default .head 4 - Font Size: Default .head 4 - Font Enhancement: Default .head 4 - Text Color: Default .head 4 - Background Color: Default .head 4 - Resizable? No .head 3 - Contents .head 2 + Contents .head 3 + Data Field: df1 .head 4 - Class Child Ref Key: 0 .head 4 - Class ChildKey: 0 .head 4 - Class: .head 4 - Property Template: .head 4 - Class DLL Name: .head 4 - Data .head 5 - Maximum Data Length: Default .head 5 - Data Type: Number .head 5 - Editable? Yes .head 4 - Display Settings .head 5 - Window Location and Size .head 6 - Left: 0.583" .head 6 - Top: 0.452" .head 6 - Width: 1.2" .head 6 - Width Editable? Yes .head 6 - Height: 0.25" .head 6 - Height Editable? Yes .head 5 - Visible? Yes .head 5 - Border? Yes .head 5 - Justify: Left .head 5 - Format: Unformatted .head 5 - Country: Default .head 5 - Font Name: Default .head 5 - Font Size: Default .head 5 - Font Enhancement: Default .head 5 - Text Color: Default .head 5 - Background Color: Default .head 5 - Input Mask: Unformatted .head 4 - Message Actions .head 3 + Data Field: df2 .head 4 - Class Child Ref Key: 0 .head 4 - Class ChildKey: 0 .head 4 - Class: .head 4 - Property Template: .head 4 - Class DLL Name: .head 4 - Data .head 5 - Maximum Data Length: Default .head 5 - Data Type: Number .head 5 - Editable? Yes .head 4 - Display Settings .head 5 - Window Location and Size .head 6 - Left: 2.883" .head 6 - Top: 0.488" .head 6 - Width: 1.2" .head 6 - Width Editable? Yes .head 6 - Height: 0.25" .head 6 - Height Editable? Yes .head 5 - Visible? Yes .head 5 - Border? Yes .head 5 - Justify: Left .head 5 - Format: Unformatted .head 5 - Country: Default .head 5 - Font Name: Default .head 5 - Font Size: Default .head 5 - Font Enhancement: Default .head 5 - Text Color: Default .head 5 - Background Color: Default .head 5 - Input Mask: Unformatted .head 4 - Message Actions .head 3 + Pushbutton: pbExecuta1 .head 4 - Class Child Ref Key: 0 .head 4 - Class ChildKey: 0 .head 4 - Class: .head 4 - Property Template: .head 4 - Class DLL Name: .head 4 - Title: Executa 1 .head 4 - Window Location and Size .head 5 - Left: 0.583" .head 5 - Top: 0.75" .head 5 - Width: 1.2" .head 5 - Width Editable? Yes .head 5 - Height: 0.298" .head 5 - Height Editable? Yes .head 4 - Visible? Yes .head 4 - Keyboard Accelerator: (none) .head 4 - Font Name: Default .head 4 - Font Size: Default .head 4 - Font Enhancement: Default .head 4 - Picture File Name: .head 4 - Picture Transparent Color: None .head 4 - Image Style: Single .head 4 - Text Color: Default .head 4 - Background Color: Default .head 4 - Button Appearance: Standard .head 4 + Message Actions .head 5 + On SAM_Click .head 6 - Set bCancela1 = FALSE .head 6 + While bCancela1 = FALSE and df1 < 100000 .head 7 - Set df1 = df1 + 1 .head 3 + Pushbutton: pbCancela1 .head 4 - Class Child Ref Key: 0 .head 4 - Class ChildKey: 0 .head 4 - Class: .head 4 - Property Template: .head 4 - Class DLL Name: .head 4 - Title: Cancela 1 .head 4 - Window Location and Size .head 5 - Left: 0.583" .head 5 - Top: 1.083" .head 5 - Width: 1.2" .head 5 - Width Editable? Yes .head 5 - Height: 0.298" .head 5 - Height Editable? Yes .head 4 - Visible? Yes .head 4 - Keyboard Accelerator: (none) .head 4 - Font Name: Default .head 4 - Font Size: Default .head 4 - Font Enhancement: Default .head 4 - Picture File Name: .head 4 - Picture Transparent Color: None .head 4 - Image Style: Single .head 4 - Text Color: Default .head 4 - Background Color: Default .head 4 - Button Appearance: Standard .head 4 + Message Actions .head 5 + On SAM_Click .head 6 - Set bCancela1 = TRUE .head 3 + Pushbutton: pbExecuta2 .head 4 - Class Child Ref Key: 0 .head 4 - Class ChildKey: 0 .head 4 - Class: .head 4 - Property Template: .head 4 - Class DLL Name: .head 4 - Title: Executa 2 .head 4 - Window Location and Size .head 5 - Left: 2.883" .head 5 - Top: 0.786" .head 5 - Width: 1.2" .head 5 - Width Editable? Yes .head 5 - Height: 0.298" .head 5 - Height Editable? Yes .head 4 - Visible? Yes .head 4 - Keyboard Accelerator: (none) .head 4 - Font Name: Default .head 4 - Font Size: Default .head 4 - Font Enhancement: Default .head 4 - Picture File Name: .head 4 - Picture Transparent Color: None .head 4 - Image Style: Single .head 4 - Text Color: Default .head 4 - Background Color: Default .head 4 - Button Appearance: Standard .head 4 + Message Actions .head 5 + On SAM_Click .head 6 - Set bCancela2 = FALSE .head 6 + While bCancela2 = FALSE and df2 < 100000 .head 7 - Set df2 = df2 + 1 .head 3 + Pushbutton: pbCancela2 .head 4 - Class Child Ref Key: 0 .head 4 - Class ChildKey: 0 .head 4 - Class: .head 4 - Property Template: .head 4 - Class DLL Name: .head 4 - Title: Cancela 2 .head 4 - Window Location and Size .head 5 - Left: 2.883" .head 5 - Top: 1.119" .head 5 - Width: 1.2" .head 5 - Width Editable? Yes .head 5 - Height: 0.298" .head 5 - Height Editable? Yes .head 4 - Visible? Yes .head 4 - Keyboard Accelerator: (none) .head 4 - Font Name: Default .head 4 - Font Size: Default .head 4 - Font Enhancement: Default .head 4 - Picture File Name: .head 4 - Picture Transparent Color: None .head 4 - Image Style: Single .head 4 - Text Color: Default .head 4 - Background Color: Default .head 4 - Button Appearance: Standard .head 4 + Message Actions .head 5 + On SAM_Click .head 6 - Set bCancela2 = TRUE .head 2 - Functions .head 2 - Window Parameters .head 2 + Window Variables .head 3 - Boolean: bCancela1 .head 3 - Boolean: bCancela2 .head 2 + Message Actions .head 3 + On SAM_Create .head 4 - Set df1 = 0 .head 4 - Set df2 = 0 .head 4 - Call SalYieldStartMessages ( frm1 ) .head 3 + On SAM_Destroy .head 4 - Call SalYieldStopMessages ( ) .head 1 + MDI Window: mdi1 .head 2 - Class: .head 2 - Property Template: .head 2 - Class DLL Name: .head 2 - Title: .head 2 - Display Settings .head 3 - Visible at Design time? Yes .head 3 - Automatically Created at Runtime? Yes .head 3 - Initial State: Normal .head 3 - Maximizable? Yes .head 3 - Minimizable? Yes .head 3 - System Menu? Yes .head 3 - Resizable? Yes .head 3 - Window Location and Size .head 4 - Left: Default .head 4 - Top: Default .head 4 - Width: 9.6" .head 4 - Width Editable? Yes .head 4 - Height: 5.521" .head 4 - Height Editable? Yes .head 3 - Allow Child Docking? No .head 3 - Docking Orientation: All .head 2 - Icon File: .head 2 - Accessories Enabled? Yes .head 2 - Visible? Yes .head 2 - Description: .head 2 - Named Menus .head 2 - Menu .head 2 + Tool Bar .head 3 - Display Settings .head 4 - Display Style? Default .head 4 - Location? Top .head 4 - Visible? Yes .head 4 - Size: 0.726" .head 4 - Size Editable? Yes .head 4 - Docking Toolbar? No .head 4 - Toolbar Docking Orientation: Top | Bottom .head 4 - Font Name: Default .head 4 - Font Size: Default .head 4 - Font Enhancement: Default .head 4 - Text Color: Default .head 4 - Background Color: Default .head 4 - Resizable? No .head 3 + Contents .head 4 + Pushbutton: pb1 .head 5 - Class Child Ref Key: 0 .head 5 - Class ChildKey: 0 .head 5 - Class: .head 5 - Property Template: .head 5 - Class DLL Name: .head 5 - Title: Iniciar .head 5 - Window Location and Size .head 6 - Left: 0.083" .head 6 - Top: 0.06" .head 6 - Width: 2.05" .head 6 - Width Editable? Yes .head 6 - Height: 0.5" .head 6 - Height Editable? Yes .head 5 - Visible? Yes .head 5 - Keyboard Accelerator: (none) .head 5 - Font Name: Default .head 5 - Font Size: Default .head 5 - Font Enhancement: Default .head 5 - Picture File Name: .head 5 - Picture Transparent Color: None .head 5 - Image Style: Single .head 5 - Text Color: White .head 5 - Background Color: Teal .head 5 - Button Appearance: Standard .head 5 + Message Actions .head 6 + On SAM_Click .head 7 - Call SalTimerSet( hWndMDI, 0, 1000 ) .head 4 + Picture: pic1 .head 5 - Class Child Ref Key: 0 .head 5 - Class ChildKey: 0 .head 5 - Class: .head 5 - Property Template: .head 5 - Class DLL Name: .head 5 - Window Location and Size .head 6 - Left: 0.183" .head 6 - Top: 0.131" .head 6 - Width: 2.05" .head 6 - Width Editable? Yes .head 6 - Height: 0.5" .head 6 - Height Editable? Yes .head 5 - Visible? Yes .head 5 - Editable? No .head 5 - File Name: .head 5 - Storage: External .head 5 - Picture Transparent Color: None .head 5 - Fit: Scale .head 5 - Scaling .head 6 - Width: 100 .head 6 - Height: 100 .head 5 - Corners: Square .head 5 - Border Style: No Border .head 5 - Border Thickness: 1 .head 5 - Tile To Parent? No .head 5 - Border Color: Default .head 5 - Background Color: Gray .head 5 - Message Actions .head 2 - Contents .head 2 - Functions .head 2 - Window Parameters .head 2 + Window Variables .head 3 - Number: nTimerCount .head 3 - FunctionalVar: Serializador .head 4 - Class: C_SERIALIZADOR .head 2 + Message Actions .head 3 + ! On SAM_Timer .head 4 + If nTimerCount < 10 .head 5 - Call Serializador.New() .head 5 - Set nTimerCount = nTimerCount + 1 .head 4 + Else .head 5 - Call SalTimerKill( hWndMDI, 0 )
