Search Results

Search found 2 results on 1 pages for 'user261882'.

Page 1/1 | 1 

  • How to set global hook for WH_CALLWNDPROCRET ?

    - by user261882
    Hello I want to set global hook that tracks which application is active. In my main program I am doing the foloowing : HMODULE mod=::GetModuleHandle(L"HookProcDll"); HHOOK rslt=(WH_CALLWNDPROCRET,MyCallWndRetProc,mod,0); The hook procedure which is called MyCallWndRetProc exists in separate dll called HookProcDll.dll. The hook procedure is watching for WM_ACTIVATE message. The thing is that the code stucks in the line where I am setting the hook, i.e in the line where I am calling ::SetWindowsHookEx. And then Windows gets unresponsive, my task bar disappears and I am left with empty desktop. Then I must reset the computer. What am doing wrong, why Windows get unresponsive ? and Do I need to inject HookProcDll.dll in every process in order to set the global hook, and how can I do that ?

    Read the article

  • How to get number of bytes read from QTextStream

    - by user261882
    The following code I am using to find the number of read bytes from QFile. With some files it gives the correct file size, but with some files it gives me a value that is approximatively fileCSV.size()/2. I am sending two files that have same number of characters in it, but have different file sizes link text. Should i use some other objects for reading the QFile? QFile fileCSV("someFile.txt"); if ( !fileCSV.open(QIODevice::ReadOnly | QIODevice::Text)) emit errorOccurredReadingCSV(this); QTextStream textStreamCSV( &fileCSV ); // use a text stream int fileCSVSize = fileCSV.size()); qint64 reconstructedCSVFileSize = 0; while ( !textStreamCSV.atEnd() ) { QString line = textStreamCSV.readLine(); // line of text excluding '\n' if (!line.isEmpty()) { reconstructedCSVFileSize += line.size(); //this doesn't work always reconstructedCSVFileSize += 2; } else reconstructedCSVFileSize += 2; } I know that reading the size of QString is wrong, give me some other solutions if you can. Thank you.

    Read the article

1