[Herecast-commit] herecast/src/TodayItem whereami.cpp,1.6,1.7
Status: Beta
Brought to you by:
mdpaciga
|
From: Mark P. <mdp...@us...> - 2005-07-21 19:57:38
|
Update of /cvsroot/herecast/herecast/src/TodayItem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17441/src/TodayItem Modified Files: whereami.cpp Log Message: the today item now creates a hidden top-level window with class name "Herecast", just like the XP version. This also supports the new API, and will own the update timer (also like the XP version) Index: whereami.cpp =================================================================== RCS file: /cvsroot/herecast/herecast/src/TodayItem/whereami.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** whereami.cpp 24 Nov 2004 07:36:44 -0000 1.6 --- whereami.cpp 21 Jul 2005 19:52:43 -0000 1.7 *************** *** 33,39 **** --- 33,41 ---- #include "../HerecastLib/APDB/WebAgent.h" #include "../HerecastLib/Utils/WindowsUtils.h" + #include "../HerecastLib/LibMain/herecast.h" #define INVALID_HEIGHT 0xFFFFFFFF #define UPDATE_INTERVAL 5 // * 2 seconds? + #define UPDATE_INTERVAL_MS 10000 //applies to the new fake window //global variables *************** *** 41,44 **** --- 43,47 ---- UINT g_plugInHeight; HWND g_hWnd; + HWND g_hWndDummy; HINSTANCE g_hInst2; BOOL g_bFirstDisplay = TRUE; *************** *** 72,75 **** --- 75,79 ---- //initilize the application class, and set the global window handle UnregisterClass((LPCTSTR)LoadString(g_hInst2, IDS_TODAY_APPNAME,0,0), g_hInst2); + UnregisterClass(TEXT("Herecast"), g_hInst2); InitilizeClasses(); g_hWnd = 0; *************** *** 84,89 **** DestroyIcon(g_hIcon); ! UnregisterClass((LPCTSTR)LoadString(g_hInst2, IDS_TODAY_APPNAME,0,0), g_hInst2); g_hInst2 = NULL; break; --- 88,95 ---- DestroyIcon(g_hIcon); ! DestroyWindow(g_hWndDummy); ! UnregisterClass((LPCTSTR)LoadString(g_hInst2, IDS_TODAY_APPNAME,0,0), g_hInst2); + UnregisterClass(TEXT("Herecast"), g_hInst2); g_hInst2 = NULL; break; *************** *** 293,301 **** case WM_COMMAND: - if (LOWORD(wParam) == IDMSG_ADD_SUBSCRIPTION) { - SubscriptionAgent *pSA = SubscriptionAgent::instance(); - pSA->checkNew(g_hInst2, hwnd); - return TRUE; - } // ID 3 is used for WindowsUtils_Notification Dismiss button break; --- 299,302 ---- *************** *** 324,327 **** --- 325,386 ---- + LRESULT CALLBACK WndProc_dummy(HWND hWnd, UINT uimessage, WPARAM wParam, LPARAM lParam) + { + INT wmId, wmEvent; + //COPYDATASTRUCT *pCD; + + switch (uimessage) { + case WM_CREATE: + SetTimer(hWnd, ID_TIMER_UPDATE, UPDATE_INTERVAL_MS, NULL); + break; + + case WM_TIMER: + //TODO doScan(hWnd); + break; + + case WM_DESTROY: + KillTimer(hWnd, ID_TIMER_UPDATE); + break; + + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + switch (wmId) { + case IDMSG_ADD_SUBSCRIPTION: { + SubscriptionAgent *pSA = SubscriptionAgent::instance(); + pSA->checkNew(g_hInst2, hWnd); + return TRUE; + } + } + break; + + case WM_COPYDATA: + case HC_PARSE_URL: + case HC_GET_BSSID: + case HC_GET_LOCATION: + case HC_GET_FLOOR: + case HC_GET_FLOOR2: + case HC_GET_BUILDING: + case HC_GET_STREETADDR: + case HC_GET_AREA: + case HC_GET_CITY: + case HC_GET_PROVINCE: + case HC_GET_COUNTRY: + case HC_GET_NETWORK: + + case HC_GET_BUILDINGID: + case HC_GET_AREAID: + case HC_GET_CITYID: + case HC_GET_PROVINCEID: + case HC_GET_COUNTRYID: + case HC_GET_NETWORKID: + return g_Location->execAPIMsg(hWnd, uimessage, wParam, lParam); + + } + + return DefWindowProc(hWnd, uimessage, wParam, lParam) ; + } + + /*************************************************************************/ /* Create and register our window class for the today item */ *************** *** 341,349 **** wc.lpszClassName = TEXT("dlgHerecastTodayItemClass"); //register our window if(!RegisterClass(&wc)) { return 0 ; } ! return 1; } --- 400,417 ---- wc.lpszClassName = TEXT("dlgHerecastTodayItemClass"); + //register our today item window + if(!RegisterClass(&wc)) { + return 0 ; + } + + // create another class for the "public" window, similar to the above + wc.lpfnWndProc = (WNDPROC) WndProc_dummy; + wc.lpszClassName = TEXT("Herecast"); + //register our window if(!RegisterClass(&wc)) { return 0 ; } ! return 1; } *************** *** 367,370 **** --- 435,448 ---- ShowWindow (g_hWnd, SW_SHOWNORMAL); UpdateWindow (g_hWnd) ; + + + // create a second "dummy" window at the top level to receive messages + // from other applications + g_hWndDummy = CreateWindow(TEXT("Herecast"), TEXT("Herecast"), 0, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, g_hInst2, NULL); + + ShowWindow(g_hWndDummy, SW_HIDE); //this window is never actually shown + UpdateWindow(g_hWndDummy); + return g_hWnd; |