if (LOWORD(wParam) == IDOK)
if (LOWORD(wParam) == IDOK || (HIWORD(wParam) & LBN_DBLCLK && LOWORD(wParam) == IDC_PROFILELIST))
LRESULT CALLBACK ChooseProfileDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){    nsresult rv;	switch (message)	{	case WM_INITDIALOG:        {            HWND hwndProfileList = GetDlgItem(hDlg, IDC_PROFILELIST);            NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);            // Get the list of profile names and add them to the list box            PRUint32 listLen = 0;            PRUnichar **profileList = nsnull;            rv = profileService->GetProfileList(&listLen, &profileList);            for (PRUint32 index = 0; index < listLen; index++)            {#ifdef UNICODE                SendMessageW(hwndProfileList, LB_ADDSTRING, 0, (LPARAM) profileList[index]);#else                nsCAutoString profile; profile.AssignWithConversion(profileList[index]);                SendMessageA(hwndProfileList, LB_ADDSTRING, 0, (LPARAM) profile.get());#endif            }            // Select the current profile (if there is one)            // Get the current profile#ifdef UNICODE            nsXPIDLString currProfile;            profileService->GetCurrentProfile(getter_Copies(currProfile));#else            nsXPIDLString currProfileUnicode;            profileService->GetCurrentProfile(getter_Copies(currProfileUnicode));            nsCAutoString currProfile; currProfile.AssignWithConversion(currProfileUnicode);#endif            // Now find and select it            INT currentProfileIndex = LB_ERR;            currentProfileIndex = SendMessage(hwndProfileList, LB_FINDSTRINGEXACT, -1, (LPARAM) currProfile.get());            if (currentProfileIndex != LB_ERR)            {                SendMessage(hwndProfileList, LB_SETCURSEL, currentProfileIndex, 0);            }        }		return TRUE;	case WM_COMMAND:		if (LOWORD(wParam) == IDOK)        {            HWND hwndProfileList = GetDlgItem(hDlg, IDC_PROFILELIST);            // Get the selected profile from the list box and make it current            INT currentProfileIndex = SendMessage(hwndProfileList, LB_GETCURSEL, 0, 0);            if (currentProfileIndex != LB_ERR)            {                NS_WITH_SERVICE(nsIProfile, profileService, NS_PROFILE_CONTRACTID, &rv);                // Convert TCHAR name to unicode and make it current                INT profileNameLen = SendMessage(hwndProfileList, LB_GETTEXTLEN, currentProfileIndex, 0);                TCHAR *profileName = new TCHAR[profileNameLen + 1];                SendMessage(hwndProfileList, LB_GETTEXT, currentProfileIndex, (LPARAM) profileName);                nsAutoString newProfile; newProfile.AssignWithConversion(profileName);                rv = profileService->SetCurrentProfile(newProfile.GetUnicode());            }        }        EndDialog(hDlg, LOWORD(wParam));        return TRUE;	}    return FALSE;}