neku
Codeur roumain
Ce petit morceau de code, je l'ai fais pour un des plugins de IRC-Cs
www.irc-cs.com
Il affiche l'ip du serveur Cs sur lequel l'on se trouve
l'appel se fait de la maniere suivante :
www.irc-cs.com
Il affiche l'ip du serveur Cs sur lequel l'on se trouve
Code:
#include <windows.h>
#include <stdio.h>
void SetSongText(const char * Hostname,const char * IP, int Show)
{
HWND msnui = NULL;
COPYDATASTRUCT msndata;
// ASCII
char Title[256];
memset(Title,'\0',sizeof(Title));
sprintf(Title,"\\0Music\\0%i\\{0} - {1}\\0%s\\0%s\\0\\0\\0",Show,Hostname,IP);
// UTF16
WCHAR wstrTitle[256];
memset(wstrTitle, 0, sizeof(CHAR)*256);
// Conversion ASCII vers UTF16
int nLen = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)Title, -1, NULL, NULL);
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)Title, -1, (LPWSTR)wstrTitle, nLen);
msndata.dwData = 0x547;
msndata.lpData = (void*)wstrTitle;
msndata.cbData = (nLen*2)+2;
while (msnui = ::FindWindowEx(NULL, msnui, "MsnMsgrUIManager", NULL))
{
::SendMessage(msnui, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&msndata);
}
}
Code:
SetSongText("Playing Counter-strike","127.0.0.1",1);