Return the window title

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 374
Reputation: Clockowl is on a distinguished road 
Solved Threads: 27
Clockowl's Avatar
Clockowl Clockowl is offline Offline
Posting Whiz

Re: Return the window title

 
0
  #11
Feb 11th, 2009
The "numbers" are the size of the buffer, but you could've easily looked that one up on MSDN. "%d" means decimal. It's the format thingie for signed and unsigned decimal numbers I thought, might wanna check that.
Last edited by Clockowl; Feb 11th, 2009 at 3:30 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 7
Reputation: fskreuz is an unknown quantity at this point 
Solved Threads: 1
fskreuz fskreuz is offline Offline
Newbie Poster

Re: Return the window title

 
0
  #12
Feb 19th, 2009
it's not the process or module id right? the %d thing i mean
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 374
Reputation: Clockowl is on a distinguished road 
Solved Threads: 27
Clockowl's Avatar
Clockowl Clockowl is offline Offline
Posting Whiz

Re: Return the window title

 
0
  #13
Feb 20th, 2009
%d is just a format character for format strings used by print and scan functions. Check it out

In my code it's the window handle. A "window pointer" as it were, for Windows.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 7
Reputation: fskreuz is an unknown quantity at this point 
Solved Threads: 1
fskreuz fskreuz is offline Offline
Newbie Poster

Re: Return the window title

 
0
  #14
Feb 24th, 2009
can anyone explain why this code does not do what it's supposed to? im new to this C++ thing and im just "shocked" of its broadness and stuff. this code is supposed to find a browser, in this case, firefox, get its text and for clarity and just to be sure if it was spelled right or something, outputted to a text file.

  1. #include <windows.h>
  2. #include <fstream>
  3. #include <iostream>
  4.  
  5. char windowtitle[MAX_PATH];
  6. char windowclass[MAX_PATH];
  7. std::string Filename = "netlog.txt";
  8. std::fstream FStream;
  9.  
  10. int DisplayWindows(HWND hWnd, LPARAM lParam);
  11.  
  12. int main(){
  13.  
  14. FStream.open(Filename.c_str(), std::fstream::out | std::fstream::app);
  15. EnumWindows((WNDENUMPROC) DisplayWindows,(LPARAM) NULL);
  16. Sleep(1000);
  17. FStream.close();
  18. return 0;
  19. }
  20.  
  21. int DisplayWindows(HWND hWnd, LPARAM lParam){
  22. GetClassName(hWnd, windowclass, MAX_PATH);
  23. if(windowclass=="MozillaUIWindowClass"){
  24. GetWindowText(hWnd, windowtitle, MAX_PATH);
  25. FStream << windowtitle << "\n";
  26. }
  27. return 1;
  28. }

i just copied the code from clockowl yet in the part where i try to find the firefox if(windowclass=="MozillaUIWindowClass") part, it cannot find firefox. i tested it with the "!=" in place of "==" and there was firefox along with the other classes not equal to MozillaUIWindowClass. it seems that there is some error in the comparison which i cannot get.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC