当前位置: 首页>>代码示例>>C++>>正文


C++ ListView_GetItem函数代码示例

本文整理汇总了C++中ListView_GetItem函数的典型用法代码示例。如果您正苦于以下问题:C++ ListView_GetItem函数的具体用法?C++ ListView_GetItem怎么用?C++ ListView_GetItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ListView_GetItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dialog_proc_1

BOOL CALLBACK dialog_proc_1(HWND dialog, UINT message,
							WPARAM wParam, LPARAM lParam)
{
	static HDEVNOTIFY notification_handle_hub = NULL;
	static HDEVNOTIFY notification_handle_dev = NULL;
	DEV_BROADCAST_HDR *hdr = (DEV_BROADCAST_HDR *) lParam;
	DEV_BROADCAST_DEVICEINTERFACE dev_if;
	static device_context_t *device = NULL;
	HWND list = GetDlgItem(dialog, ID_LIST);
	LVITEM item;

	switch (message)
	{
	case WM_INITDIALOG:
		SendMessage(dialog,WM_SETICON,ICON_SMALL, (LPARAM)mIcon);
		SendMessage(dialog,WM_SETICON,ICON_BIG,   (LPARAM)mIcon);

		device = (device_context_t *)lParam;
		if (device->user_allocated_wdi)
		{
			if (device->wdi)
			{
				free(device->wdi);
				device->wdi = NULL;
			}
			device->user_allocated_wdi = FALSE;
		}
		g_hwndTrackingTT = CreateTrackingToolTip(list, TEXT(" "));

#if defined(_WIN64)
		device_list_wndproc_orig = (WNDPROC)SetWindowLongPtr(list, GWLP_WNDPROC, (UINT_PTR)device_list_wndproc);
#else
		device_list_wndproc_orig = (WNDPROC)SetWindowLongPtr(list, GWL_WNDPROC, (UINT_PTR)device_list_wndproc);
#endif

		memset(device, 0, sizeof(*device));

		SetWindowText(GetDlgItem(dialog, ID_LIST_HEADER_TEXT), list_header_text);
		device_list_init(list);
		device_list_refresh(list);

		dev_if.dbcc_size = sizeof(dev_if);
		dev_if.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;

		dev_if.dbcc_classguid = GUID_DEVINTERFACE_USB_HUB;
		notification_handle_hub = RegisterDeviceNotification(dialog, &dev_if, 0);

		dev_if.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;
		notification_handle_dev = RegisterDeviceNotification(dialog, &dev_if, 0);

		return TRUE;

	case WM_DEVICECHANGE:
		switch (wParam)
		{
		case DBT_DEVICEREMOVECOMPLETE:
			if (hdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
				device_list_refresh(list);
			break;
		case DBT_DEVICEARRIVAL:
			if (hdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
				device_list_refresh(list);
			break;
		default:
			;
		}
		return TRUE;

	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case ID_BUTTON_NEXT:
			if (notification_handle_hub)
				UnregisterDeviceNotification(notification_handle_hub);
			if (notification_handle_dev)
				UnregisterDeviceNotification(notification_handle_dev);

			memset(&item, 0, sizeof(item));
			item.mask = LVIF_TEXT | LVIF_PARAM;
			item.iItem = ListView_GetNextItem(list, -1, LVNI_SELECTED);

			memset(device, 0, sizeof(*device));

			if (item.iItem >= 0)
			{
				if (ListView_GetItem(list, &item))
				{
					if (item.lParam)
					{
						memcpy(device, (void *)item.lParam, sizeof(*device));
					}
				}
			}

			if (!device->wdi)
			{
				device->user_allocated_wdi = TRUE;
				device->wdi = malloc(sizeof(struct wdi_device_info));
				memset(device->wdi,0,sizeof(struct wdi_device_info));

//.........这里部分代码省略.........
开发者ID:markzh2015,项目名称:aboutusb,代码行数:101,代码来源:inf_wizard.c

示例2: DlgPluginOpt

INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
		timerID = 0;
		{
			HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
			mir_subclassWindow(hwndList, PluginListWndProc);

			HIMAGELIST hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 4, 0);
			ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_UNICODE);
			ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_ANSI);
			ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_LOADED);
			ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_NOTLOADED);
			ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_LOADEDGRAY);
			ImageList_AddIcon_IconLibLoaded(hIml, SKINICON_OTHER_NOTLOADEDGRAY);
			ListView_SetImageList(hwndList, hIml, LVSIL_SMALL);

			LVCOLUMN col;
			col.mask = LVCF_TEXT | LVCF_WIDTH;
			col.pszText = _T("");
			col.cx = 40;
			ListView_InsertColumn(hwndList, 0, &col);

			col.pszText = TranslateT("Plugin");
			col.cx = 180;
			ListView_InsertColumn(hwndList, 1, &col);

			col.pszText = TranslateT("Name");
			col.cx = 180;//max = 220;
			ListView_InsertColumn(hwndList, 2, &col);

			col.pszText = TranslateT("Version");
			col.cx = 75;
			ListView_InsertColumn(hwndList, 3, &col);

			ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_SUBITEMIMAGES | LVS_EX_CHECKBOXES | LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT);
			// scan the plugin dir for plugins, cos
			arPluginList.destroy();
			szFilter.Empty();
			enumPlugins(dialogListPlugins, (WPARAM)hwndDlg, (LPARAM)hwndList);
			// sort out the headers

			ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE); // dll name
			int w = ListView_GetColumnWidth(hwndList, 1);
			if (w > 110) {
				ListView_SetColumnWidth(hwndList, 1, w = 110);
			}
			int max = w < 110 ? 189 + 110 - w : 189;
			ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); // short name
			w = ListView_GetColumnWidth(hwndList, 2);
			if (w > max)
				ListView_SetColumnWidth(hwndList, 2, max);

			ListView_SortItems(hwndList, SortPlugins, (LPARAM)hwndDlg);
		}
		return TRUE;

	case WM_NOTIFY:
		if (lParam) {
			NMLISTVIEW *hdr = (NMLISTVIEW *)lParam;
			if (hdr->hdr.code == LVN_ITEMCHANGED && IsWindowVisible(hdr->hdr.hwndFrom)) {
				if (hdr->uOldState != 0 && (hdr->uNewState == 0x1000 || hdr->uNewState == 0x2000)) {
					HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);

					LVITEM it;
					it.mask = LVIF_PARAM | LVIF_STATE;
					it.iItem = hdr->iItem;
					if (!ListView_GetItem(hwndList, &it))
						break;

					PluginListItemData *dat = (PluginListItemData*)it.lParam;
					if (dat->flags & STATIC_PLUGIN) {
						ListView_SetItemState(hwndList, hdr->iItem, 0x3000, LVIS_STATEIMAGEMASK);
						return FALSE;
					}
					// find all another standard plugins by mask and disable them
					if ((hdr->uNewState == 0x2000) && dat->stdPlugin != 0) {
						for (int iRow = 0; iRow != -1; iRow = ListView_GetNextItem(hwndList, iRow, LVNI_ALL)) {
							if (iRow != hdr->iItem) { // skip the plugin we're standing on
								LVITEM dt;
								dt.mask = LVIF_PARAM;
								dt.iItem = iRow;
								if (ListView_GetItem(hwndList, &dt)) {
									PluginListItemData *dat2 = (PluginListItemData*)dt.lParam;
									if (dat2->stdPlugin & dat->stdPlugin) {// mask differs
										// the lParam is unset, so when the check is unset the clist block doesnt trigger
										int iSave = dat2->stdPlugin;
										dat2->stdPlugin = 0;
										ListView_SetItemState(hwndList, iRow, 0x1000, LVIS_STATEIMAGEMASK);
										dat2->stdPlugin = iSave;
									}
								}
							}
						}
					}

					if (bOldMode)
						ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), TRUE); // this here only in "ghazan mode"
//.........这里部分代码省略.........
开发者ID:truefriend-cz,项目名称:miranda-ng,代码行数:101,代码来源:pluginopts.cpp

示例3: SampleDlgProc

//-----------------------------------------------------------------------------
// Name: SampleDlgProc()
// Desc: Handles dialog messages
//-----------------------------------------------------------------------------
INT_PTR CALLBACK SampleDlgProc( HWND hDlg, UINT msg, 
                                WPARAM wParam, LPARAM lParam )
{
    switch( msg ) 
    {
        case WM_INITDIALOG:
        {
            OnInitDialog( hDlg );
            break;
        }

        case WM_APP_DISPLAY_PLAYERS:
        {
            DisplayPlayersInChat( hDlg );
            break;
        }

        case WM_TIMER:
        {
            DWORD            dwNumPlayers;
            DWORD            iIndex;
            LVITEM           lvItem;
            APP_PLAYER_INFO* pPlayerInfo = NULL;
            HWND             hListView = GetDlgItem( hDlg, IDC_PEOPLE_LIST );

            dwNumPlayers = ListView_GetItemCount( hListView );

            // Now that they are added and the listview sorted them by name,
            // run through them all caching the listview index with its dpnid
            for( iIndex = 0; iIndex < dwNumPlayers; iIndex++ )
            {
                HRESULT hr;
                APP_PLAYER_INFO* pPlayerInfo = NULL;
                DPNID dpnidPlayer;

                lvItem.mask  = LVIF_PARAM;
                lvItem.iItem = iIndex;
                ListView_GetItem( hListView, &lvItem );

                dpnidPlayer = (DPNID) lvItem.lParam;

                PLAYER_LOCK(); // enter player context CS
                hr = GetPlayerStruct( dpnidPlayer, &pPlayerInfo );
                PLAYER_ADDREF( pPlayerInfo ); // addref player, since we are using it now
                PLAYER_UNLOCK(); // leave player context CS

                if( FAILED(hr) || pPlayerInfo == NULL )
                {
                    // The player who sent this may have gone away before this 
                    // message was handled, so just ignore it
                    continue;
                }

                TCHAR strStatus[255];

                if( pPlayerInfo->bHalfDuplex )
                {
                    _tcscpy( strStatus, TEXT("Can't talk") );
                }
                else
                {
                    if( g_bMixingSessionType )
                    {
                        // With mixing servers, you can't tell which
                        // client is talking.
                        _tcscpy( strStatus, TEXT("n/a") );
                    }
                    else
                    {
                        if( pPlayerInfo->bTalking )
                            _tcscpy( strStatus, TEXT("Talking") );
                        else
                            _tcscpy( strStatus, TEXT("Silent") );
                    }
                }

                lvItem.iItem      = iIndex;
                lvItem.iSubItem   = 1;
                lvItem.mask       = LVIF_TEXT;
                lvItem.pszText    = strStatus;

                PLAYER_LOCK();
                PLAYER_RELEASE( pPlayerInfo );  // Release player and cleanup if needed
                PLAYER_UNLOCK();

                SendMessage( hListView, LVM_SETITEM, 0, (LPARAM) &lvItem );
            }
            break;
        }

        case WM_COMMAND:
        {
            switch( LOWORD(wParam) )
            {
                case IDC_SETUP:
                    {
//.........这里部分代码省略.........
开发者ID:grakidov,项目名称:Render3D,代码行数:101,代码来源:voiceclient.cpp

示例4: JabberMucJidListDlgProc


//.........这里部分代码省略.........
									hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_ADDCONTACT ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
								else
									hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_DELETE ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
								DrawIconEx( nm->nmcd.hdc, ( rc.left+rc.right-GetSystemMetrics( SM_CXSMICON ))/2, ( rc.top+rc.bottom-GetSystemMetrics( SM_CYSMICON ))/2,hIcon, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0, GetSysColorBrush(COLOR_WINDOW), DI_NORMAL );
								DestroyIcon( hIcon );
								SetWindowLongPtr( hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT );
								return TRUE;
				}	}	}	}
				break;
			case NM_CLICK:
				{
					NMLISTVIEW *nm = ( NMLISTVIEW * ) lParam;
					LVITEM lvi;
					LVHITTESTINFO hti;
					TCHAR text[128];

					if ( nm->iSubItem < 1 )
						break;

					hti.pt.x = ( short ) LOWORD( GetMessagePos());
					hti.pt.y = ( short ) HIWORD( GetMessagePos());
					ScreenToClient( nm->hdr.hwndFrom, &hti.pt );
					if ( ListView_SubItemHitTest( nm->hdr.hwndFrom, &hti ) == -1 )
						break;

					if ( hti.iSubItem != 1 )
						break;

					lvi.mask = LVIF_PARAM | LVIF_TEXT;
					lvi.iItem = hti.iItem;
					lvi.iSubItem = 0;
					lvi.pszText = text;
					lvi.cchTextMax = sizeof( text );
					ListView_GetItem( nm->hdr.hwndFrom, &lvi );
					if ( lvi.lParam == ( LPARAM )( -1 )) {
						TCHAR szBuffer[ 1024 ];
						_tcscpy( szBuffer, dat->type2str());
						if ( !dat->ppro->EnterString(szBuffer, SIZEOF(szBuffer), NULL, JES_COMBO, "gcAddNick_"))
							break;

						// Trim leading and trailing whitespaces
						TCHAR *p = szBuffer, *q;
						for ( p = szBuffer; *p!='\0' && isspace( BYTE( *p )); p++);
						for ( q = p; *q!='\0' && !isspace( BYTE( *q )); q++);
						if (*q != '\0') *q = '\0';
						if (*p == '\0')
							break;
						TCHAR rsn[ 1024 ];
						_tcscpy( rsn, dat->type2str());
						if ( dat->type == MUC_BANLIST ) {
							dat->ppro->EnterString(rsn, SIZEOF(rsn), TranslateT("Reason to ban") , JES_COMBO, "gcAddReason_");
							if ( szBuffer )
								dat->ppro->AddMucListItem( dat, p , rsn);
							else
								dat->ppro->AddMucListItem( dat, p );
						}
						else dat->ppro->AddMucListItem( dat, p );
					}
					else {
						//delete
						TCHAR msgText[128];

						mir_sntprintf( msgText, SIZEOF( msgText ), _T("%s %s?"), TranslateT( "Removing" ), text );
						if ( MessageBox( hwndDlg, msgText, dat->type2str(), MB_YESNO|MB_SETFOREGROUND ) == IDYES ) {
							dat->ppro->DeleteMucListItem( dat, ( TCHAR* )lvi.lParam );
							mir_free(( void * )lvi.lParam );
开发者ID:raoergsls,项目名称:miranda,代码行数:67,代码来源:jabber_iqid_muc.cpp

示例5: ProbeListPageDlgProc

static INT_PTR CALLBACK
ProbeListPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    INT Index;

    switch (uMsg)
    {
        case WM_INITDIALOG:
        {
            pDeviceStatusText = (PWSTR)HeapAlloc(hProcessHeap, 0, MAX_STR_SIZE);
            InitProbeListPage(hwndDlg);
        }
        break;

        case WM_NOTIFY:
        {
            LPNMHDR lpnm = (LPNMHDR)lParam;

            switch (lpnm->code)
            {
                case PSN_SETACTIVE:
                {
                    PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
                }
                break;

                case PSN_WIZNEXT:
                {
                    Index = (INT) SendMessage(GetDlgItem(hwndDlg, IDC_PROBELIST), LVM_GETNEXTITEM, -1, LVNI_FOCUSED);
                    if (Index == -1) Index = 0;

                    if (Index == 0)
                    {
                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_SELECTWAYPAGE);
                    }
                    else
                    {
                        LVITEM Item;
                        PWSTR pts;

                        ZeroMemory(&Item, sizeof(LV_ITEM));
                        Item.mask = LVIF_PARAM;
                        Item.iItem = Index;
                        (VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
                        pts = (PWSTR) Item.lParam;
                        wcscpy(pDeviceStatusText, pts);

                        SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_HWSTATUSPAGE);
                    }
                    return TRUE;
                }
            }
        }
        break;

        case WM_DESTROY:
        {
            INT Index;
            LVITEM Item;

            for (Index = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_PROBELIST)); --Index > 0;)
            {
                ZeroMemory(&Item, sizeof(LV_ITEM));
                Item.mask = LVIF_PARAM;
                Item.iItem = Index;
                (VOID) ListView_GetItem(GetDlgItem(hwndDlg, IDC_PROBELIST), &Item);
                HeapFree(hProcessHeap, 0, (LPVOID) Item.lParam);
            }
            HeapFree(hProcessHeap, 0, (LPVOID) pDeviceStatusText);
        }
        break;
    }

    return FALSE;
}
开发者ID:GYGit,项目名称:reactos,代码行数:75,代码来源:hdwwiz.c

示例6: frompc_hook_proc

static UINT_PTR APIENTRY frompc_hook_proc(HWND hwnd, UINT uimsg, WPARAM wparam, LPARAM lparam){
  HWND preview;
  char filename[256];
  LVCOLUMNA column;

  preview = GetDlgItem(hwnd, IDC_PREVIEW);
  switch (uimsg) {
  case WM_INITDIALOG:
    column.mask = LVCF_TEXT | LVCF_WIDTH;
    column.pszText = "No.";
    column.cx = 40;
    ListView_InsertColumn(preview, 0, &column);
    column.pszText = "Name";
    column.cx = 160;
    ListView_InsertColumn(preview, 1, &column);
    column.pszText = "Start address";
    column.cx = 80;
    ListView_InsertColumn(preview, 2, &column);
    column.pszText = "End address";
    ListView_InsertColumn(preview, 3, &column);

    SendMessage(GetDlgItem(hwnd, IDC_C64_NAME), EM_LIMITTEXT, 16, 0);

    break;
  case WM_NOTIFY:
    {
      LPOFNOTIFY notify = (LPOFNOTIFY) lparam;
      if (notify->hdr.code == CDN_SELCHANGE) {
        ListView_DeleteAllItems(preview);
        SetDlgItemTextA(hwnd, IDC_C64_NAME, "");
        EnableWindow(GetDlgItem(hwnd, IDC_C64_NAME), FALSE);
        if (CommDlg_OpenSave_GetFilePath
            (notify->hdr.hwndFrom, filename, 256) >= 0)
          write_entries_to_window(hwnd, filename);
      }
      else if (notify->hdr.code == CDN_FILEOK) {
        int entry_num;
        struct simple_block_list_element **block = (struct simple_block_list_element **)notify->lpOFN->lCustData;
        FILE *fd = NULL;

        if (CommDlg_OpenSave_GetFilePath(notify->hdr.hwndFrom, filename, 256)
            < 0) {
          MessageBoxA(hwnd, "Cannot get selected file name", "WAV-PRG error",
                     MB_ICONERROR);
        }
        else
          fd = fopen(filename, "rb");
        if (fd == NULL) {
          MessageBoxA(hwnd, "Cannot open selected file", "WAV-PRG error",
                     MB_ICONERROR);
          SetWindowLong(hwnd, DWL_MSGRESULT, -1);
        }
        else
        {
          switch (detect_type(fd)) {
          case not_a_valid_file:
            MessageBoxA(hwnd, "Selected file is not a supported file",
                       "WAV-PRG error", MB_ICONERROR);
            break;
          case t64:
            {
              int index;
              struct simple_block_list_element **current_block = block;

              for (index = ListView_GetNextItem(preview, -1, LVNI_SELECTED); index != -1; index = ListView_GetNextItem(preview, index, LVNI_SELECTED)) {
                LVITEMA sel_item;
                char sel_num[6];

                sel_item.mask = LVIF_TEXT;
                sel_item.iItem = index;
                sel_item.iSubItem = 0;
                sel_item.pszText = sel_num;
                sel_item.cchTextMax = sizeof(sel_num);
                if (!ListView_GetItem(preview, &sel_item))
                  continue;
                entry_num = atoi(sel_num);
                add_simple_block_list_element(current_block);
                if (!get_entry(entry_num, fd, &(*current_block)->block)){
                  remove_simple_block_list_element(current_block);
                  continue;
                }
                current_block = &(*current_block)->next;
              }
            }
            if (*block == NULL)
              add_all_entries_from_file(block, fd);

            if (*block == NULL)
              MessageBoxA(hwnd, "You chose a T64 file with no entries",
                          "WAV-PRG error", MB_ICONERROR);
            break;
          case p00:
          case prg:
            add_simple_block_list_element(block);
            if (!get_first_entry(fd, &(*block)->block)) {
              MessageBoxA(hwnd, "Error in reading file", "WAV-PRG error",
                         MB_ICONERROR);
              remove_simple_block_list_element(block);;
            }
            else
//.........这里部分代码省略.........
开发者ID:bitfixer,项目名称:bitfixer,代码行数:101,代码来源:prg2wav_gui.c

示例7: stream_WndProc

LRESULT CALLBACK stream_WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    RECT		rect ;
    int cxClient, cyClient;
    static HMENU	hMenu ;
    POINT point ;
    int ret, idx;
    TCHAR  buf[64];
    char file_name[MAX_FILE_PATH_LEN];

    static int edit_iItem=-1 ;
    static int edit_iSubItem;

     LVITEM lv_item;
    switch (message)
    {
        case WM_CREATE:
            hwnd_stream= hwnd;
            hMenu = LoadMenu (g_hInstance, TEXT("my_popup_menu")) ;
            hMenu = GetSubMenu (hMenu, 0) ;

            hwnd_dynamic_edit=CreateWindow (TEXT("edit"), TEXT(""),
                WS_CHILD|ES_AUTOHSCROLL,
                CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                hwnd, (HMENU)ID_DYNAMIC_EDIT, g_hInstance, NULL) ;

            SendMessage(hwnd_dynamic_edit, WM_SETFONT, (WPARAM)char_font_2, 0); 

            hwnd_lv = CreateListView(hwnd);
            //InitListViewImageLists(hwnd_lv);
            InitListViewColumns(hwnd_lv);
            lv_row_color_init();
            old_lv_proc = (WNDPROC) SetWindowLong (hwnd_lv, 
                                 	GWL_WNDPROC, (LONG)my_lv_proc) ;

            ShowWindow(hwnd_lv, 1) ;
            refresh_window(hwnd_lv) ;

           add_tip(hwndTip, hwnd_lv, TEXT("点击鼠标右键进行操作"));

            return 0 ;

        case WM_SIZE:
      		cxClient = LOWORD (lParam) ;
      		cyClient = HIWORD (lParam) ;

            MoveWindow(hwnd_lv, 	0, 0,
                cxClient, cyClient, TRUE) ;

            return 0 ;

case WM_NOTIFY:
{

   NMHDR *pt_nmhdr=(void *)lParam;
   switch(LOWORD(wParam))
   { 
     case ID_LV:

     // if code == NM_CLICK - Single click on an item
     if(pt_nmhdr->code == NM_CLICK || pt_nmhdr->code == NM_DBLCLK) 
     {
        int iItem = ((LPNMITEMACTIVATE)lParam)->iItem;
        int iSubItem=((LPNMITEMACTIVATE)lParam)->iSubItem;

        if (iItem>=0 && ((iSubItem>=3 && iSubItem<=5) || iSubItem==7)) 
        {

            ListView_GetSubItemRect(hwnd_lv,iItem,iSubItem,LVIR_LABEL,&rect);
            ListView_GetItemText(hwnd_lv, iItem, iSubItem, buf, sizeof(buf));
            MoveWindow	(hwnd_dynamic_edit
                ,rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);
            SetWindowText(hwnd_dynamic_edit, buf);
            ShowWindow (hwnd_dynamic_edit, 1) ;
            SetFocus(hwnd_dynamic_edit);
            SendMessage(hwnd_dynamic_edit, EM_SETSEL, (WPARAM)0, (LPARAM)-1);

            edit_iItem = iItem;
            edit_iSubItem = iSubItem;

        }

            return 0;
     }
    else if (pt_nmhdr->code == NM_RCLICK)
    {
        point = ((LPNMITEMACTIVATE)lParam)->ptAction;
        ListView_GetItem(hwnd_lv, &lv_item);

        ClientToScreen (hwnd_lv, &point) ;
  		TrackPopupMenu (hMenu, TPM_LEFTBUTTON, point.x, point.y, 0, hwnd_stream, NULL) ;
        return 0;

    }
    else if (pt_nmhdr->code == LVN_ITEMCHANGED)
    {
        if (!init_over) break;
        if (lv_in_op)   break;
        //if((((LPNMLISTVIEW)lParam)->uOldState&LVIS_STATEIMAGEMASK) != 
        //    (((LPNMLISTVIEW)lParam)->uNewState&LVIS_STATEIMAGEMASK)) 
//.........这里部分代码省略.........
开发者ID:yedan2010,项目名称:xb-ether-tester,代码行数:101,代码来源:right_window.c

示例8: RevokerSelectDlgProc


//.........这里部分代码省略.........
					KillTimer(hwndDlg, ID_TIMER);
					bReturnCode = TRUE;
					break;
				}

			case PSN_WIZNEXT:
				{
					int nIndex;
					LV_ITEM lviKey;
					char *szKeyID;
					char szUserID[kPGPMaxUserIDSize+1];

					if (pConfig->szRevokerKeyID != NULL)
					{
						pgpFree(pConfig->szRevokerKeyID);
						pConfig->szRevokerKeyID = NULL;
					}

					if (pConfig->szRevokerKey != NULL)
					{
						pgpFree(pConfig->szRevokerKey);
						pConfig->szRevokerKey = NULL;
					}

					// Save user data for this page
					nIndex = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
					if (nIndex > -1)
					{
						lviKey.mask = LVIF_PARAM | LVIF_IMAGE | LVIF_TEXT;
						lviKey.iItem = nIndex;
						lviKey.iSubItem = 0;
						lviKey.pszText = szUserID;
						lviKey.cchTextMax = kPGPMaxUserIDSize;
						ListView_GetItem(hList, &lviKey);
						szKeyID = (char *) lviKey.lParam;

						pConfig->szRevokerKeyID = 
							(char *) pgpAlloc(strlen(szKeyID)+1);
						strcpy(pConfig->szRevokerKeyID, szKeyID);

						pConfig->szRevokerKey = 
							(char *) pgpAlloc(strlen(szUserID)+1);
						strcpy(pConfig->szRevokerKey, szUserID);

						if (lviKey.iImage == IDX_RSAPUBKEY)
							pConfig->revokerKeyType = 
												kPGPPublicKeyAlgorithm_RSA;
						if (lviKey.iImage == IDX_DSAPUBKEY)
							pConfig->revokerKeyType = 
												kPGPPublicKeyAlgorithm_DSA;
					}

					bReturnCode = TRUE;
					break;
				}

			case PSN_HELP:
				{
					// Display help
					break;
				}

			case PSN_QUERYCANCEL:
				{
					// User wants to quit
					g_bGotReloadMsg = FALSE;
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:67,代码来源:Revoker.cpp

示例9: ReadMailDialogProc


//.........这里部分代码省略.........
      hReadMailDlg = NULL;
      if (exiting)
	 PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_ID);
      return TRUE;

   case WM_NOTIFY:
      if (wParam != IDC_MAILLIST)
	 return TRUE;

      nm = (NM_LISTVIEW *) lParam;

      switch (nm->hdr.code)
      {
      case NM_CLICK:
	 // If you click on an item, select it--why doesn't control work this way by default?
	 GetCursorPos(&lvhit.pt);
	 ScreenToClient(hList, &lvhit.pt);
	 lvhit.pt.x = 10;
	 index = ListView_HitTest(hList, &lvhit);

	 if (index == -1)
	    break;

	 ListView_SetItemState(hList, index, 
			       LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
	 break;

      case LVN_ITEMCHANGED:
	 // New item selected; get its message number
	 lvitem.mask = LVIF_STATE | LVIF_PARAM;
	 lvitem.stateMask = LVIS_SELECTED;
	 lvitem.iItem = nm->iItem;
	 lvitem.iSubItem = 0;
	 ListView_GetItem(hList, &lvitem);

	 if (!(lvitem.state & LVIS_SELECTED))
	    break;

	 msg_num = lvitem.lParam;
	 if (msg_num == mail_index)
	    break;
	 
	 if (MailLoadMessage(msg_num, MAXMAIL, msg) == False)
	 {
	    ClientError(hInst, hReadMailDlg, IDS_CANTLOADMSG);
	    break;
	 }

	 mail_index = msg_num;
	 Edit_SetText(hEdit, msg);
	 break;
      }
      return TRUE;

   case WM_COMMAND:
      UserDidSomething();

      switch(GET_WM_COMMAND_ID(wParam, lParam))
      {
      case IDC_DELETEMSG:
	 if (!ListViewGetCurrentData(hList, &index, &msg_num))
	    return TRUE;
	 
	 if (MailDeleteMessage(msg_num) == True)
	 {
	    /* Display new current message, if any */
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:67,代码来源:mailread.c

示例10: processTokenListMessage

static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	/* hwndDlg must be a child of the help dialog */
	switch(msg) {
	case WM_INITDIALOG:
		{
			TOKENREGISTEREX *tr;
			TCHAR *tszTokenDesc, *tszHelpDesc, *last, *cat, *text;

			// token list things
			HWND hList = GetDlgItem(hwndDlg, IDC_TOKENLIST);

			LVCOLUMN lvCol = { 0 };
			lvCol.mask = LVCF_TEXT;
			lvCol.pszText = TranslateT("Token");
			ListView_InsertColumn(hList, 0, &lvCol);

			lvCol.pszText = TranslateT("Description");
			ListView_InsertColumn(hList, 1, &lvCol);

			HELPDLGDATA *hdd = (HELPDLGDATA *)GetWindowLongPtr(GetParent(hwndDlg), GWLP_USERDATA);
			int i = -1;
			do {
				i += 1;
				tszHelpDesc = tszTokenDesc = NULL;
				tr = getTokenRegister(i);
				if ((tr == NULL) || (tr->tszTokenString == NULL))
					continue;

				else if (hdd != NULL) {
					if (!_tcscmp(tr->tszTokenString, SUBJECT)) {
						if (hdd->vhs->flags&VHF_HIDESUBJECTTOKEN)
							continue;

						if (hdd->vhs->szSubjectDesc != NULL)
							tszHelpDesc = mir_a2t(hdd->vhs->szSubjectDesc);
					}
					if (!_tcscmp(tr->tszTokenString, MIR_EXTRATEXT)) {
						if (hdd->vhs->flags & VHF_HIDEEXTRATEXTTOKEN)
							continue;

						if (hdd->vhs->szExtraTextDesc != NULL)
							tszHelpDesc = mir_a2t(hdd->vhs->szExtraTextDesc);
					}
				}

				LVITEM lvItem = { 0 };
				lvItem.mask = LVIF_TEXT | LVIF_PARAM;
				lvItem.iItem = ListView_GetItemCount(hList);
				lvItem.lParam = (LPARAM)tr;
				tszTokenDesc = getTokenDescription(tr);
				if (tszTokenDesc == NULL)
					continue;

				lvItem.pszText = tszTokenDesc;
				ListView_InsertItem(hList, &lvItem);
				mir_free(tszTokenDesc);

				lvItem.mask = LVIF_TEXT;
				if (tszHelpDesc == NULL)
					tszHelpDesc = getHelpDescription(tr);

				if (tszHelpDesc == NULL)
					tszHelpDesc = mir_tstrdup(_T("unknown"));

				lvItem.iSubItem = 1;
				lvItem.pszText = TranslateTS(tszHelpDesc);
				ListView_SetItem(hList, &lvItem);
				mir_free(tszHelpDesc);
			}
				while (tr != NULL);
	
			ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
			ListView_SetColumnWidth(hList, 1, LVSCW_AUTOSIZE);
			ListView_SortItems(hList, compareTokenHelp, 0);
			last = text = NULL;
			for (i = 0; i < ListView_GetItemCount(hList); i++) {
				LVITEM lvItem = { 0 };
				lvItem.mask = LVIF_PARAM;
				lvItem.iItem = i;
				if (ListView_GetItem(hList, &lvItem) == FALSE)
					continue;

				cat = getTokenCategory((TOKENREGISTEREX *)lvItem.lParam);
				if (cat != NULL) {
					text = mir_tstrdup(TranslateTS(cat));
					mir_free(cat);
				}
				else text = NULL;

				if (text != NULL && (last == NULL || _tcsicmp(last, text))) {
					lvItem.mask = LVIF_TEXT;
					lvItem.pszText = text;
					ListView_InsertItem(hList, &lvItem);
					if (last != NULL) {
						mir_free(last);
						lvItem.iSubItem = 0;
						lvItem.pszText = _T("");
						ListView_InsertItem(hList, &lvItem);
					}
//.........这里部分代码省略.........
开发者ID:martok,项目名称:miranda-ng,代码行数:101,代码来源:help.cpp

示例11: FindWindowDlgProc


//.........这里部分代码省略.........
					(IsDlgButtonChecked(hwnd, IDC_SETTINGNAME) ? F_SETNAME : 0) |
					(IsDlgButtonChecked(hwnd, IDC_SETTINGVALUE) ? F_SETVAL : 0);

				if (LOWORD(wParam) == IDOK) {

					if (IsDlgButtonChecked(hwnd, IDC_ENTIRELY))
						fi->options |= F_ENTIRE;

					fi->replace = mir_wstrdup(replace);

					SetDlgItemText(hwnd, IDOK, TranslateT("Stop"));
					EnableWindow(GetDlgItem(hwnd, IDC_SEARCH), 0);

				}
				else {
					SetDlgItemText(hwnd, IDC_SEARCH, TranslateT("Stop"));
					EnableWindow(GetDlgItem(hwnd, IDOK), 0);
				}

				fi->search = mir_wstrdup(text);

				ListView_DeleteAllItems(fi->hwnd);
				SetWindowLongPtr(GetDlgItem(hwnd, IDC_SEARCH), GWLP_USERDATA, 1);

				EnableWindow(GetDlgItem(hwnd, IDCANCEL), 0);
				mir_forkthread(FindSettings, fi);
			}
			break;

		case IDCANCEL:
			DestroyWindow(hwnd);
			break;
		}
		break;
	case WM_GETMINMAXINFO:
	{
		MINMAXINFO *mmi = (MINMAXINFO*)lParam;
		mmi->ptMinTrackSize.x = 610;
		mmi->ptMinTrackSize.y = 300;
	}
	return 0;

	case WM_SIZE:
		Utils_ResizeDialog(hwnd, g_plugin.getInst(), MAKEINTRESOURCEA(IDD_FIND), FindDialogResize);
		break;

	case WM_NOTIFY:
		if (LOWORD(wParam) != IDC_LIST) break;
		switch (((NMHDR*)lParam)->code) {
		case NM_DBLCLK:
		{
			LVHITTESTINFO hti;
			LVITEM lvi;
			HWND hwndResults = GetDlgItem(hwnd, IDC_LIST);
			hti.pt = ((NMLISTVIEW*)lParam)->ptAction;
			if (ListView_SubItemHitTest(hwndResults, &hti) > -1) {
				if (hti.flags&LVHT_ONITEM)
				{
					lvi.mask = LVIF_PARAM;
					lvi.iItem = hti.iItem;
					lvi.iSubItem = 0;
					if (ListView_GetItem(hwndResults, &lvi))
					{
						ItemInfo ii = { 0 };
						ii.hContact = (MCONTACT)lvi.lParam;
						ListView_GetItemTextA(hwndResults, hti.iItem, 2, ii.module, _countof(ii.module));
						ListView_GetItemTextA(hwndResults, hti.iItem, 3, ii.setting, _countof(ii.setting));
						if (ii.setting[0])
							ii.type = FW_SETTINGNAME;
						else if (ii.module[0])
							ii.type = FW_MODULE;

						SendMessage(hwnd2mainWindow, WM_FINDITEM, (WPARAM)&ii, 0);
					}
				}
			}
			break;
		}

		case LVN_COLUMNCLICK:
		{
			LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
			ColumnsSortParams params;
			params.hList = GetDlgItem(hwnd, IDC_LIST);
			params.column = lv->iSubItem;
			params.last = lastColumn;
			ListView_SortItemsEx(params.hList, ColumnsCompare, (LPARAM)&params);
			lastColumn = (params.column == lastColumn) ? -1 : params.column;
			break;
		}
		} // switch
		break;
	case WM_DESTROY:
		ListView_DeleteAllItems(GetDlgItem(hwnd, IDC_LIST));
		saveListSettings(GetDlgItem(hwnd, IDC_LIST), csResultList);
		Utils_SaveWindowPosition(hwnd, NULL, MODULENAME, "Search_");
		break;
	}
	return 0;
}
开发者ID:tweimer,项目名称:miranda-ng,代码行数:101,代码来源:findwindow.cpp

示例12: sizeof

/**
 *\fn           void dragFile(int x, int y)
 *\brief        拖动文件
 *\param[in]    int x 鼠标位置
 *\param[in]    int y 鼠标位置
 *\return       void 无
 */
void CBrowseWnd::dragFile(int x, int y)
{
    POINT pt = {x, y};
    ::ClientToScreen(wnd_, &pt);

    HWND wnd = ::WindowFromPoint(pt); // 得到鼠标所在的窗体

    char path[1024] = "";
    ::GetWindowText(wnd, path, sizeof(path)-1);

    if (0 == strcmp("FolderView", path)) // 桌面
    {
        SHGetSpecialFolderPath(NULL, path, CSIDL_DESKTOPDIRECTORY, FALSE);
    }
    else // 资源管理器
    {
        wnd = ::GetParent(wnd); // SHELLDLL_DefView
        wnd = ::GetParent(wnd); // CtrlNotifySink
        wnd = ::GetParent(wnd); // DirectUIHWND
        wnd = ::GetParent(wnd); // DUIViewWndClassName
        wnd = ::GetParent(wnd); // ShellTabWindowClass
        wnd = ::GetParent(wnd); // CabinetWClass
        wnd = ::FindWindowEx(wnd, NULL, "WorkerW", NULL);
        wnd = ::FindWindowEx(wnd, NULL, "ReBarWindow32", NULL);
        wnd = ::FindWindowEx(wnd, NULL, "Address Band Root", NULL);
        wnd = ::FindWindowEx(wnd, NULL, "msctls_progress32", NULL);
        wnd = ::FindWindowEx(wnd, NULL, "Breadcrumb Parent", NULL);
        wnd = ::FindWindowEx(wnd, NULL, "ToolbarWindow32", NULL);

        ::GetWindowText(wnd, path, sizeof(path)-1); // 地址: D:\360Downloads
    }

    // 没有找到窗体
    if (path[0] == '\0') return;

    int i = 0;
    int itemId = -1;
    int count = ListView_GetSelectedCount(list_.m_hWnd);

    for (i = 0; i < count; i++)
    {
        itemId = ListView_GetNextItem(list_.m_hWnd, itemId, LVNI_SELECTED);

        LV_ITEM item = {0};
        char filename[256] = "";
        item.iItem = itemId;
        item.mask = LVIF_TEXT | LVIF_PARAM; // 文字
        item.pszText = filename;
        item.cchTextMax = sizeof(filename);

        ListView_GetItem(list_.m_hWnd, &item);

        char remotePath[1024] = "";
        getPath((HTREEITEM)item.lParam, remotePath);

        char localPath[1024] = "";
        strcpy_s(localPath, strstr(path, "\\") - 2);

        strcat_s(localPath, sizeof(path), "\\");
        strcat_s(localPath, sizeof(path), filename);
        strcat_s(remotePath, sizeof(path), filename);

        sftp_download_file(&ssh_param_, localPath, remotePath);
    }
}
开发者ID:xt9852,项目名称:TestSet,代码行数:72,代码来源:BrowseWnd.cpp

示例13: ConfirmDlgProc

static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
		{
			HWND hList = GetDlgItem(hwndDlg, IDC_STARTUPLIST);
			SendMessage(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);

			// create columns
			LVCOLUMN lvCol = { 0 };
			lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
			lvCol.pszText = TranslateT("Protocol");
			ListView_InsertColumn(hList, 0, &lvCol);

			lvCol.cx = 100;
			lvCol.pszText = TranslateT("Status");
			ListView_InsertColumn(hList, 1, &lvCol);

			lvCol.pszText = TranslateT("Message");
			ListView_InsertColumn(hList, 2, &lvCol);
		}

		// create items
		SetStatusList(hwndDlg);

		EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
		// fill profile combo box
		if (!ServiceExists(MS_SS_GETPROFILE))
			EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILE), FALSE);
		else {
			int defaultProfile;
			int profileCount = (int)CallService(MS_SS_GETPROFILECOUNT, (WPARAM)&defaultProfile, 0);
			for (int i = 0; i < profileCount; i++) {
				TCHAR profileName[128];
				CallService(MS_SS_GETPROFILENAME, i, (LPARAM)profileName);
				int item = SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName);
				SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETITEMDATA, item, i);
			}
			if (profileCount == 0)
				EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILE), FALSE);
			else
				SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETCURSEL, defaultProfile, 0);
		}
		// start timer
		if (timeOut > 0) {
			TCHAR text[32];
			mir_sntprintf(text, TranslateT("Closing in %d"), timeOut);
			SetDlgItemText(hwndDlg, IDC_CLOSE, text);
			SetTimer(hwndDlg, TIMER_ID, 1000, NULL);
		}
		return TRUE;

	case WM_TIMER:
	{
		TCHAR text[32];
		mir_sntprintf(text, TranslateT("Closing in %d"), timeOut - 1);
		SetDlgItemText(hwndDlg, IDC_CLOSE, text);
		if (timeOut <= 0) {
			KillTimer(hwndDlg, TIMER_ID);
			SendMessage(hwndDlg, UM_CLOSECONFIRMDLG, 0, 0);
		}
		else timeOut--;
	}
	break;

	case WM_COMMAND:
		// stop timer
		KillTimer(hwndDlg, TIMER_ID);
		SetDlgItemText(hwndDlg, IDC_CLOSE, TranslateT("Close"));
		if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == NM_CLICK)) { // something clicked
			switch (LOWORD(wParam)) {
			case IDC_PROFILE:
			{
				int profile = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0);
				for (int i = 0; i < confirmSettings->getCount(); i++)
					if ((*confirmSettings)[i].szMsg != NULL) {
						free((*confirmSettings)[i].szMsg);
						(*confirmSettings)[i].szMsg = NULL;
					}

				CallService(MS_SS_GETPROFILE, (WPARAM)profile, (LPARAM)confirmSettings);
				for (int i = 0; i < confirmSettings->getCount(); i++)
					if ((*confirmSettings)[i].szMsg != NULL) // we free this later, copy to our memory space
						(*confirmSettings)[i].szMsg = _tcsdup((*confirmSettings)[i].szMsg);

				SetStatusList(hwndDlg);
			}
			break;

			case IDC_STATUS:
			{
				LVITEM lvItem = { 0 };
				lvItem.mask = LVIF_TEXT | LVIF_PARAM;
				lvItem.iSubItem = 0;
				lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), -1, LVNI_SELECTED);
				if (lvItem.iItem == -1)
					break;

				ListView_GetItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), &lvItem);
//.........这里部分代码省略.........
开发者ID:Seldom,项目名称:miranda-ng,代码行数:101,代码来源:confirmdialog.cpp

示例14: SetAllVars


//.........这里部分代码省略.........
                       NULL,
                       &hKey,
                       NULL))
    {
        return;
    }

    /* Get the number of values and the maximum value name length */
    if (RegQueryInfoKey(hKey,
                        NULL,
                        NULL,
                        NULL,
                        NULL,
                        NULL,
                        NULL,
                        &dwValueCount,
                        &dwMaxValueNameLength,
                        NULL,
                        NULL,
                        NULL))
    {
        RegCloseKey(hKey);
        return;
    }

    if (dwValueCount > 0)
    {
        /* Allocate the value array */
        aValueArray = GlobalAlloc(GPTR, dwValueCount * sizeof(LPTSTR));
        if (aValueArray != NULL)
        {
            /* Get all value names */
            for (i = 0; i < dwValueCount; i++)
            {
                dwNameLength = 256;
                if (!RegEnumValue(hKey,
                                  i,
                                  szBuffer,
                                  &dwNameLength,
                                  NULL,
                                  NULL,
                                  NULL,
                                  NULL))
                {
                    /* Allocate a value name buffer, fill it and attach it to the array */
                    lpBuffer = (LPTSTR)GlobalAlloc(GPTR, (dwNameLength + 1) * sizeof(TCHAR));
                    if (lpBuffer != NULL)
                    {
                        _tcscpy(lpBuffer, szBuffer);
                        aValueArray[i] = lpBuffer;
                    }
                }
            }

            /* Delete all values */
            for (i = 0; i < dwValueCount; i++)
            {
                if (aValueArray[i] != NULL)
                {
                    /* Delete the value */
                    RegDeleteValue(hKey,
                                   aValueArray[i]);

                    /* Free the value name */
                    GlobalFree(aValueArray[i]);
                }
            }

            /* Free the value array */
            GlobalFree(aValueArray);
        }
    }

    /* Loop through all variables */
    while (ListView_GetItem(hwndListView, &lvi))
    {
        /* Get the data in each item */
        VarData = (PVARIABLE_DATA)lvi.lParam;
        if (VarData != NULL)
        {
            /* Set the new value */
            if (RegSetValueEx(hKey,
                              VarData->lpName,
                              0,
                              VarData->dwType,
                              (LPBYTE)VarData->lpRawValue,
                              (DWORD)(_tcslen(VarData->lpRawValue) + 1) * sizeof(TCHAR)))
            {
                RegCloseKey(hKey);
                return;
            }
        }

        /* Fill struct for next item */
        lvi.mask = LVIF_PARAM;
        lvi.iItem = ++iItem;
    }

    RegCloseKey(hKey);
}
开发者ID:RareHare,项目名称:reactos,代码行数:101,代码来源:environment.c

示例15: GetWindowLong

/*
================
rvOpenFileDialog::DlgProc

Dialog Procedure for the open file dialog
================
*/
INT_PTR rvOpenFileDialog::DlgProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
	rvOpenFileDialog *dlg = (rvOpenFileDialog *) GetWindowLong(wnd, GWL_USERDATA);

	switch (msg) {
		case WM_INITDIALOG:
			dlg = (rvOpenFileDialog *) lparam;
			SetWindowLong(wnd, GWL_USERDATA, lparam);
			dlg->mWnd = wnd;
			dlg->HandleInitDialog();
			return TRUE;

		case WM_NOTIFY: {
			NMHDR *nm = (NMHDR *) lparam;

			switch (nm->idFrom) {
				case IDC_TOOLS_FILELIST:

					switch (nm->code) {
						case LVN_ITEMCHANGED: {
							NMLISTVIEW *nmlv = (NMLISTVIEW *)nm;

							if (nmlv->uNewState & LVIS_SELECTED) {
								// Get the currently selected item
								LVITEM item;
								char   temp[256];
								item.mask = LVIF_IMAGE|LVIF_TEXT;
								item.iSubItem = 0;
								item.pszText = temp;
								item.cchTextMax = sizeof(temp)-1;
								item.iItem = nmlv->iItem;
								ListView_GetItem(dlg->mWndFileList, &item);

								if (item.iImage == 2) {
									SetWindowText(GetDlgItem(wnd, IDC_TOOLS_FILENAME), temp);
								}
							}

							break;
						}

						case NM_DBLCLK:
							dlg->HandleCommandOK();
							break;
					}

					break;
			}

			break;
		}

		case WM_COMMAND:

			switch (LOWORD(wparam)) {
				case IDOK: {
					dlg->HandleCommandOK();
					break;
				}

				case IDCANCEL:
					EndDialog(wnd, 0);
					break;

				case IDC_TOOLS_BACK: {
					int sel = SendMessage(GetDlgItem(wnd, IDC_TOOLS_LOOKIN), CB_GETCURSEL, 0, 0);

					if (sel > 0) {
						sel--;
						SendMessage(GetDlgItem(wnd, IDC_TOOLS_LOOKIN), CB_SETCURSEL, sel, 0);
						dlg->HandleLookInChange();
					}

					break;
				}

				case IDC_TOOLS_LOOKIN:

					if (HIWORD(wparam) == CBN_SELCHANGE) {
						dlg->HandleLookInChange();
					}

					break;
			}

			break;
	}

	return FALSE;
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:97,代码来源:OpenFileDialog.cpp


注:本文中的ListView_GetItem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。