| | |
Return the window title
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
%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.
In my code it's the window handle. A "window pointer" as it were, for Windows.
•
•
Join Date: Feb 2009
Posts: 7
Reputation:
Solved Threads: 1
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.
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.
C++ Syntax (Toggle Plain Text)
#include <windows.h> #include <fstream> #include <iostream> char windowtitle[MAX_PATH]; char windowclass[MAX_PATH]; std::string Filename = "netlog.txt"; std::fstream FStream; int DisplayWindows(HWND hWnd, LPARAM lParam); int main(){ FStream.open(Filename.c_str(), std::fstream::out | std::fstream::app); EnumWindows((WNDENUMPROC) DisplayWindows,(LPARAM) NULL); Sleep(1000); FStream.close(); return 0; } int DisplayWindows(HWND hWnd, LPARAM lParam){ GetClassName(hWnd, windowclass, MAX_PATH); if(windowclass=="MozillaUIWindowClass"){ GetWindowText(hWnd, windowtitle, MAX_PATH); FStream << windowtitle << "\n"; } return 1; }
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.
![]() |
Similar Threads
- Open In New Window Php (PHP)
- Calendar window is not coming for the Dynamic rows (JavaScript / DHTML / AJAX)
- HELP! With Javascripts Pop-Up Window (JavaScript / DHTML / AJAX)
- write issues (JavaScript / DHTML / AJAX)
- Using Global Low-Level Hooks Without Using A Dll (Computer Science)
- !Help! spyware/virus problem! (Viruses, Spyware and other Nasties)
- Cryptography Fun (Python)
- spyware i remove keeps coming back (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: How to use an array element in if-statement?
- Next Thread: HELP!! trying to write a quiz program part 1
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop developer directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





