Click here to Skip to main content
16,008,490 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: looping a function Pin
Kharfax28-Dec-06 5:22
Kharfax28-Dec-06 5:22 
GeneralRe: looping a function Pin
Johan Pretorius28-Dec-06 5:28
Johan Pretorius28-Dec-06 5:28 
GeneralRe: looping a function Pin
Johan Pretorius28-Dec-06 5:26
Johan Pretorius28-Dec-06 5:26 
GeneralRe: looping a function Pin
Johan Pretorius28-Dec-06 5:30
Johan Pretorius28-Dec-06 5:30 
GeneralRe: looping a function Pin
Kharfax28-Dec-06 5:32
Kharfax28-Dec-06 5:32 
GeneralRe: looping a function Pin
dellthinker28-Dec-06 6:55
dellthinker28-Dec-06 6:55 
QuestionRe: looping a function Pin
David Crow28-Dec-06 6:48
David Crow28-Dec-06 6:48 
AnswerRe: looping a function Pin
dellthinker28-Dec-06 6:57
dellthinker28-Dec-06 6:57 
Wow, i didnt think i'd get these many replies. Thanx for the suggestions everyone, however i have a question. Is there a way i can loop the FindWindow function?

Here's a sample code:

<br />
#include <windows.h><br />
#include <stdio.h><br />
#include <fstream><br />
using namespace std;<br />
int main()<br />
{<br />
	while(1){<br />
		sleep(6);<br />
		short ie;<br />
		for(ie=0;ie<=200;ie++){<br />
			HWND handle=FindWindow("IEFrame",0);<br />
			HWND handle2=FindWindowEx(handle, 0, "WorkerW",0);<br />
			HWND handle3=FindWindowEx(handle2, 0, "ReBarWindow32", 0);<br />
			HWND handle4=FindWindowEx(handle3,0,"Address Band Root",0);<br />
			HWND handle5=FindWindowEx(handle4,0,"ComboBoxEx32",0);<br />
			HWND handle6=FindWindowEx(handle5,0,"ComboBox",0);<br />
			HWND handle7=FindWindowEx(handle6,0,"Edit",0);<br />
			char addy[MAX_PATH];<br />
			SendMessage(handle7,WM_GETTEXT,MAX_PATH,(LPARAM)(LPCSTR)addy);<br />
			if(strstr(addy,"http:")!=NULL){<br />
				ofstream out;<br />
				out.open("http.txt",ios::app);<br />
				out << addy << endl;<br />
				out.close();<br />
			}<br />
				else if(strstr(addy,"https:")!=NULL){<br />
					ofstream in;<br />
					in.open("https.txt",ios::app);<br />
					in << addy << endl;<br />
					in.close();<br />
				}<br />
		}<br />
	}	<br />
		<br />
	return 0;<br />
}<br />


This will keep looping but not the way that i want. It returns the address like 3000 times when all i want is once. The idea is to keep the program running and keep finding the window and return what it finds only once. And then if its something different log that too etc. Any suggestions?
Questionstoring value in buf Pin
ikbahrian28-Dec-06 4:23
ikbahrian28-Dec-06 4:23 
AnswerRe: storing value in buf Pin
Chris Losinger28-Dec-06 4:32
professionalChris Losinger28-Dec-06 4:32 
AnswerRe: storing value in buf Pin
Reagan Conservative28-Dec-06 4:33
Reagan Conservative28-Dec-06 4:33 
GeneralRe: storing value in buf Pin
ikbahrian28-Dec-06 4:44
ikbahrian28-Dec-06 4:44 
AnswerRe: storing value in buf Pin
Gary R. Wheeler28-Dec-06 5:12
Gary R. Wheeler28-Dec-06 5:12 
AnswerRe: storing value in buf Pin
Sumesh V.V28-Dec-06 21:15
Sumesh V.V28-Dec-06 21:15 
GeneralRe: storing value in buf Pin
ikbahrian28-Dec-06 22:32
ikbahrian28-Dec-06 22:32 
QuestionProbe for manifest error Pin
Kharfax28-Dec-06 3:39
Kharfax28-Dec-06 3:39 
AnswerRe: Probe for manifest error Pin
Wes Aday28-Dec-06 4:06
professionalWes Aday28-Dec-06 4:06 
GeneralRe: Probe for manifest error Pin
Kharfax28-Dec-06 4:15
Kharfax28-Dec-06 4:15 
QuestionHow to read a file line by line in VC++ Pin
vikram.vit28-Dec-06 3:08
vikram.vit28-Dec-06 3:08 
AnswerRe: How to read a file line by line in VC++ Pin
prasad_som28-Dec-06 3:29
prasad_som28-Dec-06 3:29 
AnswerRe: How to read a file line by line in VC++ Pin
jk chan28-Dec-06 3:38
jk chan28-Dec-06 3:38 
AnswerRe: How to read a file line by line in VC++ Pin
David Crow28-Dec-06 4:18
David Crow28-Dec-06 4:18 
GeneralRe: How to read a file line by line in VC++ Pin
Sumesh V.V28-Dec-06 21:18
Sumesh V.V28-Dec-06 21:18 
AnswerRe: How to read a file line by line in VC++ Pin
Hamid_RT28-Dec-06 6:06
Hamid_RT28-Dec-06 6:06 
GeneralRe: How to read a file line by line in VC++ Pin
vikram.vit28-Dec-06 17:52
vikram.vit28-Dec-06 17:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.