📄 hwndfunctions.cpp
字号:
/*
* Copyright (C) 2003-2007 Funambol, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*/
#include "HwndFunctions.h"
#include "tchar.h"
#include "localizationUtils.h"
#ifdef WIN32_PLATFORM_WFSP
#include "funresourcesp.h"
#endif
#ifdef WIN32_PLATFORM_PSPC
#include "funresourceppc.h"
#endif
/**
* Find the funambol alert.
*/
void findAlert(){
HwndFunctions::wndMsgBox = FindWindow(NULL , getLocalizationUtils()->getLocalizationString(IDS_FUNAMBOL_ALERT));
}
/**
* Finds the funambol alert windows and closes it.
*/
void HwndFunctions::closePreviousMsgBox(){
HANDLE handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)findAlert, NULL, 0, NULL);
DWORD t = WaitForSingleObject(handle, 500);
if(wndMsgBox){
SendMessage(wndMsgBox, WM_CLOSE, NULL, NULL);
}
wndMsgBox = NULL;
}
/**
* Find the funambol plugin window. The call is blocking.
*/
static void findFunambolWindowLocking()
{
//-- for finding if the UI window is present
HwndFunctions::wnd = FindWindow(NULL, getLocalizationUtils()->getLocalizationString(IDS_FUNAMBOL));
}
/**
* Find the funambol plugin window, with a 2 seconds timeout.
*/
void HwndFunctions::findFunambolWindow()
{
HANDLE hand = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)findFunambolWindowLocking, NULL, 0, NULL);
DWORD t = WaitForSingleObject(hand, 2000); // 2 secs.
}
/**
* Get the Funambol plugin window handle if present.
*/
HWND HwndFunctions::getWindowHandle() {
if (wnd == NULL)
findFunambolWindow();
return wnd;
}
/*
void HwndFunctions::initHwnd() {
if (wnd == NULL)
findFunambolWindow();
}
*/
HWND HwndFunctions::wnd = NULL;
HWND HwndFunctions::wndMsgBox = NULL;
int sourceNameToId( const char* sourceName ){
int source = -1;
if(!strcmp(sourceName, "contact"))
source = SOURCE_CONTACTS;
if(!strcmp(sourceName, "calendar"))
source = SOURCE_CALENDAR;
if(!strcmp(sourceName, "task"))
source = SOURCE_TASKS;
if(!strcmp(sourceName, "briefcase"))
source = SOURCE_BRIEFCASE;
if(!strcmp(sourceName, "note"))
source = SOURCE_NOTES;
if(!strcmp(sourceName, "mail"))
source = SOURCE_MAIL;
return source;
}
// TODO: implement it
const char* sourceIdToName( const char* sourceName ){
return NULL;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -