[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
Go Back  Xtreme Visual Basic Talk > > > [API HOOK] Prevent a window to be display


Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2015, 09:29 AM
philippe734 philippe734 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 5
Default [API HOOK] Prevent a window to be display


Hello,

I’m a senior dev’ and I’m stuck on some thing about hook CBT.

Subject : intercept a msgbox (or a window) from another app

Aim : do a hook WH_CBT on the external app which popup the msgbox (or a window) , intercept the msgbox (or a window) with the hook CBT_CREATEWND and prevent the msgbox (or a window) to be displayed.

I had successful put the hook WH_CBT on the external app. I had successful intercept the msgbox (or a window) before display with CBT_CREATEWND from it’s handle and window title. With that window handle, I had successful close the msgbox (or a window) before display with one of that two methods : send WM_CLOSE with SendMessage, or with DestroyWindow. But, in each case, the msgbox (or a window) is close before display and recreate. Therefore, my program still close the msgbox (or a window) before display but the msgbox (or a window) is still recreate again and again, that make an infinite loop (close, recreate, close, recreate…) which did crash the external app.

My question is : with a hook WH_CBT / CBT_CREATEWND, how to prevent the display of a msgbox (or a window) before displayed, free of infinite loop as in my program ?

Thanks in advance,
Reply With Quote
  #2  
Old 06-12-2015, 12:37 PM
philippe734 philippe734 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 5
Default

Here my code about my previous post :

Code:
Private Sub procWH_CBT(sWhen As String, lReturn As Long, nCode As eHookCode, wParam As Long, lParam As Long)
    Dim lCBT_CREATEWND As tCBT_CREATEWND
    Dim lCREATESTRUCT As tCREATESTRUCT
    Dim hNewWnd As Long
    Dim hwndParent As Long
    Dim Ret As Long
    Dim bRet As Boolean
    Dim TextLen As Long    ' receives length of text of title bar
    Dim TitleBar As String    ' receives the text of the title bar
    Dim sLength As Long    ' receives the length of the returned string
    Dim iRetClose As Integer


    If sWhen = "Before" Then

        If nCode = HCBT_CREATEWND Then

            hNewWnd = wParam

            lCBT_CREATEWND = CopyMemoryGetCBT_CREATEWND(lParam)
            lCREATESTRUCT = CopyMemoryGetCREATESTRUCT(lCBT_CREATEWND.lpcs)

            hwndParent = lCREATESTRUCT.hwndParent
            bRet = IsWindow(lCREATESTRUCT.hwndParent)

            ' Name window of the parent
            TextLen = GetWindowTextLength(lCREATESTRUCT.hwndParent)
            TitleBar = Space$(TextLen + 1)
            sLength = GetWindowText(lCREATESTRUCT.hwndParent, TitleBar, TextLen + 1)
            TitleBar = Left(TitleBar, sLength)

            lCBT_CREATEWND.lpcs = 0
            ' replace lParam with 0
            CopyMemory ByVal lParam, lCBT_CREATEWND, LenB(lCBT_CREATEWND)

            iRetClose = SendNotifyMessage(hNewWnd, WM_CLOSE, 0, vbNullString)
            ' iRetClose = DestroyWindow(hNewWnd)

        End If

    End If
End Sub
Reply With Quote
  #3  
Old 06-16-2015, 02:44 AM
Flyguy's Avatar
Flyguy[API HOOK] Prevent a window to be display Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,164
Default

You are trying to block popup messages from an external program?
Reply With Quote
  #4  
Old 06-22-2015, 03:06 PM
philippe734 philippe734 is offline
Newcomer
 
Join Date: Jun 2015
Posts: 5
Default

Not really a popup blocker... I want to intercept a window (or a msgbox) of an external program.
If you want to see my source code, I post here my project :
Hook system wide with DLL in C++
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display [API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
 
[API HOOK] Prevent a window to be display
[API HOOK] Prevent a window to be display
 
-->