Click here to Skip to main content
14,270,872 members

C / C++ / MFC

 
GeneralRe: HRESULT variable returning negative value Pin
Richard MacCutchan30-Jun-19 10:14
protectorRichard MacCutchan30-Jun-19 10:14 
AnswerRe: HRESULT variable returning negative value Pin
Stefan_Lang30-Jun-19 22:09
memberStefan_Lang30-Jun-19 22:09 
PraiseRe: HRESULT variable returning negative value Pin
Member 144995631-Jul-19 4:05
memberMember 144995631-Jul-19 4:05 
GeneralRe: HRESULT variable returning negative value Pin
Stefan_Lang1-Jul-19 21:31
memberStefan_Lang1-Jul-19 21:31 
GeneralRe: HRESULT variable returning negative value Pin
Member 144995632-Jul-19 6:29
memberMember 144995632-Jul-19 6:29 
QuestionHook stops application Pin
Mark_G0027-Jun-19 5:34
memberMark_G0027-Jun-19 5:34 
AnswerRe: Hook stops application Pin
leon de boer27-Jun-19 7:13
memberleon de boer27-Jun-19 7:13 
GeneralRe: Hook stops application Pin
Mark_G0028-Jun-19 3:23
memberMark_G0028-Jun-19 3:23 
Thank you for your reply!

Are you sure about this? I'm using "SetWindowsHookEx" to set the hook, so Windows knows it anyway and the console is also a window. Please correct me, if I'm wrong.

I made one mistake. I think using GetWindowTextLength & GetWindowText are not a good idea in the hook. The application is waiting for the hook and the hook is waiting to get an answer from the application now. I removed it and the app does not freezing anymore.

The handle and message in "CWPSTRUCT* pCwp = (CWPSTRUCT*)lParam;" are good, but I'm having a hard time getting the string from the message.

WM_SETTEXT message ::: lParam = A pointer to a null-terminated string that is the window text. In this case this should be pCwp->lParam It looks like the pointer address is different from the one I see in Spy++, but I'm not sure if I even convert it right.

I tried this to get the pointer address as string, but it seems to be wrong
wsprintf(tcTemp, L"0x%08p", pCwp->lParam);
wStrTemp = tcTemp;
std::string strHexParam = std::string(wStrTemp.begin(), wStrTemp.end());

I tried this to get the message string, but it's not working as well
LPCTSTR lpszString = (LPCTSTR)pCwp->lParam;
COPYDATASTRUCT cds;
cds.dwData = 0;
cds.cbData = sizeof(TCHAR)* (wcslen(lpszString) + 1);
cds.lpData = (PVOID)lpszString;

GeneralRe: Hook stops application Pin
Victor Nijegorodov28-Jun-19 4:50
memberVictor Nijegorodov28-Jun-19 4:50 
GeneralRe: Hook stops application Pin
Mark_G0028-Jun-19 6:41
memberMark_G0028-Jun-19 6:41 
GeneralRe: Hook stops application Pin
Victor Nijegorodov28-Jun-19 7:45
memberVictor Nijegorodov28-Jun-19 7:45 
GeneralRe: Hook stops application Pin
Mark_G0028-Jun-19 9:03
memberMark_G0028-Jun-19 9:03 
GeneralRe: Hook stops application Pin
leon de boer28-Jun-19 20:59
memberleon de boer28-Jun-19 20:59 
GeneralRe: Hook stops application Pin
Mark_G0029-Jun-19 3:36
memberMark_G0029-Jun-19 3:36 
QuestionImporting enhanced metafile from ms word to MFC problem Pin
zakomed24-Jun-19 3:55
memberzakomed24-Jun-19 3:55 
QuestionCStringList on heap Pin
_Flaviu18-Jun-19 23:38
member_Flaviu18-Jun-19 23:38 
QuestionRe: CStringList on heap Pin
CPallini19-Jun-19 2:19
mveCPallini19-Jun-19 2:19 
AnswerRe: CStringList on heap Pin
_Flaviu19-Jun-19 19:36
member_Flaviu19-Jun-19 19:36 
GeneralRe: CStringList on heap Pin
CPallini20-Jun-19 4:49
mveCPallini20-Jun-19 4:49 
AnswerRe: CStringList on heap Pin
Maximilien19-Jun-19 3:43
memberMaximilien19-Jun-19 3:43 
GeneralRe: CStringList on heap Pin
_Flaviu19-Jun-19 19:38
member_Flaviu19-Jun-19 19:38 
GeneralRe: CStringList on heap Pin
Richard MacCutchan19-Jun-19 21:07
protectorRichard MacCutchan19-Jun-19 21:07 
GeneralRe: CStringList on heap Pin
Stefan_Lang19-Jun-19 23:20
memberStefan_Lang19-Jun-19 23:20 
GeneralRe: CStringList on heap Pin
jschell23-Jun-19 5:54
memberjschell23-Jun-19 5:54 
GeneralRe: CStringList on heap Pin
Stefan_Lang23-Jun-19 21:02
memberStefan_Lang23-Jun-19 21:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.