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

extern "C" __declspec(dllexport) int __stdcall encodeInfo(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause); 

int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { return 1; }

int __stdcall encodeInfo(HWND mWnd, HWND aWnd, char *data, char *parms, BOOL show, BOOL nopause)
{
    HWND h = FindWindow(NULL, NULL);
    while(h) {
		TCHAR szProcessTitle[MAX_PATH];
		int ret = GetWindowText(h, szProcessTitle, MAX_PATH);
		
		if(ret > 0) {
			if(strstr((char*)szProcessTitle, "x264")) {
				strcpy(data, (char*)szProcessTitle);
				break;
			}
		}
		
		h = GetWindow(h, GW_HWNDNEXT);
    }
    
    return 3;
}