• 로그인 함 해보끄나?

  • Sarangnamu.net June 17, 2003
    Home Login Profile Study Open Project Q&A Google Code
    today screen
    Last Modify : 13 December, 2010(11:55)
    1. dll project 로 구성한다. 2. commctrl.lib 를 추가한다. 3. #include <Todaycmn.h> 를 추가한다. 4. 시스템에서 호출되는 함수인 CustomItemOptionsDlgProc, InitializeCustomItem 에 내용을 구성한다. 5. 빌드 후 복사한다. 6. 레지스트리 키를 추가한다.
    [HKEY_LOCAL_MACHINE\Software\Microsoft\Today\Items\"MyToday"]
      "Type"=dword:4           ; 4 == Custom
      "Enabled"=dword:0    ; set by the "Settings/Today" applet  
      "Options"=dword:1        ; set to 0 if you do not want options
      "DLL"="\Windows\MyToday.DLL" ; path to the DLL
    
    7. 실행
    BOOL APIENTRY CustomItemOptionsDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
    {
        switch (message) 
        {
        case WM_INITDIALOG:
            return TRUE; 
    
        case WM_COMMAND:
            if (LOWORD(wParam) == IDOK)
            {
                EndDialog(hDlg, LOWORD(wParam));
                delete gCoreEngine;
                gArgs.clear();
    
                return TRUE;
            }
            break;
    
        default:
            return DefWindowProc(hDlg, message, wParam, lParam);
        }
    
        return 0;
    }
    
    
    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    HDC hdc;
    PAINTSTRUCT ps;
    
    	switch (message) 
    	{
    		case WM_TODAYCUSTOM_CLEARCACHE :
    			break;
    		case WM_TODAYCUSTOM_QUERYREFRESHCACHE:
    			break;
    		case WM_PAINT:
    			RECT rt;
    			hdc = BeginPaint(hWnd, &ps);
    			GetClientRect(hWnd, &rt);
    			SetBkMode(hdc,TRANSPARENT);
    			DrawText(hdc, TEXT("Pocket PC Rules!"), 16, &rt, 
    					 DT_SINGLELINE | DT_VCENTER | DT_CENTER);
    			EndPaint(hWnd, &ps);
    			break; 
    		case WM_LBUTTONUP:
    			break;
    		default:
    			return DefWindowProc(hWnd, message, wParam, lParam);
       }
       return 0;
    }
    
    HWND APIENTRY InitializeCustomItem(TODAYLISTITEM *ptli, HWND hParent)
    {
        WNDCLASS	wc;
        HWND		hWnd = NULL;
    
    	if (ptli->fEnabled==0) return NULL;
    	hInstance = ptli->hinstDLL;		// Store instance handle in our global variable
    
        wc.style			= CS_HREDRAW | CS_VREDRAW;
        wc.lpfnWndProc		= (WNDPROC) WndProc;
        wc.cbClsExtra		= 0;
        wc.cbWndExtra		= 0;
        wc.hInstance		= hInstance;
        wc.hIcon			= 0;
        wc.hCursor			= 0;
        wc.hbrBackground	= (HBRUSH) GetStockObject(LTGRAY_BRUSH);
        wc.lpszMenuName		= 0;
        wc.lpszClassName	= TEXT("MyToday");
    	RegisterClass(&wc);
    
    
        RECT rc;
        GetWindowRect(NULL, &rc);
    
        int nW = ::GetSystemMetrics(SM_CXSCREEN);
        int nH = ::GetSystemMetrics(SM_CYSCREEN) - ::GetSystemMetrics(SM_CYCAPTION) - ::GetSystemMetrics(SM_CYMENU);
        
    	hWnd = CreateWindow(TEXT("MyToday"), TEXT("MyTodayScreen"), WS_VISIBLE|WS_CHILD,
    		CW_USEDEFAULT, ::GetSystemMetrics(SM_CYMENU), nW, nH, hwndParent, NULL, hInstance, NULL);
    	return hWnd;
    }
    

    Comment


    입력하3 1502976474



    Locations of visitors to this page