Apr 14, 2012 at 1:42am UTC
Hello, first of all, sorry for my english.
I am trying make some code for change msn personal message.
My code is based in this sources:
I have two problems:
1 - My code dont work and i dont know why...
2 - How do i discover the value "dwData = 0x0547"?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
// - includes;
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// - definicoes;
#define MSN_windowclass "MsnMsgrUIManager"
#define MSN_stringlimit 64
// - main;
int main()
{
// - declaracoes;
char S_msg[MSN_stringlimit];
HWND HW_msn;
COPYDATASTRUCT CDS_data;
// - capturando o HWND do msn buscando sua windowclass;
HW_msn = FindWindowEx( NULL , NULL , MSN_windowclass , NULL );
// - caso msn nao seja encontrado;
if ( !HW_msn )
{
printf("MSN nao encontrado" );
return EXIT_FAILURE;
}
// - gerando msg a ser exibida pelo msn;
// \\0 + CATEGORIA(0,1,2) + \\0 + ENABLE(1 = true, 0 = false) + \\0{0}\\0 + string com a mensagem + \\0\\0\\0\\0\0
strcpy( S_msg , "\\00\\01\\0{0}\\0mensagem de teste\\0\\0\\0\\0\0" );
// - gerando mensagem a ser enviada ao programa;
CDS_data.dwData = 0x0547;
CDS_data.cbData = strlen( S_msg ) + 1;
CDS_data.lpData = S_msg;
// - enviando mensagem;
SendMessage( HW_msn , WM_COPYDATA , 0 , (LPARAM) (LPVOID) &CDS_data );
// - notificando sucesso;
printf("enviado" );
return EXIT_SUCCESS;
}
Last edited on Apr 14, 2012 at 6:49pm UTC
Apr 14, 2012 at 5:17am UTC
hey.. im not yet good in this language. but i observed this is not c++. this is c. i thnk you can try to save this as "filename.c".
Apr 14, 2012 at 4:56pm UTC
aaahl, yes, this is c and are saved in .c ...
The code dont have logics errors, so, this are compiled normal.
The problem is: the sendmessage dont change the messenger personal message.
Apr 14, 2012 at 6:04pm UTC
Use Microsoft Spy++ tool to show up all window messages posted to target application. If the message is not received, it is an error in your application, if it is send, but no effects show up it means target application does not process WM_COPYDATA. In that last case there is not much you can do, except executable patching.
Apr 14, 2012 at 7:22pm UTC
It seems like WM_COPYDATA is not accepted. Try to attach Spy++ and change the text from inside MSN and record all messages that are posted, then do the same from your application.
Apr 15, 2012 at 6:41am UTC
check the return value of the SendMessage function whether it normal retrun,or error to query the reason from the MSDN.
Apr 15, 2012 at 6:47am UTC
maybe the inside of MSN reject the WM_COPYDATA message by filter mechanism.
Apr 15, 2012 at 5:55pm UTC
modoran: I dont find WM_COPYDATA or 0x0547 message attaching spy++ to msn...
beginning: sendmessage return 0 (false)...
Maybe this dont work anymore, thx for the help :D