Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
 

namespace parol_udal
{
    class Program
    {
        [DllImport("user32.dll",CharSet=CharSet.Auto,SetLastError=true)]
        public static extern IntPtr FindWindow(string sClassName,string sWindowName);
 
        [DllImport("user32.dll",CharSet=CharSet.Auto,SetLastError=true)]
         public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpClassName, string lpWindowName);
 
        [DllImport("user32.dll",CharSet=CharSet.Auto ,SetLastError = true)]
        public static extern int GetWindowText (IntPtr hwnd,StringBuilder lpString,int nMaxCount);
 
        [DllImport("user32.dll",CharSet=CharSet.Auto, SetLastError = true)]
        static extern int GetWindowTextLength(IntPtr hWnd);
        
        static void Main()
        {
           IntPtr thisWindow = FindWindow(null, "Window description Parent");
           IntPtr Rod = thisWindow;
                      
           IntPtr otherWindow = FindWindowEx(Rod, IntPtr.Zero, "RICHEDIT50W", null);
        
                        
            int len = GetWindowTextLength(otherWindow);
            StringBuilder sb = new StringBuilder(len);
            len = GetWindowText(otherWindow, sb, len);
 
            Console.WriteLine(sb.ToString(0,len)); //get empty string
            Console.WriteLine(thisWindow); //get parent description
            Console.WriteLine(otherWindow);//get receivery description
            Console.ReadKey(true); 
       }
    }
}
Please help, how to get title "otherWindow"?
 

 
Posted 19-Feb-13 22:38pm
Comments
Sergey Alexandrovich Kryukov at 28-Mar-13 14:23pm
   
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership. And the fact you even self-accepted on formally is just outrageous, a sure way for a ban. I hope you won't do it after this warning.
 
Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,649
1 Sergey Alexandrovich Kryukov 6,270
2 CPallini 5,190
3 George Jonsson 3,574
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100