|
Thanks for all four replies
I came to the evidence that I need to learn WPF
|
|
|
|
|
I have used SPY to find the intended Child window and used those DllImport("user32", ... as indicated in http://msdn.microsoft.com/en-us/magazine/cc163738.aspx#S3, but it doesn't work with the following codes:
WindowsEnumerator enumerator = new WindowsEnumerator();
foreach (WindowsEnumerator.ApiWindow top in enumerator.GetTopLevelWindows())
{
if (top.MainWindowTitle == "Client Builder")
{
foreach (WindowsEnumerator.ApiWindow child in enumerator.GetChildWindows(top.hWnd))
{
if (child.ClassName == "Child_ClassName" && child.MainWindowTitle == "Child_Title")
{
IntPtr Chd_win = IntPtr.Zero;
Chd_win = FindWindowEx(hwnd, Chd_win, child.ClassName, child.MainWindowTitle);
PostMessage(Chd_win, WM_LBUTTONDOWN, 5, 5);
PostMessage(Chd_win, WM_LBUTTONUP, 5, 5);
MessageBox.Show(child.ClassName + ", " + child.MainWindowTitle, "");
}
}
}
}
*) The Child Window pointer Chd_win always returns Zero even if it found the correct child.MainWindowTitle & child.ClassName (it confirms with the MessageBox.Show(child.ClassName + ", " + child.MainWindowTitle, "")
*) I can send the image with the SPY shows Child Window with the GUI if you provide the Email address (for easier to understand my problem)
Thanks in-advanced
|
|
|
|
|
Can you explain how your code operates, that is, what do you think it does.
I have
1) Enumerate all top level windows and select one by title
2) Enumerate the 1st level of child windows and select one by class name and title
3) ???
What is that FindWindowEx call doing? The assignment of the hwnd argument is unclear (typo?) but as configured FindWindowEx is searching for the first child of 'hwnd' with the same classname and title as the child window found by the GetChildWindows enumerator. If the call is successful what is the relationship of the window found to the selected child window found by the enumerator?
Alan.
|
|
|
|
|
- The function FindWindowEx(hwnd, Chd_win, child.ClassName, child.MainWindowTitle); supposed to return the Child Window pointer (Chd_win) which referent from child.ClassName & child.MainWindowTitle (from Parent Window = hwnd pointer)
- In my case I do have correct hwnd pointer (parent) and its child.ClassName & child.MainWindowTitle also correctly ... however, somehow it couldn't find Child Window pointer = Chd_win!!!
I hope that I explain correctly!
|
|
|
|
|
I was trying to understand why you were calling FindWindowEx but I'm still not sure.
Are you saying that the GetChildWindows method can create an ApiWindow object where the ClassName and MainWindowTitle properties have the expected values but the hWnd property value is IntPtr.Zero.
|
|
|
|
|
By any chance I can send you a image which show you what my Window parent & Child looks like (including SPY contents) through your Email?
I also can send you my project so that you can see full DLL Imports
- It will easy to understand the issue!
|
|
|
|
|
No thanks to the email option. I'm still trying to find out why FindWindowEx is being used. In the code fragment the child window enumerator returns the ApiWindow 'child' from which you get ClassName and MainWindowTitle. Why did you not use child.hWnd to get the required handle for use in PostMessage?
foreach (WindowsEnumerator.ApiWindow child in enumerator.GetChildWindows(top.hWnd))
{
if (child.ClassName == "Child_ClassName" && child.MainWindowTitle == "Child_Title")
{
IntPtr Chd_win = IntPtr.Zero;
Chd_win = FindWindowEx(hwnd, Chd_win, child.ClassName, child.MainWindowTitle);
PostMessage(Chd_win, WM_LBUTTONDOWN, 5, 5);
PostMessage(Chd_win, WM_LBUTTONUP, 5, 5);
MessageBox.Show(child.ClassName + ", " + child.MainWindowTitle, "");
}
}
|
|
|
|
|
The reason is that the PostMessage require the Pointer of the Child Window (not the handle) to place the focus on that Child Window then simulate clicking on the its intended Button (that what I understand from it)
*) My main purpose is trying to simulate clicking on intended Button (not using mouse) on a Child Window ... I don't mind to use other methods (but so far on the other methods which I found, they couldn't help)
- By the way, I have just replied my own post to mentionned that the code posted working fine if the Child Window is 2nd level from the Parent Window ... in my case the intended Child Window is lower than that ... so I still looking the way to go ditectly to it!
modified 19-May-14 12:55pm.
|
|
|
|
|
It's me again.
I would like to confirm that the codes which I posted working fine if the Child Window is the 2nd level from the Parent!
*) As I did mentionned earlier (since I couldn't post the attachment) my intended Child Window is deep down more than 2nd level ... might be that was why I couldn't use it directly!!!
I still find the better way to do it!!!
|
|
|
|
|
simple authorized user logged in application sample which compiled with in c# needed.... c# 10 preferred.. Please help with ur links.
|
|
|
|
|
Google will find you many samples.
|
|
|
|
|
Sorry!.. No any sample found at Google!.. Might i pleased that from you? any link you post with deal question?
|
|
|
|
|
|
i have just wanted a sample.. these are sample code..
|
|
|
|
|
Yes, that's what sample means. If you want something different then please reword your question, we cannot guess what is in your moind.
|
|
|
|
|
I just like to sample Project that is Project itself.. All whole files with in Project with all of already run in stuation as a project.. I would try it in ASP.NET server host. I have no time to writing code!..
I'm really sory i can not told it to you just as..
Thanks for help!.
|
|
|
|
|
Hakan Bulut wrote: I have no time to writing code!..
So you expect us to write it for you, so you can submit it as your homework?
You didn't stop and think "That's really very lazy of me" or even "That's cheating!" at all?
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Hakan Bulut wrote: I have no time to writing code! Then I suggest you find a different career path; we are not going to do it for you.
|
|
|
|
|
There is no so exiting Project, then. No any developer has been done it for us yet.
modified 16-May-14 9:04am.
|
|
|
|
|
Yes, lots of people have done it, and I gave you links to some samples. We cannot help it if you are too lazy to go and study them.
|
|
|
|
|
This is not literally my job, a female students had requested it to me!..
|
|
|
|
|
Would you like to super-size that ?
“I speak in a poem of the ancient food of heroes: humiliation, unhappiness, discord. Those things are given to us to transform, so that we may make from the miserable circumstances of our lives things that are eternal, or aspire to be so.” Jorge Luis Borges
|
|
|
|
|
no.... no so like that size..
|
|
|
|
|
Time for someone to learn the Magic Words, I think: "Do you want fries with that?"
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
From the top of the site: Code Project - For those that code.
You have not clearly identified what you are looking for or what you have already tried.
People may be willing to help you with solve a problem you have with your code, but they will not simply give you the code.
And, it you aren't looking for code or help with code, then what are you looking for?
|
|
|
|