Exemple #1
0
void InitLangList()
{
	char colTitles[LANG_LINE_SIZE];
	char *catStr;
	char lineStr[LANG_LINE_SIZE];
	short i;
	short category = -1;
	changedSomeStrings = 0;
	alreadySaving = 0;

	// If we have already displayed (created) the list,
	// then week need to delete the column headings... this seems to do it...
	if ( hWndLangBuilderListView )
	{
		ListView_DeleteColumn( hWndLangBuilderListView, EDIT_LANGUAGE_LISTVIEW_POS );
		ListView_DeleteColumn( hWndLangBuilderListView, DEFAULT_ENGLISH_LISTVIEW_POS );
		ListView_DeleteColumn( hWndLangBuilderListView, CATEGORY_NAME_LISTVIEW_POS );
	}
	
	// Initialise the Language list, means creating the column titles and adding them,
	// then making sure there is no data in the list
	mystrncpyNull( colTitles, ReturnString( IDS_LANGBUILDER_LISTTITLES ), LANG_LINE_SIZE );
	mystrncatNull( colTitles, MyPrefStruct.language, LANG_LINE_SIZE );
	hWndLangBuilderListView = InitGenericListView( hDlg, IDC_LANGTOKEN_LIST, 0, 0, colTitles );
	ListView_DeleteAllItems( hWndLangBuilderListView );		

	ListView_SetColumnWidth( hWndLangBuilderListView, CATEGORY_NAME_LISTVIEW_POS, 100 );
	ListView_SetColumnWidth( hWndLangBuilderListView, DEFAULT_ENGLISH_LISTVIEW_POS, 200 );
	ListView_SetColumnWidth( hWndLangBuilderListView, EDIT_LANGUAGE_LISTVIEW_POS, 200 );

	// Add the Language strings to the list
	for ( i = SUMM_BEGIN; i < END_OF_STRINGS; i++ )
	{
		catStr = GetLangSectionName(i);
		if ( !catStr )
			continue;
		mystrncpyNull( lineStr, catStr, LANG_LINE_SIZE ); 
		mystrncatNull( lineStr, LANG_LIST_SEP, LANG_LINE_SIZE ); 
		mystrncatNull( lineStr, DefaultEnglishStr(i), LANG_LINE_SIZE ); 
		mystrncatNull( lineStr, LANG_LIST_SEP, LANG_LINE_SIZE ); 
		mystrncatNull( lineStr, TranslateID(i), LANG_LINE_SIZE ); 
		AddItemToListView( hWndLangBuilderListView, ListView_GetItemCount(hWndLangBuilderListView), 3, lineStr, LANG_LIST_SEP );
	}
	ListView_GetItemText( hWndLangBuilderListView, 0, EDIT_LANGUAGE_LISTVIEW_POS, lineStr, LANG_LINE_SIZE );
	SetWindowText( GetDlgItem( hDlg, IDC_LANGTOKEN_TEXT), lineStr );
	SetFocus( GetDlgItem( hDlg, IDC_LANGTOKEN_LIST ) );
	int state = LVIS_SELECTED|LVIS_FOCUSED;
	if ( hWndLangBuilderListView )
		ListView_SetItemState( hWndLangBuilderListView, 0, state, state );
}
VOID
EnumComponents(HWND hDlgCtrl, INetConnectionPropertyUiImpl * This, INetCfg * pNCfg, const GUID * CompGuid, UINT Type)
{
    HRESULT hr;
    IEnumNetCfgComponent * pENetCfg;
    INetCfgComponent  *pNCfgComp, *pAdapterCfgComp;
    INetCfgComponentBindings * pCompBind;
    ULONG Num;
    DWORD dwCharacteristics;
    LPOLESTR pDisplayName, pHelpText;
    PNET_ITEM pItem;
    BOOL bChecked;

    hr = INetCfg_EnumComponents(pNCfg, CompGuid, &pENetCfg);
    if (FAILED(hr))
    {
        INetCfg_Release(pNCfg);
        return;
    }
    while(IEnumNetCfgComponent_Next(pENetCfg, 1, &pNCfgComp, &Num) == S_OK)
    {
          hr = INetCfgComponent_GetCharacteristics(pNCfgComp, &dwCharacteristics);
          if (SUCCEEDED(hr) && (dwCharacteristics & NCF_HIDDEN))
          {
              INetCfgComponent_Release(pNCfgComp);
              continue;
          }
          pDisplayName = NULL;
          pHelpText = NULL;
          hr = INetCfgComponent_GetDisplayName(pNCfgComp, &pDisplayName);
          hr = INetCfgComponent_GetHelpText(pNCfgComp, &pHelpText);
          bChecked = TRUE; //Odyssey hack
          hr = INetCfgComponent_QueryInterface(pNCfgComp, &IID_INetCfgComponentBindings, (LPVOID*)&pCompBind);
          if (SUCCEEDED(hr))
          {
              if (GetINetCfgComponent(pNCfg, This, &pAdapterCfgComp))
              {
                  hr = INetCfgComponentBindings_IsBoundTo(pCompBind, pAdapterCfgComp);
                  if (hr == S_OK)
                      bChecked = TRUE;
                  else
                      bChecked = FALSE;
                  INetCfgComponent_Release(pAdapterCfgComp);
                  INetCfgComponentBindings_Release(pCompBind);
              }
          }
          pItem = CoTaskMemAlloc(sizeof(NET_ITEM));
          if (!pItem)
              continue;
          pItem->dwCharacteristics = dwCharacteristics;
          pItem->szHelp = pHelpText;
          pItem->Type = Type;
          pItem->pNCfgComp = pNCfgComp;
          pItem->NumPropDialogOpen = 0;


          AddItemToListView(hDlgCtrl, pItem, pDisplayName, bChecked);
          CoTaskMemFree(pDisplayName);
    }
    IEnumNetCfgComponent_Release(pENetCfg);
}