Morton i guess i gave u the wrong picture...
thread to be created...
then it works perfectly...
Morten Wennevik wrote:
> To get the window handle to a hidden window you need to use FindWindowEx
> in the Win32 API using pinvoke.
>
>
http://www.pinvoke.net/search.aspx?search=FindWindowEx&namespace=[All]
>
> The handle to the parent window is 'null' for a main window.
>
>
>
> On Thu, 02 Nov 2006 06:53:56 +0100, Chacko <jacobneroth@gmail.com> wrote:
>
> > Thanx morton for explaining PostMessage to me...
> > Now morton i have a problem with the first parameter of PostMessage...
> > As in i want to be able to post my messages to disabled windows or
> > invisible windows...
> > How do i do that???
> > I came across some special value thing but then i didn;t understand
> > it...
> > Jacob
> >
> >
> >
> > Morten Wennevik wrote:
> >> Hi Jacob,
> >>
> >> PostMessage is handy for sending messages to other controls or windows
> >> outside your program. Native windows programs uses message queues
> >> (.net-programs hides this message queue with the event system). If you
> >> get the address to any window you can manipulate it by posting messages
> >> to
> >> it, hence PostMessage. PostMessage will 'post' a message to the window
> >> and returns without waiting for a reply, while SendMessage does the
> >> same,
> >> but waits for a reply before returning.
> >>
> >> The sample code below will close all Notepad windows on your desktop by
> >> posting a WM_Close message to each window
> >>
> >> class Program
> >> {
> >> static void Main(string[] args)
> >> {
> >> Process[] processes =
> >> System.Diagnostics.Process.GetProcessesByName("Notepad");
> >> foreach(Process p in processes)
> >> {
> >> IntPtr hWnd = p.MainWindowHandle; // handle to the
> >> notepad
> >> window
> >> UInt32 msg = 0x0010; // WM_Close, a message for
> >> closing a
> >> window
> >> IntPtr wParam = IntPtr.Zero; // no extra parameters
> >> needed
> >> IntPtr lParam = IntPtr.Zero;
> >>
> >> PostMessage(hWnd, msg, wParam, lParam);
> >> }
> >> }
> >>
> >> [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError =
> >> false)]
> >> static extern void PostMessage(IntPtr hWnd, uint Msg, IntPtr
> >> wParam, IntPtr lParam);
> >> }
> >>
> >>
> >> On Tue, 31 Oct 2006 11:58:11 +0100, Chacko <jacobneroth@gmail.com>
> >> wrote:
> >>
> >> > Hi anyone and everyone,
> >> > Could anybody tell me clearly wats the use of PostMessage and sort
> >> > explain to me in simple english...Its just that i searched lot of
> >> > places and i am still not getting it right...
> >> >
> >> > Regards,
> >> > Jacob
> >> >
> >>
> >>
> >>
> >> --
> >> Happy Coding!
> >> Morten Wennevik [C# MVP]
> >
>
>
>
> --
> Happy Coding!
> Morten Wennevik [C# MVP]