Witam. Chciał bym napisać program, który wchodził by na strony w ukrytym IE.
Może najpierw przedstawię o co mi dokładnie chodzi:
-odczyt pliku .txt o treści:
http://www.onet.pl
http://www.google.pl
http://www.wp.pl
-otworzenie IE(ukrytego)
-wejście na stronę pierwszą
-po wejściu program ma odczekać 4 sekundy i zatrzymać ładowanie reszty strony
-odczekuje 10 sekund,
-wchodzi na kolejną, odczekuje, zatrzymuje...
Przedstawię teraz materiały jakie udało mi się zgromadzić:
Ukrywanie IE:
/**
Program: Internet Explorer Hider v1.0
File: hide.cpp
Purpose: Hides all instances of Internet Explorer windows when the [F8] key is pressed.
Note(s): Requires Microsoft Platform SDK
Compiled in Microsoft Visual C++ 6.0 (Win 98 SE)
This application can be terminated by pressing the [Esc] key.
Copyright © 2007 Brenton Andrew Saunders. All Right Reserved
[email protected] (Personal)
[email protected] (Business)
Last Revised 2/14/07
*/
#include <windows.h> // For Win32 API
/** Global Variables */
BOOL g_bHide = FALSE; // TRUE if all instances of Internet Explorer should be hidden
/** Function Prototypes */
BOOL CALLBACK EnumWindowsProc(HWND, LPARAM);
/**
Function: WinMain()
Purpose: Standard Win32-application entry point. Tests if the [F8] key is being pressed.
If so, it enumerates all top-level windows (See EnumWindowsProc).
Parameters (from MSDN):
hInstance - handle to current instance
hPrevInstance - handle to previous instance
lpCmdLine - pointer command line
nShowCmd - show state of window
Note(s): Hitting the [Esc] key causes the application to exit the main loop; thus ending
the program.
*/
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nShowCmd) {
while(TRUE) { // Main loop; Keeps the program running
if(GetAsyncKeyState(VK_F8) & 0x8000) { // Is the [F8] key being pressed ?
// Determine whether to show or hide all instances of Internet Explorer
if(g_bHide == TRUE) {
g_bHide = FALSE;
}
else
g_bHide = TRUE;
EnumWindows(EnumWindowsProc, (LPARAM)NULL);
while(GetAsyncKeyState(VK_F8) & 0x8000); // Wait until the [F8] key is released to continue ...
}
else if(GetAsyncKeyState(VK_ESCAPE) & 0x8000) { // Is the [Esc] key being pressed ?
break; // Terminate the application
}
Sleep(0); // So we won't be a CPU hog
}
return 0;
}
/**
Function: EnumWindowsProc()
Purpose: Enumerates all top-level windows. If the enumerated window is an Internet Explorer
window, then it is hidden based on the value of g_bHide.
Parameters (from MSDN):
hwnd - pointer to callback function
lParam - application-defined value
Note(s): N/A
*/
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) {
CHAR szClassName[80];
GetClassName(hwnd, szClassName, 80); // Retrieve the class name of the enumerated window
if(lstrcmp(szClassName, "IEFrame") == 0) { // Is it an Internet Explorer window ?
if(g_bHide == TRUE) { // Should we restore or hide the window ?
ShowWindow(hwnd, SW_HIDE); // Hide the window
}
else
ShowWindow(hwnd, SW_SHOW); // Show the window
}
return TRUE;
}
Wchodzenie na strony:
plik.seekg(0, ios::beg);
while(!plik.eof()){
char start[100] = "start ";
string str;
getline(plik,str);
str.copy(link,100);
strcat(start,link); //sam nie rozumie... ale dziala
system(start);
memset(start,'\0',strlen(start));
memset(link,'\0',strlen(link));
DelaySecs(x);
}
plik.close();
Potrzebuje teraz funkcji naciskającej klawisz ESC(zatrzymanie ładowania strony) i pomocy jak to posklejać bo ja już się pogubiłem :(
Z poważaniem,
evolucja.</ort>