If your goal is just showing the list of running applications in desk top window.
(so not include system processes)
EnumWindows function can be a good method.
Here is a little sample code.
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <iostream>
using namespace std;
#pragma comment(lib, "user32.lib")
int window_num1=0;
BOOL CALLBACK MyEnumProc(HWND hWnd, LPARAM lParam)
{
TCHAR title[256] = {0,};
if (IsWindowVisible(hWnd) && GetWindowTextLength(hWnd) > 0)
{
window_num1++;
GetWindowText(hWnd, title, _countof(title));
_tprintf(_T("Value is %d, %s\n"), window_num1, title);
}
return TRUE;
}
int main()
{
EnumWindows(MyEnumProc, 0);
getchar();
return 0;
}