#include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hWin, hTab, hRestoreBtn, hOKBtn; int i = 0; ShellExecute((HWND)hInstance, "open", "AMDGPUClockTool.exe", NULL, NULL, SW_MINIMIZE); do { hWin = FindWindow(NULL, "AMD GPU Clock Tool"); Sleep(50); if (i++ > 200) return 1; } while(hWin == NULL); hTab = FindWindowEx(hWin, 0, "#32770", "Clock"); hRestoreBtn = FindWindowEx(hTab, 0, "Button", "Restore Default Clocks"); hOKBtn = FindWindowEx(hWin, 0, "Button", "OK"); // press restore & ok btn SendMessage (hRestoreBtn, BM_CLICK, 0, 0); SendMessage (hOKBtn, BM_CLICK, 0, 0); return 0; }