Click here to Skip to main content
15,896,557 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how draw semi transparent object Pin
SandipG 9-Sep-08 21:18
SandipG 9-Sep-08 21:18 
GeneralRe: how draw semi transparent object Pin
nattyting9-Sep-08 21:35
nattyting9-Sep-08 21:35 
GeneralRe: how draw semi transparent object Pin
nattyting10-Sep-08 20:47
nattyting10-Sep-08 20:47 
GeneralRe: how draw semi transparent object Pin
SandipG 10-Sep-08 23:05
SandipG 10-Sep-08 23:05 
Questionhow to remove border of web browser object Pin
only_jack9-Sep-08 10:34
only_jack9-Sep-08 10:34 
AnswerRe: how to remove border of web browser object Pin
Naveen9-Sep-08 14:04
Naveen9-Sep-08 14:04 
GeneralRe: how to remove border of web browser object Pin
only_jack10-Sep-08 6:08
only_jack10-Sep-08 6:08 
QuestionWM_SETTEXT and Virtual Address Space [modified] Pin
sawerr9-Sep-08 10:26
sawerr9-Sep-08 10:26 
Hi
1-) I compiled a DLL which is a hook dll. It calls SetWindowHookEx and hook Keyboard. and there is a hookproc.
//DLL
void StartHook(HWND hWnd)
{

	hHook = SetWindowsHookEx(WH_KEYBOARD, HookProc, hmod, NULL);
	hWndServer = hWnd;
	
};


2-) And I compiled a MFC app. which includes this dll. And calls StartHook. Also it sends its handle to dll. So they can communicate each other.

//EXE 
       HWND hWnd = ::GetDlgItem(this->m_hWnd, IDC_EDIT1);
	StartHook(hWnd);

3-) In MFC app. there is an edit control which I want to show dynamically which keys user pressed.
So first i get editcontrols textlength
int textlength = SendMessage(hWndServer, WM_GETTEXTLENGTH, 0, 0) + 1 ;
and then try to replace text of the edit control with WM_SETTEXT:

// DLL
TCHAR *td = new TCHAR(textlength+1);
		SendMessage(hWndServer, WM_GETTEXT, textlength, (LPARAM)td);
		

		SendMessage(hWndServer, WM_SETTEXT, 0, (LPARAM)td);  
		delete[] td;


4-) It doesn't work and run-time error.

Here something wrong.
In MSDN for WM_Settext's lParam parameter:
"Pointer to a null-terminated string that is the window text."

It is a pointer to another process address space and with sendmessage it is sended to another process. And it is meaningless for other process.
Is this caused run-time error?

How can i solve this problem? (I mean using WM_settext to send a string to another process)

Thanks..

modified on Tuesday, September 9, 2008 4:42 PM

AnswerRe: WM_SETTEXT and Virtual Address Space Pin
Mark Salsbery9-Sep-08 12:13
Mark Salsbery9-Sep-08 12:13 
GeneralRe: WM_SETTEXT and Virtual Address Space Pin
sawerr9-Sep-08 12:27
sawerr9-Sep-08 12:27 
GeneralRe: WM_SETTEXT and Virtual Address Space Pin
Mark Salsbery9-Sep-08 12:48
Mark Salsbery9-Sep-08 12:48 
GeneralRe: WM_SETTEXT and Virtual Address Space Pin
sawerr9-Sep-08 13:00
sawerr9-Sep-08 13:00 
GeneralRe: WM_SETTEXT and Virtual Address Space Pin
Mark Salsbery9-Sep-08 13:32
Mark Salsbery9-Sep-08 13:32 
AnswerRe: WM_SETTEXT and Virtual Address Space Pin
Mark Salsbery9-Sep-08 12:56
Mark Salsbery9-Sep-08 12:56 
GeneralRe: WM_SETTEXT and Virtual Address Space Pin
sawerr9-Sep-08 13:07
sawerr9-Sep-08 13:07 
Questionhow to get registry subkey value using c++ Pin
adhilingam9-Sep-08 6:14
adhilingam9-Sep-08 6:14 
AnswerRe: how to get registry subkey value using c++ Pin
Perspx9-Sep-08 6:59
Perspx9-Sep-08 6:59 
AnswerRe: how to get registry subkey value using c++ Pin
vikas amin9-Sep-08 7:42
vikas amin9-Sep-08 7:42 
AnswerRe: how to get registry subkey value using c++ Pin
Hamid_RT9-Sep-08 8:10
Hamid_RT9-Sep-08 8:10 
QuestionDrawText is giving me garbage Pin
thebeekeeper9-Sep-08 5:16
thebeekeeper9-Sep-08 5:16 
AnswerRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 5:30
Mark Salsbery9-Sep-08 5:30 
GeneralRe: DrawText is giving me garbage Pin
thebeekeeper9-Sep-08 5:37
thebeekeeper9-Sep-08 5:37 
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 5:45
Mark Salsbery9-Sep-08 5:45 
GeneralRe: DrawText is giving me garbage Pin
thebeekeeper9-Sep-08 6:09
thebeekeeper9-Sep-08 6:09 
GeneralRe: DrawText is giving me garbage Pin
Mark Salsbery9-Sep-08 6:22
Mark Salsbery9-Sep-08 6:22 

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.