Page 1 of 1

Why is the window frozen "Not Responding"

Posted: Wed May 22, 2024 4:14 am
by hoangdiemtinh
I am new to PB.
My primary language is not US/UK. I am using Google Translate.

What solutions when using DisableGadget/DisableWindow without causing the window are not respoding ?

Re: Why do I use DisableGadget/DisableWindow, immediately encounter "Not Responding" problem.

Posted: Wed May 22, 2024 4:41 am
by AZJIO
hoangdiemtinh wrote: Wed May 22, 2024 4:14 am I am new to PB.
My primary language is not US/UK. I am using Google Translate.
I use double check (screenshot)
QTranslate, Crow Translate (Linux), s3_translator (Alt+V)
hoangdiemtinh wrote: Wed May 22, 2024 4:14 am Why do I use DisableGadget/DisableWindow, immediately encounter "Not Responding" problem.
show your example
are you using the call on another thread?

Re: Why is the window frozen "Not Responding"

Posted: Fri May 24, 2024 12:39 pm
by hoangdiemtinh
Before that command, there are the following commands:

Code: Select all


#SHA1_ISO = "9989F522934D032C01BS4B1EAB2459CDB93C05TF"

Procedure.s get_SHA1(fn.s)
  UseSHA1Fingerprint()
  Protected.s sha1
  sha1 = FileFingerprint(GetCurrentDirectory() + fn, #PB_Cipher_SHA1)
  ProcedureReturn sha1
EndProcedure

Procedure.I check_SHA1()
  Protected.s ss, yy
   ss = get_SHA1(GetCurrentDirectory() + "my-iso.iso") ; this file is 5GB size
    yy = #SHA1_ISO
    If CompareMemoryString(@ss, @yy, #PB_String_NoCaseAscii) ! #PB_String_Equal
      ProcedureReturn #False
    EndIf
    ProcedureReturn #True
  EndIf
EndProcedure
 ...................
 .....................
 Repeat
  ev_WINDOW = WaitWindowEvent()
  Select EventWindow()
      ;
    Case #mainWin
      Select ev_WINDOW   
        Case #PB_Event_Gadget
          Select EventGadget()
            Case #Button_CHECK_SHA1
            If check_SHA1() = $False
            MessageRequester(":(", "SHA1 does not match.")
            EndIf
            ..........................
            ............
  
mainWin then show "Not Responding" , freeze...

Re: Why is the window frozen "Not Responding"

Posted: Fri May 24, 2024 4:41 pm
by AZJIO
If no events come to the window within a couple of minutes, the window becomes frozen. Try running the task in a thread.
You can read the file in chunks - StartFingerprint(). And between reading, poll window events.

Re: Why is the window frozen "Not Responding"

Posted: Sat May 25, 2024 12:17 am
by hoangdiemtinh