⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customerservice.cpp

📁 windows mobile 中国移动定制程序
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		}
	}
		break;
        case WM_DESTROY:
            CommandBar_Destroy(g_hWndMenuBar);
			DestroyWindow(hWndListView);
            PostQuitMessage(0);
            break;

        case WM_ACTIVATE:
			 // 向外壳程序通知我们的激活消息
            SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
			if (WA_INACTIVE != LOWORD(wParam))
			{
				if (g_hwndBasicDialog != 0)
				{
					TCHAR szTitle[16];
					GetWindowText( hWnd,szTitle,16);
				  if (wcscmp(szTitle,L"我的梦网") == 0)
					{
						  BringWindowToTop(GetDlgItem(g_hwndBasicDialog,IDC_LISTMYDREAMWEB));
						  SetFocus(GetDlgItem(g_hwndBasicDialog,IDC_LISTMYDREAMWEB));
					  }
				  else
				  {
						 BringWindowToTop(GetDlgItem(g_hwndBasicDialog,IDC_LISTMOBILESECRETARY));
						  SetFocus(GetDlgItem(g_hwndBasicDialog,IDC_LISTMOBILESECRETARY));
				  }
				}
				else
				{
						BringWindowToTop(hWndListView);
					    SetFocus(hWndListView);
				}
			}
            break;
			
        case WM_SETTINGCHANGE:
            SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
			//if( SETTINGCHANGE_RESET == wParam)
   //         {
   //             //Move the parent window
   //             RECT rect;
   //             SystemParametersInfo(SPI_GETWORKAREA, NULL, &rect, FALSE);
   //             MoveWindow(hWnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, FALSE);

   //             //If the child window exists move it
   //             if(IsWindow(g_hwndBasicDialog))
   //             {

   //                 //Moving a child window so upper left is 0, 0
   //                 MoveWindow(g_hwndBasicDialog, 0, 0, rect.right - rect.left, rect.bottom - rect.top, FALSE);
   //             }
   //         }
            break;
		case WM_SIZE:
			MoveWindow(hWndListView, 0, 0, LOWORD(lParam),HIWORD(lParam),TRUE);
            break;
        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}

HWND CreateListView (HWND hWndParent)                                     
{
	HWND hWndList;      		// handle to list view window
	RECT rcl;           		// rectangle for setting size of window
	HBITMAP hBmp;       		// handle to an icon
	HIMAGELIST hImage;	// handles to image lists 
	int index;					// index used in for loops
	//TCHAR szText[MAX_PATH];		// place to store some text
	LVITEM lvI;				// list view item structure
	INITCOMMONCONTROLSEX icex;

	// Load the ListView common control class.
    icex.dwSize = sizeof (INITCOMMONCONTROLSEX);
    icex.dwICC = ICC_LISTVIEW_CLASSES;
    InitCommonControlsEx (&icex);
	
	// Get the size and position of the parent window.
	GetClientRect(hWndParent, &rcl);
	
	
hWndList=	CreateWindow(WC_LISTVIEW, NULL,
            WS_CHILD | WS_VISIBLE | LVS_SINGLESEL | LVS_AUTOARRANGE |LVS_ICON |LVS_NOCOLUMNHEADER  ,
            rcl.left, rcl.top, rcl.right - rcl.left, rcl.bottom - rcl.top - 20,
            hWndParent, (HMENU)ID_LISTVIEW, g_hInst,NULL);
	
	if (hWndList == NULL )
		return NULL;
	
	// Initialize the list view window.
	// First initialize the image lists you will need:
    // create image lists for the small and the large icons.
	
	hImage = ImageList_Create( BITMAP_WIDTH, BITMAP_HEIGHT,
		FALSE, 5, 0 );
	
	  // Load the icons and add them to the image lists.
	for (index = IDB_BITMAPCLUB; index <= IDB_BITMAPDREAMWEB ; index++) 
	{
	    hBmp = LoadBitmap(g_hInst, MAKEINTRESOURCE(index));
		ImageList_Add (hImage, hBmp, NULL); 
		DeleteObject (hBmp);
	}
	
	
	// Be sure that all the large icons were added.
	if ( ImageList_GetImageCount(hImage) < 5)
		return FALSE;
	
	ListView_SetImageList(hWndList, hImage, LVSIL_NORMAL);
	
	
	// Finally, add the actual items to the control.
	// Fill out the LV_ITEM structure for each of the items to add to the list.
	// The mask specifies the the pszText, iImage, lParam and state
	// members of the LV_ITEM structure are valid.
	lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
	TCHAR rgtsz[5][20] = { L"俱乐部服务",L"客户服务热线",L"客户经理",L"移动秘书",L"我的梦网"};
	for (index = 0; index <5; index++)
	{
		if (index == 0)
		{
				lvI.state =  LVIS_SELECTED | LVIS_FOCUSED;      
				lvI.stateMask =  LVIS_SELECTED | LVIS_FOCUSED; 
		}
		else
		{
				lvI.state = 0;      
				lvI.stateMask = 0; 
		}
		lvI.iItem = index;
		lvI.iSubItem = 0;
		// The parent window is responsible for storing the text. 
		// The list view control will send an LVN_GETDISPINFO 
		// when it needs the text to display.
		lvI.pszText = rgtsz[index]; 
		lvI.iImage = index;
		if (ListView_InsertItem(hWndList, &lvI) == -1)
			return NULL;		
	}
	  SetForegroundWindow((HWND)((ULONG) hWndParent | 0x00000001));
		BringWindowToTop(hWndList);
      SetFocus(hWndList);
	return (hWndList);
}
void InitListView(HWND hDlg,DWORD dwListViewID)
{
	HWND hWndList;      		// handle to list view window
	HBITMAP hBmp;       		// handle to an icon
	HIMAGELIST hImage;	// handles to image lists 
	int index;					// index used in for loops
	LVITEM lvI;				// list view item structure
	TCHAR rgtsz[3][20];

	hWndList = GetDlgItem(hDlg,dwListViewID);
	hImage = ImageList_Create( BITMAP_WIDTH, BITMAP_HEIGHT,
		FALSE, 3, 0 );
	if (dwListViewID == IDC_LISTMYDREAMWEB)
	{
			 // Load the icons and add them to the image lists.
			for (index = IDB_BITMAPMOBILEDREAM; index <= IDB_BITMAPMMS ; index++) 
			{
				hBmp = LoadBitmap(g_hInst, MAKEINTRESOURCE(index));
				ImageList_Add (hImage, hBmp, NULL); 
				DeleteObject (hBmp);
			}
			
			//// Be sure that all the large icons were added.
			if ( ImageList_GetImageCount(hImage) < 3)  
				return ;
			
			ListView_SetImageList(hWndList, hImage, LVSIL_NORMAL);
			lstrcpy(  rgtsz[0], L"移动梦网");
			lstrcpy(  rgtsz[1], L"梦网短信");
			lstrcpy(  rgtsz[2], L"梦网彩信");
	}
	else
	{
			 // Load the icons and add them to the image lists.
			for (index = IDB_BITMAPSMSTRANSFER; index <= IDB_BITMAPTRADEANDTOUR ; index++) 
			{
				hBmp = LoadBitmap(g_hInst, MAKEINTRESOURCE(index));
				ImageList_Add (hImage, hBmp, NULL); 
				DeleteObject (hBmp);
			}
			
			//// Be sure that all the large icons were added.
			if ( ImageList_GetImageCount(hImage) < 3)  
				return ;
			
			ListView_SetImageList(hWndList, hImage, LVSIL_NORMAL);
			lstrcpy(  rgtsz[0], L"呼转短信");
			lstrcpy(  rgtsz[1], L"代发短信");
			lstrcpy(  rgtsz[2], L"商旅服务");
	}
	lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
	for (index = 0; index <3; index++)
	{
		if (index == 0)
		{
				lvI.state =  LVIS_SELECTED | LVIS_FOCUSED;      
				lvI.stateMask =  LVIS_SELECTED | LVIS_FOCUSED; 
		}
		else
		{
				lvI.state = 0;      
				lvI.stateMask = 0; 
		}
		lvI.iItem = index;
		lvI.iSubItem = 0;
		// The parent window is responsible for storing the text. 
		// The list view control will send an LVN_GETDISPINFO 
		// when it needs the text to display.
		lvI.pszText = rgtsz[index]; 
		lvI.iImage = index;
		if (ListView_InsertItem(hWndList, &lvI) == -1)
			return ;
	  BringWindowToTop(hWndList);
      SetFocus(hWndList);
	}
}
void WriteTelephoneToRegister(TCHAR szTelephone[],TCHAR szType[], TCHAR szName[])
{

		HKEY	hKey;
		HRESULT	hRes;
		WCHAR szPath[MAX_LOADSTRING]={0};
		DWORD	dwDisp;
		StringCbPrintfW(szPath, sizeof(szPath), L"software\\Microsoft\\CustomerTelephone");
		//把输入的数字写入注册表中,进行保存
		hRes = RegCreateKeyEx (HKEY_CURRENT_USER, szPath, 0, NULL, 
                         0, 0, NULL, &hKey, &dwDisp);
			RegSetValueEx(hKey,szType,0,REG_SZ,(PBYTE)szTelephone,(lstrlen (szTelephone)+1) * sizeof (TCHAR));
			if (szName != NULL)
			{
				RegSetValueEx(hKey,L"Name",0,REG_SZ,(PBYTE)szName,(lstrlen (szName)+1) * sizeof (TCHAR));
			}
			RegCloseKey(hKey);
}

void WriteSetUpToRegister(TCHAR szType[],DWORD dwValue )
{

		HKEY	hKey;
		HRESULT	hRes;
		WCHAR szPath[MAX_LOADSTRING]={0};
		DWORD	dwDisp;
		StringCbPrintfW(szPath, sizeof(szPath), L"software\\Microsoft\\SMSTransferSetUp");
		//把输入的数字写入注册表中,进行保存
		hRes = RegCreateKeyEx (HKEY_CURRENT_USER, szPath, 0, NULL, 
                         0, 0, NULL, &hKey, &dwDisp);
			RegSetValueEx(hKey,szType,0,REG_DWORD,(PBYTE)&dwValue,sizeof (DWORD));
			RegCloseKey(hKey);
}

int  ReadSetUpForRegister(TCHAR szType[])
{

		HKEY	hKey;
		HRESULT	hRes;
		WCHAR szPath[MAX_LOADSTRING]={0};
		DWORD	dwDisp;
		DWORD	dwInSize = (DWORD)sizeof (DWORD);
		DWORD dwType = REG_DWORD;
		DWORD dwData = 0;
		StringCbPrintfW(szPath, sizeof(szPath), L"software\\Microsoft\\SMSTransferSetUp");
		//把输入的数字写入注册表中,进行保存
		hRes = RegCreateKeyEx (HKEY_CURRENT_USER, szPath, 0, NULL, 
                         0, 0, NULL, &hKey, &dwDisp);
		RegQueryValueEx( hKey, szType, NULL, &dwType, (LPBYTE)&dwData, (LPDWORD) &dwInSize ); 
			RegCloseKey(hKey);
			return dwData;
}


void ReadTelephoneForRegister(TCHAR szType[],TCHAR szOutName[],TCHAR szOutTelephone[])
{

		HKEY	hKey;
		HRESULT	hRes;
		WCHAR szPath[MAX_LOADSTRING]={0};
		TCHAR szName[30] = TEXT("\0");
		TCHAR szTelephone[30] = TEXT("\0");
		DWORD	dwDisp;
		DWORD	dwInSize = (DWORD)(30 * sizeof (TCHAR));
		DWORD dwType = REG_SZ;
		StringCbPrintfW(szPath, sizeof(szPath), L"software\\Microsoft\\CustomerTelephone");
		//把输入的数字写入注册表中,进行保存
		hRes = RegCreateKeyEx (HKEY_CURRENT_USER, szPath, 0, NULL, 
                         0, 0, NULL, &hKey, &dwDisp);
		RegQueryValueEx( hKey, szType, NULL, &dwType, (LPBYTE)szTelephone, (LPDWORD) &dwInSize ); 
		StringCbCopy(szOutTelephone,sizeof(szTelephone),szTelephone);
			if (wcscmp(szType,L"ManagerTelephone") == 0)
			{
				RegQueryValueEx( hKey, L"Name", NULL, &dwType, (LPBYTE)szName, (LPDWORD) &dwInSize ); 
				StringCbCopy(szOutName,sizeof(szName),szName);
			}
			RegCloseKey(hKey);
}


void InitDialog(HWND hDlg,DWORD IdrMenu,HWND * hMenu)
{
		 SHINITDLGINFO shidi;
        shidi.dwMask = SHIDIM_FLAGS;
        shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN ;
        shidi.hDlg = hDlg;
        SHInitDialog(&shidi);
		SHMENUBARINFO mbi;
		memset(&mbi, 0, sizeof(SHMENUBARINFO));
		mbi.cbSize     = sizeof(SHMENUBARINFO);
		mbi.hwndParent = hDlg;
		mbi.nToolBarId = IdrMenu;
		mbi.hInstRes   = g_hInst;
        if (!SHCreateMenuBar(&mbi)) 
            {
                * hMenu = NULL;
            }
            else
            {
                * hMenu = mbi.hwndMB;
            }
}
void InitModelessDialog(HWND hDlg,DWORD IdrMenu,HWND * hMenu)
{
		 SHINITDLGINFO shidi;
        shidi.dwMask = SHIDIM_FLAGS;
        shidi.dwFlags = SHIDIF_CANCELBUTTON | SHIDIF_SIPDOWN | SHIDIF_SIZEDLGFULLSCREEN ;
        shidi.hDlg = hDlg;
        SHInitDialog(&shidi);	
       RECT rect;
	   GetWindowRect(GetParent(hDlg),&rect);
        MoveWindow(hDlg, 0, 0, rect.right - rect.left, rect.bottom - rect.top, FALSE);
		  SHMENUBARINFO mbi;
		memset(&mbi, 0, sizeof(SHMENUBARINFO));
		mbi.cbSize     = sizeof(SHMENUBARINFO);
		mbi.hwndParent = hDlg;
		mbi.nToolBarId = IdrMenu;
		mbi.hInstRes   = g_hInst;
        if (!SHCreateMenuBar(&mbi)) 
            {
                 * hMenu  = NULL;
            }
            else
            {
                 * hMenu  = mbi.hwndMB;
            }
		BringWindowToTop(hDlg);
}
INT_PTR CALLBACK hClub(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HWND g_DialogMenuBar;
    switch (message)
    {
        case WM_INITDIALOG:
            {
				InitDialog( hDlg,IDR_CLUBMENU,&g_DialogMenuBar);
				SetWindowText(  GetParent(hDlg), L"俱乐部服务" ); 
            }
            return (INT_PTR)TRUE;

        case WM_COMMAND:
			 switch(LOWORD(wParam))
				{
				 case IDM_OK:
				   case IDOK:
					   SetWindowText(  GetParent(hDlg), L"客户服务" ); 
				    CommandBar_Destroy(g_DialogMenuBar);
					  EndDialog(hDlg, LOWORD(wParam));
						return TRUE;
				 case IDM_SELECT:
					CreateProcess(L"\\Windows\\iexplore.exe",TEXT("http://wap.monternet.com?gotone=club"),NULL, NULL, FALSE, 0, NULL, NULL, NULL, NULL);			
						return TRUE;
			 }
            break;

        case WM_CLOSE:
			 SetWindowText(  GetParent(hDlg), L"客户服务" ); 
			 CommandBar_Destroy(g_DialogMenuBar);
            EndDialog(hDlg, message);
            return TRUE;
#ifdef _DEVICE_RESOLUTION_AWARE
        case WM_SIZE:
            {
		DRA::RelayoutDialog(
			g_hInst, 
			hDlg, 
			DRA::GetDisplayMode() != DRA::Portrait ? MAKEINTRESOURCE(IDD_POCKETPC_LANDSCAPECLUB) : MAKEINTRESOURCE(IDD_POCKETPC_CLUB));
            }
            break;
#endif
    }
    return (INT_PTR)FALSE;
}


INT_PTR CALLBACK HotLine(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HWND g_DialogMenuBar;
    switch (message)
    {
        case WM_INITDIALOG:
            {
               InitDialog( hDlg,IDR_HOTLINEMENU,&g_DialogMenuBar);
				SendMessage (GetDlgItem(hDlg,IDC_EDITHOTLINE), EM_LIMITTEXT, 12, 0);
				 SetWindowText(  GetParent(hDlg), L"客户服务热线" ); 
            }
            return (INT_PTR)TRUE;

        case WM_COMMAND:
			 switch(LOWORD(wParam))
				{
				  case IDM_OK:
				   case IDOK:
					    SetWindowText(  GetParent(hDlg), L"客户服务" ); 
					    CommandBar_Destroy(g_DialogMenuBar);
					  EndDialog(hDlg, LOWORD(wParam));
						return TRUE;
				 case IDC_EDITHOTLINE:
					 if (HIWORD (wParam) == EN_SETFOCUS)
					 {
						 SHSipPreference(hDlg,SIP_UP);
					 }
				 	 if (HIWORD (wParam) == EN_KILLFOCUS)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -