English
Forum

menace worse crashes wg. ProcAddr at Callbacks, Threads

 
- Page 1 -


Hello IF...

I habs time tested and hope nothing wrong made to have:
CompileMarkSeparation
 $U thread.pcu = thread.
DEF @GetDlgCtrlID(1) !"USER32","GetDlgCtrlID"
DEF @ButtonClicked(1) @GetDlgCtrlID(@&(1))=-%MENUITEM
Testprogramm Timer
Profan Version 9
 $H Windows.ph
-Main----------------------------------------------------------------
Declare Timer_Busy%,Ende%
Declare TimerID&,Create%,T_Text&,Test#
WindowStyle 26
WindowTitle "Timertest PHU-60"
Window 100,100 - 370,200
cls
Let T_TEXT&=@CREATETEXT(%HWND,"",30,30,300,30)
-Menue---------------------------------------------------------------
PopUp "&Programm"
AppendMenu 108,"&Einstellungen"
AppendMenu 109,"&Ende"
Ende% = 0
Timer setzen (4x pro Sekunde, 250ms)
thread.start 1,1

WhileNot Ende%

    WaitInput

    If @MenuItem(108)

        Einstellungen

    Endif

    If @MenuItem(109)

        thread.stopall
        Ende% = 1

    Endif

Wend

End
-Proc Einstellungen

Proc Einstellungen

    Declare hD%, hA%, hB%, OK%, hTime%
    Declare hF1%, hT1%
    Clear OK%
    Dialogfenster erzeugen
    hD% = @Create("Dialog",%hWnd,"Einstellungen",%WinLeft+80,%WinTop+155,230,190)
    hF1% = @Create("Font","Arial",16,0,0,0,0)
    hT1% = @Create("Text",hD%,"Einstellungen...",10,10,220,20)
    SetFont hT1%,hF1%
    hTime% = @Create("TimeEdit", hD%, "00:00:00", 10, 35, 70, 24)
    hB% = @Create("Button",hD%,"&Nachstellen",10,120,100,28)
    hA% = @Create("Button",hD%,"&Abbrechen",120,120,100,28)

    WhileNot Ok%

        WaitInput

        If @ButtonClicked(hB%)  Nachstellen

            Ok% = 1
            Aktionen hier

        ElseIf @ButtonClicked(hA%) Abbrechen

            Ok% = 1

        ElseIf (%Key = 2) ALT+F4 bzw. schließen

            Ok% = 1

        EndIf

    EndWhile

    DeleteObject hF1%
    @DestroyWindow(hD%)

EndProc

-Prozedur die in bestimmten Zeitintervallen ausgefuehrt wird (4x pro Sekunde)

Proc thread.do

    parameters n&
    Dim Test#,1000000
    Inc Timer_Busy%
    Locate 5,5
    Print "Timer:" + @str$(Timer_Busy%) + " Durchläufe"
    Settext T_Text&,"Timer:" + @str$(Timer_Busy%) + " Durchläufe"
    ENDPROC


too here becomes the window not correctly. displayed!
what means the? go in the Hauptprogramm during one Thread carryed out, überschreibt Profan intern gespeicherte variables to that Call of API. depending on, which Profanfunktionen in the Hauptprogramm uses go, is the menace time More and times less given, she's but too (loudly Roland) at direct Call of APIs present. when and whether a Error appears, depends of chosen Zeitintervall, of computer and from the Programmbedienung by the User ex.
what means the very?

One example:
at that one computer under windows2000 becomes when calling the API RegUnloadKey one such Crash causes and the API becomes therefore not correctly carryed out. thereupon becomes the Registryhive the User not How planned entladen and is at next Start not any more available => one ganzes Userprofile is unwiederbringlich lost.

One differently example:
the Hauptprogramm writes during one Callback runs into Registry. there everything unfavourable zusammentrifft, becomes in a others Key written and Datenj in the Registry weg lost!

further ask and Notes?
 
09/09/06  
 



 
- Page 3 -


and these three Source wären there among other things too yet interestingly:
CompileMarkSeparation
DEF @GetDlgCtrlID(1) !"USER32","GetDlgCtrlID"
DEF @ButtonClicked(1) @GetDlgCtrlID(@&(1))=-%MENUITEM
DEF @GetProcAddress(2) !"KERNEL32","GetProcAddress"
Testprogramm Timer
Profan Version 9
 $H Windows.ph
-Main----------------------------------------------------------------
Declare Timer_Busy%,Ende%
Declare TimerID&,Create%,T_Text&,Test#,T_TEXT2&
Declare OldWndProc&,DLL&,P_A&
LET DLL&=@Usedll("Send.DLL")
WindowStyle 26+512
WindowTitle "Subclassingtest"
Window 100,100 - 370,200
Let T_TEXT&=@CREATEButton(%HWND,"",30,80,300,30)
Let T_TEXT2&=@CREATEButton(%HWND,"Ende",30,120,300,30)
Waitinput
Set("FastMode", 1)
OldWndProc& = ~GetWindowLong(%hWnd,~GWL_WNDPROC)
LET P_A&=@GetProcAddress(DLL&,"_timer@16")
~SetWindowLong(%hWnd,~GWL_WNDPROC,@ProcAddr("Sub",4))
Ende%=0
TimerID&=~SetTimer(%HWND,333,20,P_A&)
Print TimerID&

WhileNot Ende%

    WaitInput

    If @Buttonclicked(T_TEXT&)

        Einstellungen

    Endif

    If @Buttonclicked(T_TEXT2&)

        ~KillTimer(%HWND,333)
        Ende%=1
        Freedll DLL&

    Endif

Wend

End
-Proc Einstellungen

Proc Einstellungen

    Declare hD%, hA%, hB%, OK%, hTime%
    Declare hF1%, hT1%
    Clear OK%
    Dialogfenster erzeugen
    hD% = @Create("Dialog",%hWnd,"Einstellungen",%WinLeft+80,%WinTop+155,230,190)
    hD% = @Control("Dialog","Einstellungen",$14C80084,%WinLeft+80,%WinTop+155,230,190,%HWND,0,%HINSTANCE,$101)
    hF1% = @Create("Font","Arial",16,0,0,0,0)
    hT1% = @Create("Text",hD%,"Einstellungen...",10,10,220,20)
    SetFont hT1%,hF1%
    hTime% = @Create("TimeEdit", hD%, "00:00:00", 10, 35, 70, 24)
    hB% = @Create("Button",hD%,"&Nachstellen",10,120,100,28)
    hA% = @Create("Button",hD%,"&Abbrechen",120,120,100,28)

    WhileNot Ok%

        WaitInput

        If @ButtonClicked(hB%)  Nachstellen

            Ok% = 1
            Aktionen hier

        ElseIf @ButtonClicked(hA%) Abbrechen

            Ok% = 1

        ElseIf (%Key = 2) ALT+F4 bzw. schließen

            Ok% = 1

        EndIf

    EndWhile

    DeleteObject hF1%
    @DestroyWindow(hD%)

EndProc

Proc Sub

    Parameters hWnd&,Message&,wParam&,lParam&

    If Message&=$401

        Inc Timer_Busy%
        Settext T_Text&,"Timer: " + @str$(Timer_Busy%) + " Durchläufe"
        Return ~CallWindowProc(OldWndProc&,hWnd&,Message&,wParam&,lParam&)

    Else

        Return ~CallWindowProc(OldWndProc&,hWnd&,Message&,wParam&,lParam&)

    EndIf

ENDPROC


CompileMarkSeparation
DEF @GetDlgCtrlID(1) !"USER32","GetDlgCtrlID"
DEF @ButtonClicked(1) @GetDlgCtrlID(@&(1))=-%MENUITEM
DEF @GetProcAddress(2) !"KERNEL32","GetProcAddress"
Testprogramm Timer
Profan Version 9
 $H windows.ph
-Main----------------------------------------------------------------
Declare Timer_Busy%,end%
Declare TimerID&,Create%,T_Text&,Test#,T_TEXT2&
Declare OldWndProc&,DLL&,P_A&
LET DLL&=@Usedll("Send.DLL")
Window Style 26+512
Window Title "Subclassingtest 2"
Window 100,100 - 370,200
Let T_TEXT&=@CREATEButton(%HWND,"",30,80,300,30)
Let T_TEXT2&=@CREATEButton(%HWND,"Ende",30,120,300,30)
Waitinput
Set("FastMode", 1)
OldWndProc& = ~GetWindowLong(%hWnd,~GWL_WNDPROC)
LET P_A&=@GetProcAddress(DLL&,"_timer@16")
~SetWindowLong(%hWnd,~GWL_WNDPROC,@ProcAddr("Sub",4))
Ende%=0
TimerID&=~SetTimer(%HWND,333,25,@ProcAddr("Sub",4))
Print TimerID&

WhileNot end%

    WaitInput

    If @Buttonclicked(T_TEXT&)

        Settings

    Endif

    If @Buttonclicked(T_TEXT2&)

        ~KillTimer(%HWND,333)
        end%=1
        Freedll DLL&

    Endif

Wend

End
-Proc Settings

Proc Settings

    Declare hD%, hA%, hB%, OK%, hTime%
    Declare hF1%, hT1%
    Clear OK%
    Dialog-Window produce
    hD% = @Create("Dialog",%hWnd,"Einstellungen",%WinLeft+80,%WinTop+155,230,190)
    hD% = @Control("Dialog","Einstellungen",$14C80084,%WinLeft+80,%WinTop+155,230,190,%HWND,0,%HINSTANCE,$101)
    hF1% = @Create("Font","Arial",16,0,0,0,0)
    hT1% = @Create("Text",hD%,"Einstellungen...",10,10,220,20)
    SetFont hT1%,hF1%
    hTime% = @Create("TimeEdit", hD%, "00:00:00", 10, 35, 70, 24)
    hB% = @Create("Button",hD%,"&Nachstellen",10,120,100,28)
    hA% = @Create("Button",hD%,"&Abbrechen",120,120,100,28)

    WhileNot OK%

        WaitInput

        If @ButtonClicked(hB%)  Nachstellen

            OK% = 1
            activities here

        ElseIf @ButtonClicked(hA%) Cancel

            OK% = 1

        ElseIf (%Key = 2) ALT+F4 or. close

            OK% = 1

        EndIf

    EndWhile

    DeleteObject hF1%
    @DestroyWindow(hD%)

ENDPROC

Proc Sub

    Parameters hWnd&,Message&,wParam&,lParam&
    Inc Timer_Busy%
    Settext T_Text&,"Timer: " + @st$(Timer_Busy%) + " Durchläufe"

ENDPROC


CompileMarkSeparation
 $DLL
-procedure The in designed Zeitintervallen ausgefuehrt becomes (4x per second)
Declare Timer_Busy%,WND&

dllproc Timer,4

    Parameters P1&,P2&,P3&,P4&
    @SendMessage(@FindWindow("Subclassingtest"),$401,0,0)

ENDPROC


The Error has means well nothing with Subclassing To do - or what Dou you mean very?
 
09/10/06  
 



 
- Page 4 -


[quote:19dfeaab2b=Frank Abbing][quote:19dfeaab2b]As I said: Please testing! interested me brennend. building times the Callback in a DLL - lasts Yes not long...[/quote:19dfeaab2b]
I had the already made. my Dll has a Thread created and this has a profansche Callbackroutine called. After several Call broke Profan with the sonderlichsten Fehlermeldungen ex. apiece kürzer The spread the Aufrufe, so faster came The Error.[/quote:19dfeaab2b]
Hello Frank...

finally understand time of/ one, I say .
Have your Posting unfortunately first now red.
this trouble is me ditto famous - the lying but integrally elsewhere and can itself right simply bypass (see Rolf).
 
09/10/06  
 



so Andreas,

who not listen can must feel.

in the Grunde weg our opinions Yes dahingehend apart that I say, the it fundamentally on procaddr  lying, because this The interface is moreover the of outer Prozeduraufrufe injiziert go can and you mean the it Specifically with WM_Timer To do has.

means have I the whole without Wm_timer resolved, one Call becomes a DLL directly called, always and over ands over again.

it occupied the it vokommen can, the if a proc The by procaddr available made watts, extern called becomes, XProfan itself verhäddert. without ProcAddr would this Yes you don't say so.

here the code to that Selbertesten, under ne versaute Dll.

it has accordingly nothing with the Thread-Unit To do and nothing with wm_timer, and so I the Thread too from the Thread-Unit-area removes, and to Programming shoved have.
CompileMarkSeparation
Def @Getdlgctrlid(1) !"USER32","GetDlgCtrlID"
Def @Buttonclicked(1) @Getdlgctrlid(@&(1))=-%Menuitem
Testprogramm Timer
Profan Version 9
 $H Windows.ph
-Main----------------------------------------------------------------
Declare Timer_busy%,Ende%
Declare Timerid&,Create%,T_text&,Test#
Windowstyle 26
Windowtitle "Timertest PHU-60"
Window 100,100 - 370,200
Cls
Let T_TEXT&=@CREATETEXT(%HWND,"",30,30,300,30)
-Menue---------------------------------------------------------------
Popup "&Programm"
Appendmenu 108,"&Einstellungen"
Appendmenu 109,"&Ende"
Ende% = 0
Timer setzen (4x pro Sekunde, 250ms)
Thread.start 1,1
declare h&
h&:=usedll("thread2.dll")
h&:=external("kernel32","GetProcAddress",h&,"dodo")
external("thread2.dll","f",procaddr("thread.do",0),h&)

Whilenot Ende%

    Waitinput

    If @Menuitem(108)

        Einstellungen

    Endif

    If @Menuitem(109)

        Thread.stopall
        Ende% = 1

    Endif

Wend

End
-Proc Einstellungen

Proc Einstellungen

    Declare Hd%, Ha%, Hb%, Ok%, Htime%
    Declare Hf1%, Ht1%
    Clear Ok%
    Dialogfenster erzeugen
    Hd% = @Create("Dialog",%Hwnd,"Einstellungen",%Winleft+80,%Wintop+155,230,190)
    Hf1% = @Create("Font","Arial",16,0,0,0,0)
    Ht1% = @Create("Text",Hd%,"Einstellungen...",10,10,220,20)
    Setfont Ht1%,Hf1%
    Htime% = @Create("TimeEdit", Hd%, "00:00:00", 10, 35, 70, 24)
    Hb% = @Create("Button",Hd%,"&Nachstellen",10,120,100,28)
    Ha% = @Create("Button",Hd%,"&Abbrechen",120,120,100,28)

    Whilenot Ok%

        Waitinput

        If @Buttonclicked(Hb%) Nachstellen

            Ok% = 1
            Aktionen hier

        Elseif @Buttonclicked(Ha%)Abbrechen

            Ok% = 1

        Elseif (%Key = 2)ALT+F4 bzw. schließen

            Ok% = 1

        Endif

    Endwhile

    Deleteobject Hf1%
    @Destroywindow(Hd%)

Endproc

-Prozedur die in bestimmten Zeitintervallen ausgefuehrt wird (4x pro Sekunde)

Proc Thread.do

    Parameters N&
    Dim Test#,1000000
    Inc Timer_busy%
    Locate 5,5
    Print "Timer:" + @Str$(Timer_busy%) + " Durchläufe"
    Settext T_Text&,"Timer:" + @str$(Timer_Busy%) + " Durchläufe"
    Endproc


6 kB
Hochgeladen:09/12/06
Downloadcounter45
Download
 
09/12/06  
 



Hello IF...

in the have I the local, we talk in the principle from the same thing , think but both not at the end . have you got you already time consider, Why the Error use of Set(FastMode, 1) not any more appears ?
If the really each Callback on a Profanfunktion vorkommt (the faith I you, too without whom View source the DLL To see), should one absolutely very know, with whom Profanfunktionen there menace exists. I have here for hours with Writeini and Readini$ experimented, without (to that Happiness) a Error To produce. If the really even (loudly Roland) at direct Call of APIs occur could, there really quite no Possibility, the Messagehandling beizubehalten and something other at the same time run out To let.

the it on the frequency the Aufrufens the procedure lying, can I not confirm. apiece less The procedure called becomes, umso less is the probability, the one Error happens - The Error occur but still.
In TNT becomes ditto one Callback uses - the program use I ongoing, circa something in windows To investigate.
on the beginning trod, alike How often the Callback called watts, always any Error on. since I there some Profanfunktionen on another place moved have (where tappt im dunkeln no Problems More make), is silence.
 
09/13/06  
 



[quote:3974012546]have you got you already time consider, Why the Error use of Set(FastMode, 1) not any more appears ? [/quote:3974012546]
this is nonsense Andreas, it has too nothing with the Fastmode To do.

it's located simply on the Umsetzung of procaddr - I have me my Betrachtungsweise confirm let.

in the FastMode zurück naturally selbige Problems on!
 
09/13/06  
 



Nachtrag: menace exists fundamentally with all ProfanFunktionen, The menace increased itself - I say time plump - from so More Call The function intern exists.

These items of them You report - say we there are next to/Folgeerscheinungen.
 
09/13/06  
 



Hello IF...

first time best Thanks for your endeavours.
ought to the so voices (and that is now not, that I you not faith),
is the Real a bad news - in the Klartext means the Yes u.a. the following:
- its in none point possible only with Profan something (at the same time) fehlerfrei run out To let.
- it is not possible, with Profan a reasonable service To write.
- an vielzahl on APIs can with Profan not use (SendMessageCallback, any Timer with Callbacks, EnumThreadWindows, EnumWindows....)

Eignet itself Profan at all then to program?
time adopted, must in designed Zeitabständen something a Callback document and my Program fummelt at the same time with RegLoadKey / RegUnloadKey in the Registry rum (so How RegEdt32 the does), who comes then for damage on strangers Rechnern or Systemen on? ought to one with Profan programmed programs then at all in currency bring? the must itself as quickly as possible Change!
 
09/13/06  
 



Well! The exception - in the it no Problems gives - are hold functions which a ProcAddr need but itself first terminate if The work happen is! Roland has ProcAddr eigendlich too only so virtual!

here z.B. this example: [...] 

means Probs Gibts not, if The function The Proc behind the ProcAddr aufruft, this too only does as long as herself yet runs.

What the Gleichzeitigkeit so concerns means this for all others Cases the The function ProcAddr unfit is. unfortunately!
 
09/13/06  
 



[quote:0f571140cc=iF]Well! The exception - in the it no Problems gives - are hold functions which a ProcAddr need but itself first terminate if The work happen is! Roland has ProcAddr eigendlich too only so virtual!
[/quote:0f571140cc]
means any Enum-functions make no Problems.
[quote:0f571140cc=iF]
means Probs Gibts not, if The function The Proc behind the ProcAddr aufruft, this too only does as long as herself yet runs.
[/quote:0f571140cc]
means Gibts u.a. with SendMessageCallback Problems. the write sämtlicher Services would ditto under entrapments and Problems make.
an reasonable Taskmanager You can then ditto not write.
[quote:0f571140cc=iF]
What the Gleichzeitigkeit so concerns means this for all others Cases the The function ProcAddr unfit is. unfortunately![/quote:0f571140cc]
this is very bad. Überhaupt a Taskmanager To write, is means you don't say so. whom Speicherverbrauch several processes in the eye To keep, ditto not. reasonable Registryeditoren entrapments well too levelly - during one Unterschlüssel lists, could one his Program only heavy bedienbar hold. an Time in my Program einzublenden - is not.
If itself the really not Set(FastMode, 1) bypass can, schmeiße I Profan rather first time into corner.
These trouble must absolutely rather documents or best integrally eliminating go - there can Yes in Teufelsküche come.
 
09/13/06  
 



Well one munkelt it could soon remedy give. ;)

there remaining well nothing moreover as The Erkenntnis - and something Waiting...

especially since - the whole becomes eigendlich through you aufgebauscht - the must so did i time clear say!

its objectively not even semi so wild!

I write a great many programs which ProcAddrs benefit - I had yet no solches Phänomen - must but too moreover say - i'm naturally geübt therein me very well vorzustellen like a Source whom I write very Abläuft - and verhindere so naturally already unconscious so many complications - especially since me the ProcAddrProblem How already often erwähnt not new is.

Einfache available Examples - already a derartigen Error in Konstantinopel or Okrea to bring about can? I faith No.

the write of whole Hives or crude RegÄnderungen would I - alike in which Language - eh not so simply draufzu work out let. Something like would I always in a pool do which worn out becomes if The breeze mere is. Machs you means not To slight!

You promise hold very Special Sonderfälle on - there likes it naturally his the The ProcAddr not safe is. for these Sonderfälle have You but as Programmer sufficient Ausweichmethoden to hand.

everything goes nunmal in none Language - wohlbemerkt - one safe ProcAddr can I me present becomes it in XProfan give!
 
09/13/06  
 




Sebastian
König
Hello Andreas,

[quote:afe202e11c](...) this is very bad. Überhaupt a Taskmanager To write, is means you don't say so. whom Speicherverbrauch several processes in the eye To keep, ditto not. reasonable Registryeditoren entrapments well too levelly - during one Unterschlüssel lists, could one his Program only heavy bedienbar hold. an Time in my Program einzublenden - is not.
If itself the really not Set(FastMode, 1) bypass can, schmeiße I Profan rather first time into corner.[/quote:afe202e11c]
as Workaround can You Yes first The actually Profan2Cpp-Beta take . so exit The Problematik finally not, as we [...]  already discusses having...

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
09/13/06  
 



have anyhow to, me Profan2Cpp zuzulegen.
 
09/15/06  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

4.209 Views

Untitledvor 0 min.
H.Brill01/26/23
Peter Max Müller11/13/17
iF07/19/15
Ernst03/02/15

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie