Click here to Skip to main content
15,914,327 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to format like this 123,456,789.00? Pin
Randor 8-Nov-08 19:00
professional Randor 8-Nov-08 19:00 
AnswerRe: How to format like this 123,456,789.00? Pin
Hamid_RT8-Nov-08 20:22
Hamid_RT8-Nov-08 20:22 
QuestionWhy dosen't ShellExecute run some of commands? Pin
Joseph Marzbani8-Nov-08 9:26
Joseph Marzbani8-Nov-08 9:26 
AnswerRe: Why dosen't ShellExecute run some of commands? Pin
Mark Salsbery8-Nov-08 13:43
Mark Salsbery8-Nov-08 13:43 
AnswerRe: Why dosen't ShellExecute run some of commands? Pin
Joseph Marzbani8-Nov-08 16:56
Joseph Marzbani8-Nov-08 16:56 
GeneralRe: Why dosen't ShellExecute run some of commands? Pin
toxcct9-Nov-08 2:53
toxcct9-Nov-08 2:53 
GeneralRe: Why dosen't ShellExecute run some of commands? Pin
Mark Salsbery9-Nov-08 6:10
Mark Salsbery9-Nov-08 6:10 
QuestionGet the lparam of a SETTEXT hook message Pin
ignacio rivera8-Nov-08 8:00
ignacio rivera8-Nov-08 8:00 
The next question is about catching all the SETTEXT message that are sent to a specific window:

I'm trying to hook all the settext messages that are sent to a specific window. The hook works almost perfectly, it intercepts all the settext messages and gets de windows handle stored in the pwp structure. pwp is a CWPRETSTRUCT type structure that contains the information of the SETTEXT hooked message.
The problem is that I can't get the text(caption) send to the window stored in the LPARAM of the settext hooked message (pwp->lParam. I only get garbage).
The idea is to get the text send to the window and save it to a file.
Im using a CallWndRetProc hook.

Here is my code.

LRESULT CALLBACK CallWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
{
TCHAR *a;
FILE *f1;
if(nCode < 0)
{
return CallNextHookEx(hook, nCode, wParam, lParam);
}
if (nCode == HC_ACTION)
{
CWPRETSTRUCT* pwp = (CWPRETSTRUCT*)lParam;
UINT message = pwp->message;
if (message == WM_SETTEXT)
{
unsigned int whandle = (unsigned int) pwp->hwnd;

// globalvar contains the
// (unsigned int)window's handle I want to catch.
if (whandle == globalvar)
{
LPARAM l = pwp->lParam;

// The problem is on the next line.
// Var a only gets garbage.
a = (TCHAR *) l
f1=fopen("c:\\hook.txt","a+");
fprintf(f1,"%d %s\n", whandle, a);
fclose(f1);
}
}
}
return CallNextHookEx(hook, nCode, wParam, lParam);
}


Ignacio Rivera
Mexico
AnswerRe: Get the lparam of a SETTEXT hook message Pin
AtomAnt10-Nov-08 8:08
AtomAnt10-Nov-08 8:08 
QuestionHow to Display a SDI Application Started with main window hidden Pin
vikrant kpr8-Nov-08 7:09
vikrant kpr8-Nov-08 7:09 
AnswerRe: How to Display a SDI Application Started with main window hidden Pin
Mark Salsbery8-Nov-08 8:07
Mark Salsbery8-Nov-08 8:07 
GeneralRe: How to Display a SDI Application Started with main window hidden Pin
vikrant kpr8-Nov-08 8:18
vikrant kpr8-Nov-08 8:18 
QuestionHow can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
Joseph Marzbani8-Nov-08 6:09
Joseph Marzbani8-Nov-08 6:09 
QuestionRe: How can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
CPallini8-Nov-08 6:22
mveCPallini8-Nov-08 6:22 
AnswerRe: How can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
Joseph Marzbani8-Nov-08 8:00
Joseph Marzbani8-Nov-08 8:00 
GeneralRe: How can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
CPallini8-Nov-08 9:52
mveCPallini8-Nov-08 9:52 
AnswerRe: How can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
Mark Salsbery8-Nov-08 8:29
Mark Salsbery8-Nov-08 8:29 
AnswerRe: How can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
Saurabh.Garg8-Nov-08 13:27
Saurabh.Garg8-Nov-08 13:27 
AnswerRe: How can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
Joseph Marzbani8-Nov-08 17:04
Joseph Marzbani8-Nov-08 17:04 
GeneralRe: How can I compress (zip) a file using pure win32/64 API or plain "C++"? Pin
Saurabh.Garg8-Nov-08 18:47
Saurabh.Garg8-Nov-08 18:47 
QuestionGetVolumeInformation in a Simple DLL Pin
logicon8-Nov-08 4:32
logicon8-Nov-08 4:32 
AnswerRe: GetVolumeInformation in a Simple DLL Pin
CPallini8-Nov-08 5:03
mveCPallini8-Nov-08 5:03 
GeneralRe: GetVolumeInformation in a Simple DLL Pin
logicon8-Nov-08 5:24
logicon8-Nov-08 5:24 
GeneralRe: GetVolumeInformation in a Simple DLL Pin
CPallini8-Nov-08 6:14
mveCPallini8-Nov-08 6:14 
GeneralRe: GetVolumeInformation in a Simple DLL Pin
logicon8-Nov-08 5:35
logicon8-Nov-08 5:35 

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.