/**//********************************************************************** THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. Copyright (c) ppcat_001 Corporation. All Rights Reserved. This code is sample code and is included for illustrative purposes only. It may not have been designed by the core product team and has not been tested to the same standards as product code. MODULE: custphone.cpp ABSTRACT: Phone Canvas extension code to set skinning settings. **********************************************************************/ #include "custphone.h" #include "phcanvas.h" #include "PhoneResources.h" #include <windows.h> #include <imgdecmp.h> #include "miscsvcs.h" #include "winsock2.h" #define IPPHONE TEXT("IPPhone") #define DIALER_PORT 1 //拨号界面 HPHONELISTENER g_idlTapiState = INVALID_HPHONELISTENER; // Phone behavior overriding functions HRESULT PHExtInitialize(void*pVoid); HRESULT PHExtShowPhoneMsg(PH_MSG phmsg, LPWSTR psz1, LPWSTR psz2, BOOL fRemove, DWORD dwSupSvcStatus, BOOL * pfDial); HRESULT PHExtDoVerb(PH_VERB verb, BOOL fValidateOnly, VPARAM vp); HRESULT PHExtGetPhoneViewInfo(PH_VIEW view, HINSTANCE * phInstance, PH_VIEWINFOFLAGS * pvif, LPPHONEVIEWHOOKPROC * plpfnHook, LPCTSTR * plpTemplateName); BOOL PHExtplpfnHook(HWND, UINT, WPARAM, LPARAM);//主界面的 BOOL PHExtplpfnHookPro(HWND, UINT, WPARAM, LPARAM);//拨号界面的 BOOL PHExtplpfnHookIn(HWND, UINT, WPARAM, LPARAM);//拨号界面的 void Draw(HWND hWnd,DWORD IDC,BOOL Mark);//在指定的位置画图(窗口句柄,画的控件ID,背景是FALSE,按界面之后是TRUE) void Draw_Talk(HWND hWnd,BOOL Mark);//替换通话界面中的通话部分(换成结束) void Draw_In(HWND); void Draw_In_IDC(HWND,DWORD); void Draw_Button(HWND, RECT, RECT, HBITMAP); #define REG_SPEAKER L"ITF_SPEAKER"
//这个没有用扬声器的api,各位可能要改 BOOL setRegSPEAKER(DWORD Speaker);//sP 是当前扬声器是否已经打开] BOOL getRegSPEAKER(DWORD *Speaker);//sP 是当前扬声器是否已经打开 void Draw_Pro(HWND hWnd,DWORD dnum,BOOL Mark);//同上,但是num为画第几张图 void Draw_Pro_Talk(HWND hWnd,BOOL Mark); void Draw_Pro_Mute(HWND hWnd,DWORD Mark);//Mark = 1//菲静音亮,Mark = 2,菲静音暗,Mark = 3灰色不可点击 void Draw_Pro_SP(HWND hWnd,DWORD Mark); void Draw_Pro_Held(HWND hWnd,DWORD Mark); void GetRect(HWND hWnd); DWORD InRect(DWORD x_pos,DWORD y_pos); void GetRect_Pro(HWND hWnd); DWORD InRect_Pro(DWORD x_pos,DWORD y_pos); BOOL RECT_Mark = FALSE; RECT distRect[16] =...{0}; RECT WndPosRect[16] =...{0}; BOOL RECT_Mark_Pro = FALSE; RECT disRect_Pro[6] =...{0}; RECT WndPosRect_Pro[6] =...{0}; BOOL RECT_Mark_In = FALSE; RECT WndPosRect_In[11] =...{0}; RECT disRect_In[10] =...{0}; BOOL Mute = TRUE; HINSTANCE g_hInst = NULL; HWND g_hWnd; HBITMAP hBmp = NULL; HBITMAP hBmp_Inv = NULL; HBITMAP hBmp_Talk = NULL; HBITMAP hBmp_Inv_Talk = NULL; HBITMAP hBmp_Pro = NULL; HBITMAP hBmp_Inv_Pro = NULL; HBITMAP hBmp_Pro_Talk = NULL; HBITMAP hBmp_Inv_Pro_Talk = NULL; HBITMAP hBmp_Pro_Mute = NULL; HBITMAP hBmp_Inv_Pro_Mute = NULL; HBITMAP hBmp_Un_Pro_Mute = NULL; HBITMAP hBmp_Pro_SP = NULL; HBITMAP hBmp_Inv_Pro_SP = NULL; HBITMAP hBmp_Pro_His = NULL; HBITMAP hBmp_Inv_Pro_His = NULL; HBITMAP hBmp_Pro_Held = NULL; HBITMAP hBmp_Inv_Pro_Held = NULL; HBITMAP hBmp_Pro_Swap = NULL; HBITMAP hBmp_Inv_Pro_Swap = NULL; HBITMAP hBmp_Un_Pro_Held = NULL; HBITMAP hBmp_In = NULL; extern"C" BOOL WINAPI DllMain(HANDLE hinstDll, DWORD dwReason, LPVOID lpReserved) ...{ switch (dwReason) ...{ case DLL_PROCESS_ATTACH: g_hInst = (HINSTANCE)hinstDll; break; } return TRUE; } /**//********************************************************************* PHExtInitialize Purpose: Please see phcanvas.h for details Arguments: Please see phcanvas.h Returns: status **********************************************************************/ extern"C" HRESULT PHExtInitialize(void*pVoid) ...{ UNREFERENCED_PARAMETER(pVoid); return S_OK; } /**//********************************************************************* PHExtDoVerb Purpose: Please see phcanvas.h for details Arguments: Please see phcanvas.h Returns: status **********************************************************************/ extern"C" HRESULT PHExtDoVerb(PH_VERB verb, BOOL fValidateOnly, VPARAM vp) ...{ HRESULT hr = E_NOTIMPL; return hr; } DWORD CALLBACK GetImageData(LPSTR szBuffer, DWORD dwBufferMax, LPARAM lParam ) ...{ DWORD dwNumberOfBytesRead; if ( (HANDLE)lParam == INVALID_HANDLE_VALUE ) return0; ReadFile( (HANDLE)lParam, szBuffer, dwBufferMax, &dwNumberOfBytesRead, NULL ); // Return number of bytes read return dwNumberOfBytesRead; } void CALLBACK ImageProgress(IImageRender *pRender, BOOL bComplete, LPARAM lParam ) ...{ if( bComplete ) ...{ // (Optional) add code here for completion processing } } BOOL LoadImage(HBITMAP * lpBmp, LPCWSTR lpPath) ...{ HRESULT hr =0; DecompressImageInfo dii; BYTE szBuffer[4096] =...{0}; HDC hCompDC, hDevDC; HANDLE hFile; BOOL bRet = FALSE; hFile = CreateFile(lpPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); DWORD miao = GetLastError(); if (hFile == INVALID_HANDLE_VALUE) ...{ goto error; } hDevDC = ::GetDC(NULL); if(!hDevDC) goto error; hCompDC = CreateCompatibleDC(hDevDC); if(NULL == hCompDC) ...{ goto error; } // Fill in the 'DecompressImageInfo' structure dii.dwSize =sizeof( DecompressImageInfo ); // Size of this structure dii.pbBuffer = szBuffer; // Pointer to the buffer to use for data dii.dwBufferMax =sizeof(szBuffer); // Size of the buffer dii.dwBufferCurrent =0; // The amount of data which is current in the buffer dii.phBM = lpBmp; // Pointer to the bitmap returned (can be NULL) dii.ppImageRender = NULL; // Pointer to an IImageRender object (can be NULL) dii.iBitDepth = GetDeviceCaps(hDevDC,BITSPIXEL);// Bit depth of the output image dii.lParam = ( LPARAM ) hFile; // User parameter for callback functions dii.hdc = hCompDC; // HDC to use for retrieving palettes dii.iScale =100; // Scale factor (1 - 100) dii.iMaxWidth =10000;//nWidth; // Maximum width of the output image dii.iMaxHeight =10000;//nHeight; // Maxumum height of the output image dii.pfnGetData = GetImageData; // Callback function to get image data dii.pfnImageProgress = ImageProgress; // Callback function to notify caller of progress decoding the image dii.crTransparentOverride = ( UINT ) -1; // If this color is not (UINT)-1, it will override the // transparent color in the image with this color. (GIF ONLY) // Process and decompress the image data hr = DecompressImageIndirect( &dii ); if(FAILED(hr)) goto error; //m_gBGLoaded = TRUE; bRet = TRUE; goto error; error: // Clean up if(INVALID_HANDLE_VALUE != hFile) CloseHandle( hFile ); if(NULL != hCompDC) DeleteDC(hCompDC); if(NULL != hDevDC) ::ReleaseDC(NULL, hDevDC); return bRet; }
/**//********************************************************************* PHExtShowPhoneMsg Purpose: Please see phcanvas.h for details Arguments: Please see phcanvas.h Returns: status **********************************************************************/ extern"C" HRESULT PHExtShowPhoneMsg(PH_MSG phmsg, LPCWSTR psz1, LPCWSTR psz2, BOOL fRemove, DWORD dwSupSvcStatus, BOOL* pfDial) ...{ HRESULT hr = E_NOTIMPL; // To override behavior, return S_OK and insert code here. If you wish // to let default processing // still occur after having intercepted the message, return E_NOTIMPL. return hr; } void GetRect(HWND hWnd) ...{ DWORD BUTTON[16] =...{ IDC_DIALBUTTON_ZERO, IDC_DIALBUTTON_ONE, IDC_DIALBUTTON_TWO, IDC_DIALBUTTON_THREE, IDC_DIALBUTTON_FOUR, IDC_DIALBUTTON_FIVE, IDC_DIALBUTTON_SIX, IDC_DIALBUTTON_SEVEN, IDC_DIALBUTTON_EIGHT, IDC_DIALBUTTON_NINE, IDC_DIALBUTTON_STAR, IDC_DIALBUTTON_POUND, IDC_HISTORY, IDC_TALKEND, IDC_SPEED, IDC_ERASE_BUTTON, }; HWND hd = NULL; for(int i =0; i <=15; i++) ...{ hd = GetDlgItem(hWnd,BUTTON[i]); ::GetClientRect(hd,&distRect[i]); ::GetWindowRect(hd,&WndPosRect[i]); } RECT_Mark = TRUE; } //指出点在那个控件上,x_pos横坐标,y_pos纵坐标 DWORD InRect(DWORD x_pos,DWORD y_pos) ...{ POINT Point =...{x_pos,y_pos}; RECT Rect =...{0}; for(DWORD i =0; i <=15; i++) ...{ Rect.bottom = WndPosRect[i].bottom -26; Rect.top = WndPosRect[i].top -26; Rect.left = WndPosRect[i].left; Rect.right = WndPosRect[i].right; if(PtInRect(&Rect,Point)) ...{ return i; } } return100; } BOOL PHExtplpfnHook(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) ...{ HWND hd = NULL; BOOL breturn = FALSE; int x_pos; int y_pos; PHADDACCUMULATOR num =...{0}; HRESULT hr = S_OK; int Talk =0; int OutGo =0; int Held =0; int InCom =0; DWORD Acc =1; int Connect =0; DWORD dnum; SHRGINFO shrg; if(RECT_Mark == FALSE) ...{ GetRect(hWnd); } UINT vkKeyCode[12] =...{'0','1','2','3','4','5','6','7','8','9','*','#'}; switch(Msg) ...{ case WM_PH_PAINTCHILDBACKGROUND: ...{ switch(GetDlgCtrlID((HWND)wParam)) ...{ case IDC_DIALBUTTON_ONE: case IDC_DIALBUTTON_TWO: case IDC_DIALBUTTON_THREE: case IDC_DIALBUTTON_FOUR: case IDC_DIALBUTTON_FIVE: case IDC_DIALBUTTON_SIX: case IDC_DIALBUTTON_SEVEN: case IDC_DIALBUTTON_EIGHT: case IDC_DIALBUTTON_NINE: case IDC_DIALBUTTON_STAR: case IDC_DIALBUTTON_ZERO: case IDC_DIALBUTTON_POUND: case IDC_HISTORY: case IDC_ERASE_BUTTON: case IDC_SPEED: case IDC_TALKEND: hd = (HWND)wParam; ShowWindow(hd,FALSE); breturn = TRUE; break; case IDC_BRANDING: PHGetInt(PH_ID_OUTGOING,&Talk); PHGetInt(PH_ID_TALKING,&OutGo); PHGetInt(PH_ID_HELD,&Held); if((Talk >0)||(OutGo>0)) ...{ Draw_Talk(hWnd,TRUE); } elseif(Held >0) ...{ Draw_Talk(hWnd,TRUE); } break; case IDC_ACCUMULATOR: PHGetInt(PH_ID_HELD,&Held); PHGetDWORD(PH_ID_ACCUMULATOR_EMPTY, &Acc); if((Held >0)&&(Acc ==1)) ...{ Draw_Talk(hWnd,TRUE); } elseif((Held >0)&&(Acc ==0)) ...{ Draw(hWnd,BUTTON_TALKEND,FALSE); } break; case IDC_CALLSTATE: PHGetInt(PH_ID_OUTGOING,&OutGo); PHGetInt(PH_ID_TALKING,&Talk); PHGetInt(PH_ID_INCOMING,&InCom); if((OutGo ==0)&&(Talk ==0)&&(InCom ==0)) ...{ Draw(hWnd,BUTTON_TALKEND,FALSE); } break; } } break; case WM_LBUTTONDOWN: ...{ x_pos = (((DWORD)lParam)&0xFFFF); y_pos = (((DWORD)lParam) >>16); dnum = InRect(x_pos,y_pos); switch(dnum) ...{ case BUTTON_ZERO: case BUTTON_ONE: case BUTTON_TWO: case BUTTON_THREE: case BUTTON_FOUR: case BUTTON_FIVE: case BUTTON_SIX: case BUTTON_SEVEN: case BUTTON_EIGHT: case BUTTON_NINE: case BUTTON_STAR: case BUTTON_POUND: num.vkKeyCode = vkKeyCode[dnum]; num.ksKeyState = PH_KEYSTATE_DOWN; PHDoVerb(PH_VERB_ADD_ACCUMULATOR ,FALSE,(VPARAM)(&num)); Draw(hWnd,dnum,TRUE); breturn = TRUE; break; case BUTTON_HISTORY: hd = GetDlgItem(hWnd,IDC_HISTORY); SendMessage(hd,WM_LBUTTONDOWN,0,0); Draw(hWnd,dnum,TRUE); breturn = TRUE; break; case BUTTON_TALKEND: PHGetInt(PH_ID_TALKING,&Talk); PHGetInt(PH_ID_HELD,&Held); PHGetDWORD(PH_ID_ACCUMULATOR_EMPTY, &Acc); PHGetInt(PH_ID_OUTGOING,&OutGo); PHGetInt(PH_ID_CONNECTED,&Connect); if(OutGo >0) ...{ PHDoVerb(PH_VERB_END ,FALSE,0); Draw_Talk(hWnd,FALSE); } elseif((Held >0)&&(Held < Connect)) ...{ PHDoVerb(PH_VERB_END ,FALSE,0); Draw_Talk(hWnd,FALSE); } elseif((Held >0)&&(Held == Connect)&&(Acc ==1)) ...{ PHDoVerb(PH_VERB_END ,FALSE,0); Draw_Talk(hWnd,FALSE); } elseif((Held >0)&&(Held == Connect)&&(Acc ==0)) ...{ PHDoVerb(PH_VERB_TALK ,FALSE,0); Draw(hWnd,dnum,TRUE); } elseif((Held ==0)&&(Connect >0)) ...{ PHDoVerb(PH_VERB_END ,FALSE,0); Draw(hWnd,dnum,TRUE); } else ...{ PHDoVerb(PH_VERB_TALK ,FALSE,0); Draw(hWnd,dnum,TRUE); } breturn = TRUE; break; case BUTTON_SPEED: hd = GetDlgItem(hWnd,IDC_SPEED); SendMessage(hd,WM_LBUTTONDOWN,0,0); Draw(hWnd,dnum,TRUE); breturn = TRUE; break; case BUTTON_ERASE: Draw(hWnd,dnum,TRUE); shrg.cbSize =sizeof(shrg); shrg.hwndClient = hWnd; shrg.ptDown.x = LOWORD(lParam); shrg.ptDown.y = HIWORD(lParam); shrg.dwFlags = SHRG_RETURNCMD| SHRG_NOANIMATION; if (SHRecognizeGesture(&shrg) == GN_CONTEXTMENU) ...{ hr = PHDoVerb(PH_VERB_REMOVE_ACCUMULATOR ,FALSE,TRUE); } else ...{ hr = PHDoVerb(PH_VERB_REMOVE_ACCUMULATOR ,FALSE,FALSE); } breturn = TRUE; break; default: break; } } break; case WM_LBUTTONUP: ...{ x_pos = (((DWORD)lParam)&0xFFFF); y_pos = (((DWORD)lParam) >>16); dnum = InRect(x_pos,y_pos); switch(dnum) ...{ case BUTTON_ZERO: case BUTTON_ONE: case BUTTON_TWO: case BUTTON_THREE: case BUTTON_FOUR: case BUTTON_FIVE: case BUTTON_SIX: case BUTTON_SEVEN: case BUTTON_EIGHT: case BUTTON_NINE: case BUTTON_STAR: case BUTTON_POUND: case BUTTON_HISTORY: case BUTTON_SPEED: case BUTTON_ERASE: Draw(hWnd,dnum,FALSE); breturn = TRUE; break; case BUTTON_TALKEND: PHGetInt(PH_ID_TALKING,&OutGo); PHGetInt(PH_ID_HELD,&Held); PHGetDWORD(PH_ID_ACCUMULATOR_EMPTY, &Acc); PHGetInt(PH_ID_OUTGOING,&Talk); PHGetInt(PH_ID_CONNECTED,&Connect); if(Held >0) ...{ Draw_Talk(hWnd,TRUE); } else ...{ Draw(hWnd,dnum,FALSE); } breturn = TRUE; break; default: break; } } break; default: break; } return breturn; }
/**//**********************************************************************THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OFANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT L
moonsunearth 发表于2007年12月17日 19:53:37 IP: 举报 回复 删除-
-
你好,能把对应的inf和图片定义,source和makefile发给我看看吗,谢谢!我的邮件moon197907@hotmail.com
zzq_gates 发表于2008年5月13日 11:20:07 IP: 举报 回复 删除-
-
能否给我一份,我在做拦截来电需要参考下,你也是做防火墙的吧,我们交流一下,我的邮箱,zzq_168_168@163.com
Topfortune 发表于2009年8月17日 11:05:48 IP: 举报 回复 删除-
-
您好!能否也给我一份。我目前也在做类似的功能。谢谢!我的邮箱: wojunjun@gmail.com
beautymind2008 发表于2009年8月17日 17:33:11 IP: 举报 回复 删除-
-
LZ也给我一份吧 谢谢 love_lah@163.com
yul_20001 发表于2009年8月25日 14:44:09 IP: 举报 回复 删除-
-
您好!能否也给我一份。我目前正开发一个双卡双待的项目,遇到一些问题,希望参考一下。谢谢!我的邮箱: yul_20001@sina.com
cqjkwqj 发表于2009年12月17日 23:39:19 IP: 举报 回复 删除-
-
您好!找不到相应的头文件,能否帮忙把所需要的这些相对应的头文件及库文件发给我一下吗?谢谢cq110@cqwztech.com
stanleylou 发表于2009年12月24日 09:36:19 IP: 举报 回复 删除-
-
windows mobile 6 下如果要定制自己的拨号界面,该怎么办?上述方法可以套用么? 如果可以的话,能否给发一份头文件和库。 非常感谢
匿名用户 发表于2010年3月16日 16:58:34 IP: 举报 回复 删除-
-
同求代码一份,谢谢
yuanfen668888@163.com