so I have been trying to simulate a click on my file explorer window to get back from my open folder to the previous directory. Straight forward. So I used SpyXX to know the window's names, so I can simulate this click.
Here is my code:
int main(int argc, char *argv[])
{
HWND hwnd = FindWindowA("CabinetWClass", "SpyXX");
if(!hwnd) {
std::cout << "Error: Cannot find window!" << std::endl;
}
else {
std::cout << "Success! Window found!" << std::endl;
}
HWND hwnd2 = FindWindowExA(hwnd, NULL, "WorkerW", "");
if(!hwnd2) {
std::cout << "Error: Cannot find child window!" << std::endl;
}
else {
std::cout << "Success! Child window found!" << std::endl;
}
HWND hwnd3 = FindWindowExA(hwnd2, NULL, "ReBarWindow32", "");
if(!hwnd3) {
std::cout << "Error: Cannot find child window!" << std::endl;
}
else {
std::cout << "Success! Child window found!" << std::endl;
}
HWND hwnd4 = FindWindowExA(hwnd3, NULL, "UpBand", "");
if(!hwnd4) {
std::cout << "Error: Cannot find child window!" << std::endl;
}
else {
std::cout << "Success! Child window found!" << std::endl;
}
HWND hwnd5 = FindWindowExA(hwnd4, NULL, "ToolbarWindow32", "Nach-oben-Symbolleiste");
if(!hwnd5) {
std::cout << "Error: Cannot find child window!" << std::endl;
}
else {
std::cout << "Success! Child window found!" << std::endl;
}
SendMessageA(hwnd5, BM_CLICK, 0, 0);
return 1;
}
And my output shows that the window has been found:
Success! Window found!
Success! Child window found!
Success! Child window found!
Success! Child window found!
Success! Child window found!
However the SendMessageA command doesn't do anything. The file explorer window doesn't change, meaning the 'back' button has not been pressed. Why is that? What am I doing wrong? I also used the SendMessageW and SendMessage commands to no avail.
Thanks alot in advance.