I am creating an application that needs to load different settings depending on the active window / program ( Eg using Chrome, setting associates with Chrome are loaded when you switch to MS Word, MS Word settings are loaded).
Right now I am working on a class that will get the right settings from a database that changes in the active window every time there will also be a "lookup" method in this class, which were last received Returns a value based on the setting.
What I'm trying to implement in the phishing code:
class RecipeBook {public: RecipeBook (); HWINEVENTEVENTHOOK hEvent; String current program; Static void callback WindowCallback (HWINEVENTHOOK hWinEventHook, DWORD dwEvent, HWND hwnd, long idObject, long idChild, DWORD dwEventThread, DWORD dwmsEventTime); // Actual callback zero message check (zero *); } RecipeBook :: RecipeBook () {This-> hEvent = SetWinEventHook (EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, zero, & amp; WinEventProcCallback, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); Start Message (Zero *) in separate thread) Zero Message Check (Zero *) {MSG msg; While (GetMessage (& msg, NULL, 0, 0)) {translation message (& amp; msg); DispatchMessage (& amp; msg); }} Void callback WindowCallback (HWINEVENTHOOK hWinEventHook, go DWORD dwEvent, HWND hwnd, long idObject, long idChild, DWORD dwEventThread, DWORD dwmsEventTime) is working & RecipeBook- active program Name handle // This update {HWND gt; CurrentProgram} I'm having problems with:
1) Message check can not be found to run in a separate thread. If I sequentially code runs like it works fine when I tried using to messageCheck eggs in a formula (
AfxBeginThread (& amp; messageCheck, & amp; currentProgram , THREAD_PRIORITY_NORMAL, 0, 0, zero) )
It does not seem that the second thread is created.
2) I do not know how to modify values from callback in the reChipbook. I have thought about returning the callback, but I have not succeeded in working it. It would be nice if I could edit the string from within the callback. 3) When I was called the Lookup method, I was still asking for the current active program, but I was able to find only those methods which receive the calling ID, but not Active window process id
This is a big question but any advice would be greatly appreciated!
Thank you!
GetForgroundWindow () That's what I What was watching!
As long as there is a good explanation can not provide how multitasking, callback stuff, I'm just going to use this function and when is also a lookup ask the current window. This should not happen often and this process will not take long.
In the window you use in the handle, you get the name of the process from the active window / PID, For, how am I doing this:
DWORD process ID; LPTSTR process name = new TCHAR [MAX_PATH]; DWORD name size = MAX_PATH; Hwnd activationH = gearfindwondo (); DWORD threadID = GetWindowThreadProcessId (active WindowH, and processID); Handle process suspend = open process (PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_QUERY_INFORMATION, FALSE, processID); BOOL nameSuccess = QueryFullProcessImageName (Process Shell, 0, Process Name, & Name Seas); Cheers!
No comments:
Post a Comment