I'm trying to send a notification to a ListView, but I can't find what am I doing wrong.
This is the code:

#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>

int second_try(){

DWORD pid = 0;

HWND hWnd=HWND(0x00020756);

GetWindowThreadProcessId( hWnd, &pid );

HANDLE hProcHnd = OpenProcess( PROCESS_VM_OPERATION |PROCESS_VM_READ|PROCESS_VM_WRITE, FALSE, pid );

LPVOID pNMLV = VirtualAllocEx( hProcHnd, NULL, sizeof( NMLISTVIEW ),
MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);


NMLISTVIEW nmlvitem;

nmlvitem.hdr.code = LVN_COLUMNCLICK;
nmlvitem.hdr.hwndFrom = HWND(0x00020770);
nmlvitem.hdr.idFrom = 0;
nmlvitem.iItem=-1;
nmlvitem.iSubItem=2;
nmlvitem.lParam=0;
nmlvitem.ptAction.x=0;
nmlvitem.ptAction.y=0;
nmlvitem.uChanged=0;
nmlvitem.uNewState=0;
nmlvitem.uOldState=0;

DWORD copied = 0;

WriteProcessMemory( hProcHnd, pNMLV, &nmlvitem, sizeof( NMLISTVIEW ), &copied );

SendMessage( hWnd, WM_NOTIFY, (WPARAM)0, (LPARAM)pNMLV ) ;

VirtualFreeEx( hProcHnd, pNMLV, 0, MEM_RELEASE );
return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
second_try();
return 0;
}
or you can see it here, too:
http://pastebin.com/MJyb4xib