|
-
Feb 16th, 2001, 05:19 PM
#1
Ok im making an app to go with netzero that will send messages to the ad bar so it will bot kick you off the net. Ive got it to where i can send the message, then the default web browser opens. Now i need to automaticly close that newly opened browser. Any ideas?
-
Feb 16th, 2001, 05:30 PM
#2
Frenzied Member
Do they always have something the same in the title bar? Like "Netzero Add" or something?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Feb 16th, 2001, 06:38 PM
#3
Nope, its different with every add. Is there some way to get the newest window that has opened?
-
Feb 16th, 2001, 06:40 PM
#4
Frenzied Member
Hmm you could keep a list of all the current window handles when your app starts, then with a timer continue to check for handles that is not part of the previous list, then send it your message when it finds one.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Feb 16th, 2001, 07:33 PM
#5
How do i get a list of all the window handles?
-
Feb 16th, 2001, 07:37 PM
#6
Frenzied Member
Here but its going to be in MFC, but I am sure you can weed that stuff out. It is right now set to search for every window with "Instant Message", just set it to be "" instead.
Code:
BOOL CALLBACK CFindWindows::SearchFor(HWND hWnd, LPARAM lParam)
{
char strBuffer[MAX_PATH]; //Buffer To Hold The Window Title
CString strComp; //The String The Holds The String To Find (Instant Message)
CString strFound; //Holds The Buffer String To Allow Searching
int ret = 0;
::GetWindowText(hWnd,strBuffer,MAX_PATH); //Gets Window Title On Each Enum
strFound = strBuffer; //Gets The Buffer String To Allow CString Searching
if (strFound == "") //If The String Is Empty Quit Function
return true;
strComp = "Instant Message"; //Sets The Search String
ret = strFound.Find(strComp,0); //Search For The Search String
if (!(ret == -1)) //If Search String Is Found
{
CFindWindows::InArray(hWnd);
}
return true;
}
void CFindWindows::StartFind()
{
CSendMessages tmp;
if (tmp.CheckTextOut() == true) //Insure That Message Text Is There
::EnumWindows(SearchFor,(LPARAM)this); //Enum Every Window
}
bool CFindWindows::InArray(HWND hWnd)
{
int ret; //Used To Hold The Array Size
int i; //Used For The For Loop
bool Found = false; //Used To Check If The Window Already Exists
ret = PreWindows.GetSize(); //Gets Array Size
if (ret == 0) //If Array = 0
{
PreWindows.Add(hWnd); //Add To The Array
Found = true; //Keep From Adding Again
CSendMessages tmp; //Sets tmp To CSendMessages Class
tmp.MsgOut(hWnd); //Runs The MsgOut Function
}
else
{
for (i=0; i < ret; i++) //Searchs The Array To Insure There Is No Repeating
{
if (PreWindows[i] == hWnd)
{
Found = true;
}
}
}
if (Found == false)
{
PreWindows.Add(hWnd);
CSendMessages tmp;
tmp.MsgOut(hWnd);
}
return true;
}
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|