Menu

Tag

Posts tagged with ‘c++’

Jenkins, TestLink and GTest in 5 minutes (or so)

kinow @ Oct 11, 2012 23:44:59

This is a 5 minutes guide on creating a job for a C++ project in Jenkins with GoogleTest and reporting the test results back to TestLink, with testlink-plugin.

The test project with GoogleTest

For this simple guide we will use the samples that come with GTest TAP Listener. You can get the code from GitHub with git clone git://github.com/kinow/gtest-tap-listener.git. Take a look at gtest-tap-listener/samples/src/, there you will find two C++ files: gtest_main.cc and gtest_testHelloWorld.cc.

gtest_main.cc has the main function, and executes the test suite. And gtest_testHelloWorld.cc has the test cases and tests. Take note of the test case and tests names.

( Read more … )

Code to change your message in MSN messenger

kinow @ Mar 22, 2009 14:31:18

I’ve always wanted to know how does the code to show what was I listening to looked like. I found it after installing XMPlay and XMPlay MSN Plug-in. The plug-in zip had the plug-in itself and its source code. And what a neat source code (-:.

Basically, you just send a message to the MSN UI API with a defined data structure. And to remove the message, just send again with an empty string.

/*
Bruno de Paula Kinoshita
original src code:
XMPlay MSN Plugin (c) 2005-2006 Elliott Sales de Andrade
*/

#include <cstdlib>
#include <iostream>
#include <windows.h>

using namespace std;

typedef struct {
BOOL showCues;
BOOL keepOnClose;
} MSNStuff;
static MSNStuff msnConf;

void setNowPlaying( char *title)
{
    wchar_t *lpMsn;
    int strLen = 20;
    HWND xmpwin;
    HWND msnui=0;

    lpMsn = (wchar_t*)calloc(1024,1024);
    // stuff for MSN before...
    memcpy(lpMsn, L"\\0Music\\01\\0{0}\\0", 17*2);
    // actual title...
    strLen=MultiByteToWideChar(false?CP_UTF8:CP_ACP,0,title,-1,lpMsn+17,492)-1;  /* 1024/2 - 20 */
    // stuff for MSN after...
    memcpy(lpMsn + 17 + strLen, L"\\0", 3*2);
    strLen += 20;

    COPYDATASTRUCT msndata;
    msndata.dwData = 0x547;
    msndata.lpData = (void*)lpMsn;
    msndata.cbData = strLen * 2;

    while ( msnui = FindWindowEx(NULL, msnui, "MsnMsgrUIManager", NULL) )
        SendMessage(msnui, WM_COPYDATA, (WPARAM)xmpwin, (LPARAM)&msndata);
}

int main(int argc, char *argv[])
{
    char *title;

    if ( argc == 1 )
        title = "";
    else
        title = argv[1];

    setNowPlaying ( title );

    return EXIT_SUCCESS;
}