Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria
Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria
vivo X300 Pro rappresenta un'evoluzione misurata della serie fotografica del produttore cinese, con un sistema di fotocamere migliorato, chipset Dimensity 9500 di ultima generazione e l'arrivo dell'interfaccia OriginOS 6 anche sui modelli internazionali. La scelta di limitare la batteria a 5.440mAh nel mercato europeo, rispetto ai 6.510mAh disponibili altrove, fa storcere un po' il naso
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo
Lenovo Legion Go 2 è la nuova handheld PC gaming con processore AMD Ryzen Z2 Extreme (8 core Zen 5/5c, GPU RDNA 3.5 16 CU) e schermo OLED 8,8" 1920x1200 144Hz. È dotata anche di controller rimovibili TrueStrike con joystick Hall effect e una batteria da 74Wh. Rispetto al dispositivo che l'ha preceduta, migliora ergonomia e prestazioni a basse risoluzioni, ma pesa 920g e costa 1.299€ nella configurazione con 32GB RAM/1TB SSD e Z2 Extreme
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti
A re:Invent 2025, AWS mostra un’evoluzione profonda della propria strategia: l’IA diventa una piattaforma di servizi sempre più pronta all’uso, con agenti e modelli preconfigurati che accelerano lo sviluppo, mentre il cloud resta la base imprescindibile per governare dati, complessità e lock-in in uno scenario sempre più orientato all’hybrid cloud
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 31-03-2010, 10:13   #1
giovannigiorgio
Bannato
 
Iscritto dal: Feb 2004
Messaggi: 58
[API WIN32] Inserire il testo di una editibox nella listview di un'altra finestra?

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 ma 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

Ultima modifica di giovannigiorgio : 31-03-2010 alle 10:16.
giovannigiorgio è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria Recensione vivo X300 Pro: è ancora lui il...
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'...
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti AWS re:Invent 2025: inizia l'era dell'AI-as-a-Se...
Cos'è la bolla dell'IA e perché se ne parla Cos'è la bolla dell'IA e perché se...
BOOX Palma 2 Pro in prova: l'e-reader diventa a colori, e davvero tascabile BOOX Palma 2 Pro in prova: l'e-reader diventa a ...
Il nucleo della cometa interstellare 3I/...
La Russia potrebbe sviluppare un'arma pe...
Manda la RAM Corsair in assistenza, rice...
ASUS ROG G1000 con 'AniMe Holo': saranno...
Un test di longevità ha messo alla prova...
Incat inizia i test dell'incredibile tra...
LG Sound Suite: al CES il sistema audio ...
Avengers Doomsday, il primo trailer &egr...
La crisi delle memorie non farà sconti a...
Il trailer più atteso dell'anno &...
I gamer vogliono i monitor OLED: sopratt...
Samsung alza l’asticella dei televisori ...
Energie rinnovabili 2025: quasi 42% del ...
Le auto elettriche volano in tutta Europ...
Nuovo look per la finestra Esegui su Win...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 01:33.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v