Im a beginning C++ programmer and i was just trying out some of the awsome stuff that can be done with c++ and not VB(.NET, 2008).
I actualy have 2 questions:
First, y does this give me an empty console screen?
Im not getting any error messages, my intend was to get all icons on the desktop and do some wacky stuff with them.
Second, will this get me all the items on the desktop ?
#include <iostream>
#include <windows.h>
#include <commctrl.h>
int Main()
{
using namespace std;
LVITEM* Item = new LVITEM;
Item->iSubItem = 0;
Item->cchTextMax = 255;
Item->pszText = NULL;
HWND desktop;
do{desktop = FindWindow(NULL,L"program");}while(desktop = NULL);
do{desktop = FindWindowEx(desktop, 0, L"SHELLDLL_DefView", NULL);}while(desktop = NULL);
do{desktop = FindWindowEx(desktop, 0, L"SysListView32", NULL);}while(desktop = NULL);
int totalItem = SendMessage(desktop, LVM_GETITEMCOUNT, 0, 0);
for(int i = 0; i < totalItem; i++)
{
SendMessage(desktop, LVM_GETITEMTEXT, i, (long)Item);
cout << Item->pszText << endl;
}
cin.get();
return 0;
}