

/ /// Window handle /// Caller-defined variable we use it for a pointer to our list /// True to continue enumerating, false to bail.

/ /// Delegate for the EnumChildWindows method You can modify this to check to see if you want to cancel the operation, then return a null here return true Throw new InvalidCastException( " GCHandle Target could not be cast as List") GCHandle gch = GCHandle.FromIntPtr(pointer)


/ /// Handle of the next window /// Pointer to a GCHandle that holds a reference to the list to fill /// True to continue the enumeration, false to bail private static bool EnumWindow( IntPtr handle, IntPtr pointer) / /// Callback method to be used when enumerating windows. GCHandle listHandle = GCHandle.Alloc(result) ĮnumWindowProc childProc = new EnumWindowProc(EnumWindow) ĮnumChildWindows(parent, childProc, GCHandle.ToIntPtr(listHandle)) / /// Parent of the windows to return /// List of child windows public static List GetChildWindows( IntPtr parent) Public static extern bool EnumChildWindows( IntPtr window, EnumWindowProc callback, IntPtr i) Problem: accidentally clicking 'Replace All in All Opened Documents' ruins potentially all your text files, causing you to have to go through potentially hundreds of thousands of open text files and fix them one by one, and ruins them all permanently if youve closed Notepad++ in-between (2855 5253 5260). Para teste voce pode deixar o bloco de notas e a calculadora ativas e o seu programa com o form reduzido em um canto. OBS: Conforme voce move o cursor para um objeto ou janela ativa do windows, o handle e o nome do objeto será mostrado no Edit1 e Edit2. Pegar o nome das Janelas Ativas no Windows Procedure TForm1.Button1Click(Sender: TObject) Pergar o nome de um objeto ou janela sob o cursor Procedure TForm1.Timer1Timer(Sender: TObject) SendMessage( Wnd, WM_GETTEXT, caption,TObject( Wnd )) ((GetWindowLong(Wnd, GWL_EXSTYLE) and WS_EX_TOOLWINDOW) = 0) (HWND(GetWindowLong(Wnd, GWL_HWNDPARENT)) = GetDesktopWindow))and ((GetWindowLong(Wnd, GWL_HWNDPARENT) = 0) or Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,įunction EnumWindowsProc (Wnd: HWND lb: TListbox): BOOL stdcall
