link icon
Ask The Community

Teamviewer stops working GetWindowText (User32.dll) Function

I have developed a C# code which access to user32.dll and it is using GetWindowText function. The code is working properly when Teamviewer is uninstalled on Windows 7.

However if you install Teamviewer, the code can not retrieve the text of control in window with GetWindowText function. The code is given below. How can I solve this problem ?

   [DllImport("user32.dll", CharSet = CharSet.Auto)]

   static extern IntPtr FindWindowExW(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, 

   string lpszWindow);

   [DllImport("user32.dll", CharSet = CharSet.Auto)]

   static extern IntPtr GetWindowText(IntPtr hwndParent, StringBuilder Wintxt, int txtsize);

   public void CloseWin(string param)




     IntPtr hwnD = FindWindowExW(IntPtr.Zero, IntPtr.Zero, "CabinetWClass", null);

     IntPtr hwnD2 = FindWindowExW(hwDvar, IntPtr.Zero, "WorkerW", null);

     IntPtr hwnD3 = FindWindowExW(hwnD2, IntPtr.Zero, "ReBarWindow32", null);

     IntPtr hwnD4 = FindWindowExW(hwnD3, IntPtr.Zero, "Address Band Root", null);

     IntPtr hwnD5 = FindWindowExW(hwnD4, IntPtr.Zero, "msctls_progress32", null);

     IntPtr hwnD6 = FindWindowExW(hwnD5, IntPtr.Zero, "Breadcrumb Parent", null);

     IntPtr hwnD7 = FindWindowExW(hwnD6, IntPtr.Zero, "ToolbarWindow32", null);

     StringBuilder sb = new StringBuilder(255);

     GetWindowText(hwnD7, sb, 255);


  • franklmorgan54
    franklmorgan54 Posts: 3 ✭✭
    edited January 3

    Well I have resolved the issue. I was calling also dialog file class with the function FindWindowEx by the class name #32770.

    This class type is used also by Teamviewer(TV) quick support user interface. When I run my code, there is a intervention to the interface of TV and blocks of working user32 functions.

    To solve the problem I have called the FindWindow function with class name and control name so that there is no intervention to the TV and problem solved.

    [The link has been removed as per the community guidelines.]

  • annahernandez_99
    annahernandez_99 Posts: 2 Newbie
    edited January 23

    Thanks for your time and help. It was very useful for me.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!