Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mainwindow.h"
- BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lp)
- {
- WCHAR str[256];
- GetWindowText(hWnd,str,256);
- QString s(QString::fromWCharArray(str));
- if ( s.size() && s.contains("loopbe") )
- {
- //qDebug() << s;
- HWND wnd = GetWindow(hWnd,GW_CHILD);
- while ( wnd != NULL )
- {
- WCHAR wndName[1024];
- WCHAR wndClassName[1024];
- GetWindowText(wnd,wndName,1024);
- GetClassName(wnd,wndClassName,1024);
- //qDebug() << GetWindowLong(wnd,GWL_STYLE) << QString::fromWCharArray(wndClassName) << QString::fromWCharArray(wndName);
- if ( QString::fromWCharArray(wndName) == "Mute" )
- {
- // LRESULT state = SendMessage(wnd,BM_GETSTATE,0,0);
- //qDebug() << state;
- //if ( )
- {
- SendMessage(wnd,BM_SETCHECK,BST_CHECKED,0);
- SendMessage(wnd,BM_CLICK,0,0);
- }
- }
- wnd = GetWindow(wnd,GW_HWNDNEXT);
- }
- return false;
- }
- return true;
- }
- void MainWindow::editChanged(QString str)
- {
- timer->setInterval(str.toInt());
- }
- MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
- {
- timer = new QTimer(this);
- connect ( timer,SIGNAL(timeout()),this,SLOT(checkstate()) );
- le = new QLineEdit( "10" );
- connect ( le,SIGNAL(textChanged(QString)),this, SLOT(editChanged(QString)) );
- setCentralWidget ( le );
- timer->start(10);
- }
- void MainWindow::checkstate()
- {
- while (EnumWindows(EnumWindowsProc,1L));
- }
- MainWindow::~MainWindow()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement