FindWindowEx

FindWindowEx함수로 찾지못하는 윈도우 핸들이 무지많습니다..

FindWindowEx함수로 찾지못하는 윈도우 핸들이 무지많습니다..
아래함수는 제경험상으로는 95% 이상 핸들을 찾을수있습니다.
function SubWindowFind( ParentWnd : HWND; FindClassName : string ): HWND;
var
ClassName : array[0..255] of char;
FindWnd : HWND;
begin
Result := 0;
if ParentWnd = 0 then Exit;
FindWnd := GetWindow( ParentWnd, GW_CHILD );
while ( FindWnd <> 0 ) do begin
  if Boolean( GetClassName( FindWnd, ClassName, 255) ) then begin
    if string(ClassName) = FindClassName then begin
      Result := FindWnd;
      Break;
    end;
  end;
  FindWnd := GetNextWindow( FindWnd, GW_HWNDNEXT );
end;
end;
* 사용법
procedure FindWin;
var
MainWnd, ChildWnd, FindWnd : HWND;
begin
MainWnd := FindWindow( '클래스이름', nil);
ChildWnd := FindWindowEx( MainWnd, 0, '하위 클래스이름', nil );
FindWnd := FindWindowEx( MainWnd, ChildWnd, '찾고자하는 클래스이름', nil );
end;
일반적으로 위와같이 핸들을구합니다.
근데 위방법으로 안되는경우가 많습니다.
FindWnd := FindWindowEx( MainWnd, ChildWnd, '찾고자하는 클래스이름', nil );
이부분을
while ( ChildWnd <> 0 ) do begin
  FindWnd := SubWindowFind( ChildWnd, '찾고자하는 클래스이름' );
  if FindWnd <> 0 then
      Break;
end;
요렇게 고치면 됩니다.
procedure FindWin;
var
MainWnd, ChildWnd, FindWnd : HWND;
begin
MainWnd := FindWindow( '클래스이름', nil);
ChildWnd := FindWindowEx( MainWnd, 0, '하위 클래스이름', nil );
while ( ChildWnd <> 0 ) do begin
  FindWnd := SubWindowFind( ChildWnd, '찾고자하는 클래스이름' );
  if FindWnd <> 0 then
      Break;
  FindWnd := GetNextWindow( FindWnd, GW_HWNDNEXT );
end;
if FindWnd <> 0 then
  ShowMessage('핸들 구함..ㅎㅎ');
end;

“FindWindowEx”의 31개의 댓글

  1. I simply want to mention I’m newbie to blogging and actually loved your blog. Most likely I’m planning to bookmark your site . You really come with tremendous articles. Thanks a lot for sharing with us your web-site.

  2. I am just commenting to let you know of the perfect experience my wife’s princess encountered studying your web site. She picked up numerous details, most notably what it’s like to have an ideal helping character to have many more very easily gain knowledge of selected advanced subject matter. You undoubtedly exceeded our own expectations. Thanks for offering such effective, healthy, explanatory and in addition fun thoughts on this topic to Gloria.

  3. This is the best blog for anybody that intends to learn about this subject. You realize so much its almost tough to suggest with you (not that I really would want?HaHa). You definitely placed a brand-new spin on a subject thats been discussed for many years. Great stuff, just terrific!

  4. Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something enlightening to read?

  5. Aw, this was an actually nice blog post. In suggestion I would love to place in writing similar to this in addition? taking some time as well as actual effort to make a great post? however what can I claim? I postpone alot and also by no means appear to obtain something done.

  6. There are a few interesting points soon enough in this article but I don’t determine if every one of them center to heart. There is certainly some validity but I am going to take hold opinion until I investigate it further. Excellent post , thanks so we want far more! Added to FeedBurner too

  7. Aw, this was a really nice post. In suggestion I wish to put in creating similar to this furthermore? requiring time and actual effort to make an excellent article? but what can I say? I put things off alot as well as never appear to obtain something done.

  8. The next time I read a blog site, I wish that it doesn’t dissatisfy me as high as this set. I mean, I recognize it was my selection to read, but I in fact believed youd have something intriguing to say. All I listen to is a bunch of yawping concerning something that you could deal with if you werent as well busy trying to find focus.

  9. Can I just state what an alleviation to locate a person that really recognizes what theyre discussing on the net. You absolutely know how to bring an issue to light and make it vital. Even more individuals require to read this and also understand this side of the story. I angle believe youre not a lot more popular because you definitely have the gift.

  10. Can I simply claim what a relief to locate someone that really recognizes what theyre talking about on the web. You most definitely understand just how to bring a problem to light as well as make it essential. Even more individuals need to read this as well as comprehend this side of the story. I angle believe youre not much more preferred since you definitely have the gift.

  11. This web site is actually a walk-through for every one of the details you desired about this and didn?t recognize that to ask. Glimpse below, as well as you?ll absolutely uncover it.

  12. An interesting discussion deserves remark. I assume that you need to write extra on this topic, it could not be a taboo topic however generally people are not enough to speak on such subjects. To the following. Thanks

  13. Good message. I discover something much more challenging on different blogs everyday. It will certainly constantly be promoting to read content from various other writers and exercise a something from their store. I?d favor to use some with the content on my blog whether you don?t mind. Natually I?ll give you a web link on your internet blog. Many thanks for sharing.

  14. This web site is really a walk-through for every one of the details you wanted regarding this and didn?t understand who to ask. Glimpse right here, and you?ll absolutely find it.

  15. When I originally commented I clicked the -Alert me when brand-new comments are included- checkbox and also currently each time a remark is added I get 4 e-mails with the exact same comment. Is there any way you can remove me from that solution? Thanks!

  16. Oh my benefits! an incredible write-up man. Thanks However I am experiencing concern with ur rss. Don?t understand why Unable to sign up for it. Exists anybody getting the same rss trouble? Any person who recognizes kindly react. Thnkx

  17. This is the ideal blog site for anyone that wishes to find out about this subject. You realize so much its virtually tough to argue with you (not that I really would want?HaHa). You absolutely placed a brand-new spin on a subject thats been discussed for many years. Fantastic things, simply great!

댓글 남기기