#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <tlhelp32.h>
#include <vector>
#include <string>
#include <ShellAPI.h>
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
...
EnumWindows(EnumWindowsProc, NULL);
....
std::string progtitle("Notepad.exe");
GetClassNameA(hwnd3,class_name, sizeof(class_name));
GetWindowTextA(hwnd3,title,sizeof(title));
std::string wintitle(title);
//std::string classname(class_name);
if(wintitle.find(progtitle) != std::string::npos)
{
bTitleFound = TRUE;
wintitleglb = wintitle;
//MessageBoxA(0, classname.c_str(), "MessageBox caption", MB_OK);
HWND iHandle = FindWindowA("TabThumbnailWindow", wintitle.c_str());
if(iHandle)
{
SendMessage(iHandle, WM_SYSCOMMAND, SC_CLOSE, 0);
}
else
{
iHandle = FindWindowA("IEFrame", wintitle.c_str());
if(iHandle)
{
SendMessage(iHandle, WM_SYSCOMMAND, SC_CLOSE, 0);
}
}
}
return TRUE;
}
Aucun commentaire:
Publier un commentaire