Ciao a tutti,
Ho una applicazione multiwindow. Voglio inserire il testo di una editbox di una finestra nella listview contenuta in un'altra finestra. Non riesco a trovare il modo. Qualcuno mi aiuta?
Grazie.
Vi posto il codice funzionante me senza quello che voglio io.
codice:
#include  <windows.h>
#include  <stdio.h>
#include  <commctrl.h>

#pragma comment(lib, "comctl32.lib")


typedef struct
{
   char  szItemNr[8];
   char  szItem[78];
   char  szItemDescription[32];
}Item;
//Beep(500,400);
// function prototypes
void InitApp(HINSTANCE);
LRESULT APIENTRY MainProc(HWND,UINT,WPARAM,LPARAM);
LRESULT APIENTRY OtherProc(HWND,UINT,WPARAM,LPARAM);

const int  ID_LISTVIEW =1;
const int SAVE=5;
const int CANCEL=6;
const int nEditID =4;
const int NUOVO= 2;
const int MODIFICA =3;
// variables
static HWND hwndED;
static HWND hwnd;
static HWND other;
static HWND edit;
static HWND add;
static   HWND           hWndListView;
static HINSTANCE g_hInst,hInstance;


static HWND hwndCombo;
//questo procurava segni strani nella listview quando compariva in altre parti del file
static   HFONT          hFont;
int agg(int x, int y)
{
    return x + y;
}
void InitApp(HINSTANCE hInst)
{
	INITCOMMONCONTROLSEX    icex, idex;
	WNDCLASS wc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1);
	wc.hInstance = hInst;
	wc.hCursor = LoadCursor(NULL,IDC_ARROW);
	wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
	wc.lpfnWndProc = (WNDPROC) MainProc;
	wc.lpszClassName = "Main";
	wc.lpszMenuName = NULL;
	wc.style = CS_HREDRAW | CS_VREDRAW;

	RegisterClass(&wc);

	wc.lpszClassName = "Other";
	wc.lpfnWndProc = (WNDPROC) OtherProc;

	RegisterClass(&wc);
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
   icex.dwICC = ICC_LISTVIEW_CLASSES;
   idex.dwSize=sizeof(INITCOMMONCONTROLSEX);
   idex.dwICC=ICC_DATE_CLASSES;
  InitCommonControlsEx(&icex);
  InitCommonControlsEx(&idex);
int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
    int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
	hwnd = CreateWindow("Main","Reminder",WS_OVERLAPPEDWINDOW,(nScreenWidth-1000)/2, (nScreenHeight-600)/2,1000,600, NULL, NULL,hInst,0);
	other = CreateWindow("Other","",WS_OVERLAPPEDWINDOW,(nScreenWidth-1000)/2, (nScreenHeight-600)/2,1000,600, NULL, NULL,hInst,0);

	ShowWindow(hwnd,SW_SHOW);
	UpdateWindow(hwnd);
	
}

BOOL AdjustListView(HWND hList, LV_ITEM *lv, int iItems)
{
   int i = iItems;
   int iRet;
   ListView_DeleteAllItems(hList);

   lv->mask = LVIF_TEXT;
   lv->iSubItem = 0;
   lv->pszText = LPSTR_TEXTCALLBACK;

   while(i > 0)
   {
      iRet = ListView_InsertItem(hList, lv);
      i--;
   }
   return TRUE;
}

//  CreateDatePick creates a DTP control within a dialog box.
//  Returns the handle to the new DTP control if successful, or NULL 
//  otherwise.
//
//    hwndMain - The handle to the main window.
//    g_hinst  - global handle to the program instance.


LRESULT APIENTRY MainProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	
   static   CREATESTRUCT   *cs;
   

   static   LV_ITEM        lv;
   static   Item           ListItem[3];
   // i caratteri in eccedenza di riga verranno eliminati
   static   char           szColumnHeader[5][12] = {"N.", "Evento", "Frequenza", "Attivo", "Iniziato il"};
   int                     index;
   int                     iiWidth[5];
   LV_COLUMN               lvC;
   RECT                    rect;

   LV_DISPINFO             *lvd;
   NMHDR                   *hdr;
  

   switch (msg)
   {
   case WM_CREATE :
	   
	  
      cs = (CREATESTRUCT *)lParam;
     
      hWndListView = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW,
         "", WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_OWNERDATA,
         0, 0, 0, 0, hwnd,(HMENU)ID_LISTVIEW, hInstance, NULL);
	 
      ListView_SetExtendedListViewStyle(hWndListView, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);

      iiWidth[0] = 60;
      iiWidth[1] = 600;
      iiWidth[2] = 200;
	  iiWidth[3] = 50;
      iiWidth[4] = 100;

      lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
      lvC.fmt = LVCFMT_LEFT;

      for(index = 0; index < 5; index++)
      {
         
         lvC.cx = iiWidth[index];
         lvC.pszText = szColumnHeader[index];
         ListView_InsertColumn(hWndListView,index,&lvC);
      }

      // Add some items here
	  
      strcpy(ListItem[0].szItemNr, "1");
      strcpy(ListItem[0].szItem, "Cat");
      strcpy(ListItem[0].szItemDescription, "Pet");

      strcpy(ListItem[1].szItemNr, "2");
      strcpy(ListItem[1].szItem, "Dog");
      strcpy(ListItem[1].szItemDescription, "Pet");
	  
      

      AdjustListView(hWndListView, &lv, 2);
	  
hFont = CreateFont(16, 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, "Times New Roman");
SendDlgItemMessage(hwnd, ID_LISTVIEW, WM_SETFONT, (WPARAM)hFont, TRUE);
edit = CreateWindow("Button","Add",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,28,515,80,33,hwnd,(HMENU)NUOVO,g_hInst,0);
add = CreateWindow("Button","Edit",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,132,515,80,33,hwnd,(HMENU)MODIFICA,g_hInst,0);

 
      break;
	  

   case WM_SIZE :
	   

      GetClientRect(hwnd, &rect);
      MoveWindow(hWndListView, 3, 3, rect.right, rect.bottom - 70, 1);
      break;

	  case WM_COMMAND :
		  
		  switch(LOWORD(wParam)) {
	  case NUOVO:
			ShowWindow(other,SW_SHOW);
			SetWindowText(hwndED, "");
			SetWindowText(other, "Aggiungi promemoria");
		  break;
	  case MODIFICA:
		  ShowWindow(other,SW_SHOW);
		  index = SendMessage(hWndListView,LVM_GETNEXTITEM,-1,LVNI_FOCUSED);
			SetWindowText(other, "Modifica promemoria");
		  SetWindowText(hwndED, ListItem[index].szItem);
		  break;
		
		  }
		 break; 
	  
	  
		  

   case WM_NOTIFY :
      switch(((LPNMHDR)lParam)->code)
      {
      case NM_DBLCLK :
         hdr = (NMHDR FAR*)lParam;
         if(hdr->hwndFrom == hWndListView)
         {
            index = ListView_GetNextItem(hWndListView,-1,LVNI_SELECTED);
            if(index != -1)
            {
               MessageBox(hwnd, ListItem[index].szItem, "Doubleclicked on this item", MB_OK);
            }
         }
         break;

      case LVN_GETDISPINFO :
         lvd = (LV_DISPINFO FAR*)lParam;
         if((((LPNMHDR)lParam)->hwndFrom == hWndListView))
         {
            switch(lvd->item.iSubItem)
            {
            case 0:
               lvd->item.pszText =  ListItem[lvd->item.iItem].szItemNr;
               break;
            case 1:
               lvd->item.pszText = ListItem[lvd->item.iItem].szItem;
               break;
            case 2:
               lvd->item.pszText = ListItem[lvd->item.iItem].szItemDescription;
               break;
            }
            break;
         }
      }
      break;
	  
   case WM_CLOSE :
      DestroyWindow(hwnd);
      break;

   case WM_DESTROY :
      DeleteObject(hFont);
      PostQuitMessage(0);
      break;
   }
   return DefWindowProc(hwnd, msg, wParam, lParam);
}

// winmain entry point


// Other Window CallBack Function
LRESULT APIENTRY OtherProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
CREATESTRUCT      *cs;
static SYSTEMTIME st;
static HWND       hWndStartDate, hWndStartTime;
static char       szDate[15], szTime[10], szStamp[20];
NMDATETIMECHANGE  *Date;
const TCHAR *items[] = { TEXT("Ogni anno"), TEXT("Ogni mese"),TEXT("Ogni settimana"), TEXT("Ogni giorno"), TEXT("Una volta") };
int i;
  long Lresult;

  switch(msg)  
  {
      case WM_CREATE:
		  

      
            hwndCombo = CreateWindow(TEXT("combobox"), NULL, 
                  WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
                  177, 216, 216, 110, hwnd, NULL, g_hInst, NULL); 

CreateWindow(TEXT("button"), TEXT("Dettagli promemoria"), 
       WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
       12, 52, 899, 97, hwnd, (HMENU) 0, g_hInst, NULL);
CreateWindow(TEXT("button"), TEXT("Giorno e ora"), 
       WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
       16, 176, 644, 184, hwnd, (HMENU) 0, g_hInst, NULL);
hwndED=CreateWindowEx(WS_EX_CLIENTEDGE,"edit", "",
WS_VISIBLE|WS_CHILD|WS_BORDER|ES_AUTOHSCROLL|ES_AUTOVSCROLL,
251, 90, 606, 24, hwnd, (HMENU)nEditID, g_hInst, NULL);

hWndStartDate = CreateWindowEx(0, DATETIMEPICK_CLASS, NULL,
         WS_BORDER | WS_CHILD | WS_VISIBLE,
         177,261,220,25,
         hwnd, NULL, 
		 
		 
		 
		 
		 
		 hInstance, NULL);
SendMessage(hWndStartDate, WM_SETFONT, (WPARAM)hFont, FALSE);
hWndStartTime = CreateWindowEx(0, DATETIMEPICK_CLASS, NULL,
         WS_BORDER | WS_CHILD | WS_VISIBLE | DTS_TIMEFORMAT,
         177,307,220,25,
         hwnd, NULL, 
		 hInstance, NULL);
SendMessage(hWndStartTime, WM_SETFONT, (WPARAM)hFont, FALSE);							 



for ( i = 0; i < 5; i++ ) {
	
                SendMessage(hwndCombo, CB_INSERTSTRING, 0, (LPARAM) items[i]);
            }
HWND save;
HWND cancel;
save = CreateWindow("Button","Save",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,28,515,80,33,hwnd,(HMENU)SAVE,g_hInst,0);
cancel = CreateWindow("Button","Cancel",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,132,515,80,33,hwnd,(HMENU)CANCEL,g_hInst,0);

break;

case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
SetBkMode(hdc, TRANSPARENT);


TextOut(hdc, 41, 90, "Nome promemoria", strlen("Nome promemoria"));
TextOut(hdc, 41, 216, "Periodo", strlen("Periodo"));
TextOut(hdc, 41, 261, "Data evento", strlen("Data evento"));
TextOut(hdc, 41, 307, "Ora evento", strlen("Ora evento"));
EndPaint(hwnd, &ps);


break;
    case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case SAVE:
			
		IL CODICE DOVREBBE ANDARE QUI
	
		
        break;
		}
		break;

	case WM_CLOSE:
		ShowWindow(hwnd,SW_HIDE);
		break;
	default: return DefWindowProc(hwnd,msg,wParam,lParam);
	}

	return 0;
}


// initlize application

int APIENTRY WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR line,int CmdShow)
{
	MSG msg;
	
	InitApp(hInst);

	while(GetMessage(&msg,0,0,0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}
Grazie.