2003.9.26 조경민
MSN6 메신저 MS 개발 정보
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/WinMessenger/winmessenger/overview/overview_entry.asp
MSN6 에서 받은 메시지 후킹하기
각 Iwindow 창은 MSBLNetConn 라는 이름의 윈도우 메시지 기반 소켓통신을 위한 윈도우를 생성한다. 이 윈도우를 subclass 하여 문자열을 받을 수 있다.
출처: http://www.msnfanatic.com/forums/index.php?showtopic=6989
#define WM_SOCKET WM_USER+40
...
//inside some function
Hook = SetWindowsHookEx(WH_CBT, HookProc, hInstance, 0);
....
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
CREATESTRUCT *cs;
char class[MAX_PATH] = {0};
if(nCode < 0)
return CallNextHookEx(Hook , nCode, wParam, lParam);
if(nCode == HCBT_CREATEWND)
{
HWND hwnd = (HWND)wParam;
cs = ((CBT_CREATEWND *)lParam)->lpcs;
GetClassName(hwnd, class, MAX_PATH);
if(!lstrcmpi(class, "MSNMSBLGeneric") && !lstrcmpi(cs->lpszName,"MSBLNetConn"))
{
UnhookWindowsHookEx(Hook);
OldProc = (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC,(LPARAM)(WNDPROC)WndProc);
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
LRESULT WINAPI WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
SOCKET s;
char *buf;
unsigned long available_data;
HANDLE b;
switch(uMsg) {
case WM_SOCKET:
if (WSAGETSELECTEVENT(lParam)== FD_READ) {
s= wParam;
if (ioctlsocket(s, FIONREAD,&available_data) == 0) {
b = GlobalAlloc(GHND, available_data);
buf = (char*) GlobalLock(b);
recv(s,buf, (int)available_data,MSG_PEEK);
...
GlobalUnlock(buf);
GlobalFree(b);
}
}
return CallWindowProc((WNDPROC) (DWORD)OldProc, hwnd, uMsg, wParam, lParam);
}
MSN이 접속중인지 아닌지 판단
#include <windows.h>
using namespace std;
void OfflineOnline(int iAmount);
int main()
{
OfflineOnline(4);
return 0;
}
void OfflineOnline(int iAmount)
{
HWND hWnd = FindWindow("msnmsblclass", NULL);
if (hWnd == NULL)
{
do
{
HWND hWnd = FindWindow("msnmsblclass", NULL);
}
while (hWnd != NULL);
}
for (i=0;i<=iAmount;i++)
{
SendMessage(hWnd, WM_COMMAND, 40177, 0);
SendMessage(hWnd, WM_COMMAND, 40176, 0);
}
}
또는
#include <windows.h>
#include "msgrua.h"
#include "msgruaid.h"
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
IMessenger *pIMessenger = NULL;
HRESULT hRes = CoInitialize(0);
if (!SUCCEEDED(hRes))
return 0;
hRes = CoCreateInstance(CLSID_Messenger,
NULL, CLSCTX_ALL,
IID_IMessenger,
(void **)&pIMessenger);
if (!SUCCEEDED(hRes))
{
CoUninitialize();
return 0;
}
for (int i=0;i<=4;i++)
{
pIMessenger->put_MyStatus(MISTATUS_INVISIBLE);
pIMessenger->put_MyStatus(MISTATUS_ONLINE);
Sleep(1000);
}
pIMessenger->Release();
CoUninitialize();
return 0;
}
------------
오후 5:06 2003-09-25
MSN6 플러그인 게임 만들기
출처 : http://www.msnfanatic.com/forums/index.php?showtopic=4781&hl=msgrsessionmanager
I found this code in planet-source-code. Itll add a program to the actions menu.
You need one form, 5 textboxes, 3 cmdbuttons. and a CommonDialog control
Txt1: location of file to be executed
Txt2: name to apperar in menu
Txt3:URL (????) try it
cmd1: browse for path to app
cmd2: will register everithing in registry
cmd3: unregister everything
CODE
Dim WithEvents msnsession As MsgrSessionManager
Private Sub Command1_Click()
On Error Resume Next
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
Private Sub Command2_Click()
On Error GoTo needall
msnsession.RegisterApplication Text4.Text, Text2.Text, Text3.Text, Text1.Text, 0
Exit Sub
needall:
MsgBox "All feilds must be complete", vbCritical, "Error"
End Sub
Private Sub Command3_Click()
On Error GoTo notexist
msnsession.UnRegisterApplication Text5.Text
Exit Sub
notexist:
MsgBox "Key doesn't exist", vbCritical, "Error"
End Sub
Private Sub Form_Load()
Set msnsession = New MsgrSessionManager
MsgBox "This Messenger session manager example was created by Ferret, use it freely, it's pretty simple...I'm not sure why you cant set msgrsession, maybe someone would tell me @ M_Larritt@hotmail.com...Have fun!", vbOKOnly, "Welcome!"
End Sub
char* msg에 데이타 있을때
키 입력 에뮬레이트
http://www.msnfanatic.com/forums/index.php?showtopic=7029
===============================================================
i=0;
//SendMessage(child,WM_KEYDOWN,(TCHAR)VK_CONTROL,VkKeyScan(VK_CONTROL));
while ((unsigned int)i<strlen(msg)) {
unsigned int input=VkKeyScan(msg[i]);
bool shift=((input>>8) & 1>0)||msg[i]=='\n'||msg[i]=='\r';
bool ctrl=((input>>8) & 2)>0;
bool alt=((input>>8) & 4)>0;
if (ctrl) keybd_event(VK_CONTROL,NULL,NULL,NULL);
if (alt) keybd_event(VK_MENU,NULL,NULL,NULL);
if (shift) keybd_event(VK_SHIFT,NULL,NULL,NULL);
keybd_event(input,NULL,NULL,NULL);
keybd_event(input,NULL,KEYEVENTF_KEYUP,NULL);
if (shift) keybd_event(VK_SHIFT,NULL,KEYEVENTF_KEYUP,NULL);
if (alt) keybd_event(VK_MENU,NULL,KEYEVENTF_KEYUP,NULL);
if (ctrl) keybd_event(VK_CONTROL,NULL,KEYEVENTF_KEYUP,NULL);
i++;
}
keybd_event(VK_RETURN,MapVirtualKey(VK_RETURN,0),NULL,NULL);
keybd_event(VK_RETURN,MapVirtualKey(VK_RETURN,0),KEYEVENTF_KEYUP,NULL);
------------------
오전 11:31 2003-09-26
대화창 얻기
===========================================================
http://www.msnfanatic.com/forums/index.php?showtopic=5925
STDMETHODIMP MessengerEvents::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS FAR* pDispParams,
VARIANT FAR* parResult,
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr)
{
if (!pDispParams)
return E_INVALIDARG;
switch (dispIdMember)
{
case DISPID_MUAE_ONIMWINDOWDESTROYED:
{
if (pDispParams->rgvarg[0].vt == VT_DISPATCH)
{
IMessengerConversationWnd *pIMWindow;
pDispParams->rgvarg[0].pdispVal->QueryInterface(__uuidof(IMessengerConversationWnd),(void**)&pIMWindow);
LONG lTest;
pIMWindow->get_Width(&lTest);
}
}
break;
default:
break;
}
return S_OK;
MSN6 메신저 MS 개발 정보
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/WinMessenger/winmessenger/overview/overview_entry.asp
MSN6 에서 받은 메시지 후킹하기
각 Iwindow 창은 MSBLNetConn 라는 이름의 윈도우 메시지 기반 소켓통신을 위한 윈도우를 생성한다. 이 윈도우를 subclass 하여 문자열을 받을 수 있다.
출처: http://www.msnfanatic.com/forums/index.php?showtopic=6989
#define WM_SOCKET WM_USER+40
...
//inside some function
Hook = SetWindowsHookEx(WH_CBT, HookProc, hInstance, 0);
....
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
CREATESTRUCT *cs;
char class[MAX_PATH] = {0};
if(nCode < 0)
return CallNextHookEx(Hook , nCode, wParam, lParam);
if(nCode == HCBT_CREATEWND)
{
HWND hwnd = (HWND)wParam;
cs = ((CBT_CREATEWND *)lParam)->lpcs;
GetClassName(hwnd, class, MAX_PATH);
if(!lstrcmpi(class, "MSNMSBLGeneric") && !lstrcmpi(cs->lpszName,"MSBLNetConn"))
{
UnhookWindowsHookEx(Hook);
OldProc = (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC,(LPARAM)(WNDPROC)WndProc);
}
return CallNextHookEx(NULL, nCode, wParam, lParam);
}
LRESULT WINAPI WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
SOCKET s;
char *buf;
unsigned long available_data;
HANDLE b;
switch(uMsg) {
case WM_SOCKET:
if (WSAGETSELECTEVENT(lParam)== FD_READ) {
s= wParam;
if (ioctlsocket(s, FIONREAD,&available_data) == 0) {
b = GlobalAlloc(GHND, available_data);
buf = (char*) GlobalLock(b);
recv(s,buf, (int)available_data,MSG_PEEK);
...
GlobalUnlock(buf);
GlobalFree(b);
}
}
return CallWindowProc((WNDPROC) (DWORD)OldProc, hwnd, uMsg, wParam, lParam);
}
MSN이 접속중인지 아닌지 판단
#include <windows.h>
using namespace std;
void OfflineOnline(int iAmount);
int main()
{
OfflineOnline(4);
return 0;
}
void OfflineOnline(int iAmount)
{
HWND hWnd = FindWindow("msnmsblclass", NULL);
if (hWnd == NULL)
{
do
{
HWND hWnd = FindWindow("msnmsblclass", NULL);
}
while (hWnd != NULL);
}
for (i=0;i<=iAmount;i++)
{
SendMessage(hWnd, WM_COMMAND, 40177, 0);
SendMessage(hWnd, WM_COMMAND, 40176, 0);
}
}
또는
#include <windows.h>
#include "msgrua.h"
#include "msgruaid.h"
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
IMessenger *pIMessenger = NULL;
HRESULT hRes = CoInitialize(0);
if (!SUCCEEDED(hRes))
return 0;
hRes = CoCreateInstance(CLSID_Messenger,
NULL, CLSCTX_ALL,
IID_IMessenger,
(void **)&pIMessenger);
if (!SUCCEEDED(hRes))
{
CoUninitialize();
return 0;
}
for (int i=0;i<=4;i++)
{
pIMessenger->put_MyStatus(MISTATUS_INVISIBLE);
pIMessenger->put_MyStatus(MISTATUS_ONLINE);
Sleep(1000);
}
pIMessenger->Release();
CoUninitialize();
return 0;
}
------------
오후 5:06 2003-09-25
MSN6 플러그인 게임 만들기
출처 : http://www.msnfanatic.com/forums/index.php?showtopic=4781&hl=msgrsessionmanager
I found this code in planet-source-code. Itll add a program to the actions menu.
You need one form, 5 textboxes, 3 cmdbuttons. and a CommonDialog control
Txt1: location of file to be executed
Txt2: name to apperar in menu
Txt3:URL (????) try it
cmd1: browse for path to app
cmd2: will register everithing in registry
cmd3: unregister everything
CODE
Dim WithEvents msnsession As MsgrSessionManager
Private Sub Command1_Click()
On Error Resume Next
CommonDialog1.ShowOpen
Text1.Text = CommonDialog1.FileName
End Sub
Private Sub Command2_Click()
On Error GoTo needall
msnsession.RegisterApplication Text4.Text, Text2.Text, Text3.Text, Text1.Text, 0
Exit Sub
needall:
MsgBox "All feilds must be complete", vbCritical, "Error"
End Sub
Private Sub Command3_Click()
On Error GoTo notexist
msnsession.UnRegisterApplication Text5.Text
Exit Sub
notexist:
MsgBox "Key doesn't exist", vbCritical, "Error"
End Sub
Private Sub Form_Load()
Set msnsession = New MsgrSessionManager
MsgBox "This Messenger session manager example was created by Ferret, use it freely, it's pretty simple...I'm not sure why you cant set msgrsession, maybe someone would tell me @ M_Larritt@hotmail.com...Have fun!", vbOKOnly, "Welcome!"
End Sub
char* msg에 데이타 있을때
키 입력 에뮬레이트
http://www.msnfanatic.com/forums/index.php?showtopic=7029
===============================================================
i=0;
//SendMessage(child,WM_KEYDOWN,(TCHAR)VK_CONTROL,VkKeyScan(VK_CONTROL));
while ((unsigned int)i<strlen(msg)) {
unsigned int input=VkKeyScan(msg[i]);
bool shift=((input>>8) & 1>0)||msg[i]=='\n'||msg[i]=='\r';
bool ctrl=((input>>8) & 2)>0;
bool alt=((input>>8) & 4)>0;
if (ctrl) keybd_event(VK_CONTROL,NULL,NULL,NULL);
if (alt) keybd_event(VK_MENU,NULL,NULL,NULL);
if (shift) keybd_event(VK_SHIFT,NULL,NULL,NULL);
keybd_event(input,NULL,NULL,NULL);
keybd_event(input,NULL,KEYEVENTF_KEYUP,NULL);
if (shift) keybd_event(VK_SHIFT,NULL,KEYEVENTF_KEYUP,NULL);
if (alt) keybd_event(VK_MENU,NULL,KEYEVENTF_KEYUP,NULL);
if (ctrl) keybd_event(VK_CONTROL,NULL,KEYEVENTF_KEYUP,NULL);
i++;
}
keybd_event(VK_RETURN,MapVirtualKey(VK_RETURN,0),NULL,NULL);
keybd_event(VK_RETURN,MapVirtualKey(VK_RETURN,0),KEYEVENTF_KEYUP,NULL);
------------------
오전 11:31 2003-09-26
대화창 얻기
===========================================================
http://www.msnfanatic.com/forums/index.php?showtopic=5925
STDMETHODIMP MessengerEvents::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS FAR* pDispParams,
VARIANT FAR* parResult,
EXCEPINFO FAR* pExcepInfo,
unsigned int FAR* puArgErr)
{
if (!pDispParams)
return E_INVALIDARG;
switch (dispIdMember)
{
case DISPID_MUAE_ONIMWINDOWDESTROYED:
{
if (pDispParams->rgvarg[0].vt == VT_DISPATCH)
{
IMessengerConversationWnd *pIMWindow;
pDispParams->rgvarg[0].pdispVal->QueryInterface(__uuidof(IMessengerConversationWnd),(void**)&pIMWindow);
LONG lTest;
pIMWindow->get_Width(&lTest);
}
}
break;
default:
break;
}
return S_OK;
'KB > MFC/Win32' 카테고리의 다른 글
다이얼로그 팁 (0) | 2004.04.28 |
---|---|
VC++에서 제공하는 property를 에뮬레이트 (0) | 2004.03.19 |
MSN 코드 모음 (0) | 2004.03.19 |
mshtml 메모리 릭 최소화하기 (0) | 2004.03.19 |
HTML 스크립트 함수 ActiveX에서 호출하기 (0) | 2004.03.19 |