none
crash When Use win32 api RRS feed

  • Question

  • When I Use HookWindow ( Like MessageBox : System Class #32770 ) And After That SubClassing It , And Close Main Form There is No Problem But When Destroy ( Close The Window App ) The Application I See Crash ( Hang The System ) , How Can Solve it 

    Monday, August 26, 2019 6:29 AM

All replies

  • When I Use HookWindow ( Like MessageBox : System Class #32770 ) And After That SubClassing It , And Close Main Form There is No Problem But When Destroy ( Close The Window App ) The Application I See Crash ( Hang The System ) , How Can Solve it 

    Hello,

    please give more Information. When you close the mainframe window, then you close the application. So there shouldn't be a difference.

    What is the difference in your app? How do you "destroy" the app? How do you "Close Main Form" and how do you "Destroy/Close The Window App"?

    Regards, Guido

    Monday, August 26, 2019 6:46 AM
  • Hi , When Use WinApi In Other Application Like Microsoft Office Crash Will Happened , 

    Public Dlgbox()

    hhook=SetwindowseHook(WH_CBT,...)

    UnhookWindows...

    End Finction

    Public DlgBoxHook(ncode,...)

    if ncode<0 Then CallNextHook 

    If ncode>0 Then 

     SetWindowSubClass wparam,AddressOf SubClassProc,0,0

    End If 

    DlgBoxHook=CallNextHook(...

    End Function

    Hook Successfully Done And When Destroy The Window Class #32770 , There is No Crashing ( Even You Close The Application )

    Point : But When Subclass This Class As Follows ( To Chan ge Color Or Remove Static Or AnyThing Else ) When Destroy The Class #32770 i Think Not Remove SubClass And it Make a Problem ( hang the System When We force the main app window to close) 

    Public SubClassProc(hwnd,...)

    Select Case Msg 

       Case WM_Paint 

       Case WM_DESTROY 

          RemoveWindowSubClass hwnd,SubClassProc,0,0

     End Select 

    SubClassProc=DefWindowSubClass(hwnd,...)

    End Function



    • Edited by Grailly Ali Monday, August 26, 2019 7:39 AM
    Monday, August 26, 2019 7:35 AM
  • Please use the codeblock when you insert code.

    Nevertheless, your code is not Visual C++. Ask in the forum of your programming language.

    Regards, Guido

    Monday, August 26, 2019 7:49 AM
  • Hi,

    Your code is VB6. This forum is about c++ development.I suggest you should ask it in VB6 forum for better support. And this thread will be moved to Off-Topic Posts.

    Best Regards,

    Jeanine Zhang

    Wednesday, August 28, 2019 9:15 AM