本文整理汇总了C++中GetWindowLongPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowLongPtr函数的具体用法?C++ GetWindowLongPtr怎么用?C++ GetWindowLongPtr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetWindowLongPtr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
LRESULT COverlappedWindow::windowProc(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)
{
switch( message ) {
case WM_NCCREATE:
{
CREATESTRUCT* pCreate = reinterpret_cast<CREATESTRUCT*>(lParam);
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(pCreate->lpCreateParams);
SetWindowLongPtr(handle, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(windowPtr));
windowPtr->OnNCCreate(handle);
return true;
}
case WM_CREATE:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->OnCreate();
break;
}
case WM_SIZE:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->OnSize();
break;
}
case WM_CTLCOLOREDIT:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
HDC hdc = reinterpret_cast<HDC>(wParam);
return windowPtr->OnControlColorEdit(hdc);
}
case WM_COMMAND:
{
if( HIWORD(wParam) == EN_CHANGE ) {
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->OnTextChange();
break;
}
switch( LOWORD(wParam) ) {
case ID_FILE_SAVE:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->saveFile();
break;
}
case ID_FILE_EXIT:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->OnClose();
break;
}
case ID_VIEW_SETTINGS:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->showSettings();
break;
}
case ID_KILL:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->OnDestroy();
break;
}
}
break;
}
case WM_CLOSE:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->OnClose();
break;
}
case WM_DESTROY:
{
COverlappedWindow* windowPtr = reinterpret_cast<COverlappedWindow*>(GetWindowLongPtr(handle, GWLP_USERDATA));
windowPtr->OnDestroy();
break;
}
default:
return DefWindowProc(handle, message, wParam, lParam);
}
return false;
}
开发者ID:nikitarykov,项目名称:winapi-abbyy,代码行数:81,代码来源:OverlappedWindow.cpp
示例2: return
IVDVideoWindow *VDGetIVideoWindow(HWND hwnd) {
return (IVDVideoWindow *)(VDVideoWindow *)GetWindowLongPtr(hwnd, 0);
}
开发者ID:fishman,项目名称:virtualdub,代码行数:3,代码来源:VideoWindow.cpp
示例3: LocalEditProc
//.........这里部分代码省略.........
pvtext = &pVib->pvtext[pVib->vibIndex];
pInfo->pFormat = pvtext->pszFormat;
pInfo->pBuffer = FTGetPanelString( pvitLocal, pVib, pInfo->CtrlId);
if ( pInfo->CtrlId == ID_PANE_RIGHT) {
pInfo->ReadOnly = FALSE;
pInfo->NewText = FTGetPanelStatus( pVib, pInfo->CtrlId);
} else {
pInfo->ReadOnly = TRUE;
pInfo->NewText = FALSE;
}
return TRUE;
case WU_SETWATCH:
if ( pvitLocal == NULL) {
return(FALSE);
}
if ( p->nCtrlId == ID_PANE_RIGHT) {
BOOL retval;
fUseFrameContext = TRUE;
retval = (AcceptValueUpdate( pvitLocal, p));
if (retval == TRUE) {
UpdateDebuggerState(UPDATE_DATAWINS);
}
fUseFrameContext = FALSE;
return retval;
}
break;
case WU_INVALIDATE:
if (p == (PPANE)NULL) {
p = (PPANE)GetWindowLongPtr(GetLocalHWND(), GWW_EDIT);
}
SendMessage(p->hWndLeft, LB_SETCOUNT, 0, 0);
SendMessage(p->hWndButton, LB_SETCOUNT, 0, 0);
SendMessage(p->hWndRight, LB_SETCOUNT, 0, 0);
p->MaxIdx = 0;
PostMessage(hwnd, WU_UPDATE, 0, 0L);
InvalidateRect(p->hWndButton, NULL, TRUE);
InvalidateRect(p->hWndLeft, NULL, TRUE);
InvalidateRect(p->hWndRight, NULL, TRUE);
UpdateWindow (p->hWndButton);
UpdateWindow (p->hWndLeft);
UpdateWindow (p->hWndRight);
break;
case WU_EXPANDWATCH:
if ( pvitLocal == NULL) {
return(FALSE);
}
if ( FTExpand(pvitLocal, (ULONG)(wParam)) != OK) {
return(FALSE);
}
p->LeftOk = p->RightOk = FALSE;
pCxf = &pvitLocal->cxf; // Update in vit context
//
// fall thru...
//
case WU_UPDATE:
开发者ID:maerson,项目名称:windbg,代码行数:66,代码来源:localwin.cpp
示例4: WindowProc
LONG WINAPI WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
poWindow *win = (poWindow*)GetWindowLongPtr(hwnd, GWL_USERDATA);
switch(uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_SIZE:
window_width = LOWORD(lParam);
window_height = HIWORD(lParam);
if(win) win->resized(0,0,window_width,window_height);
break;
case WM_RBUTTONDOWN:
::SetCapture(hwnd);
isDragging = true;
if(win) win->mouseDown(LOSHORT(lParam), HISHORT(lParam), 0);
break;
case WM_RBUTTONUP:
::ReleaseCapture();
isDragging = false;
if(win) win->mouseUp(LOSHORT(lParam), HISHORT(lParam), 0);
break;
case WM_LBUTTONDOWN:
::SetCapture(hwnd);
isDragging = true;
if(win) win->mouseDown(LOSHORT(lParam), HISHORT(lParam), 0);
break;
case WM_LBUTTONUP:
::ReleaseCapture();
isDragging = false;
if(win) win->mouseUp(LOSHORT(lParam), HISHORT(lParam), 0);
break;
case WM_MBUTTONDOWN:
::SetCapture(hwnd);
isDragging = true;
if(win) win->mouseDown(LOSHORT(lParam), HISHORT(lParam), 0);
break;
case WM_MBUTTONUP:
::ReleaseCapture();
isDragging = false;
if(win) win->mouseUp(LOSHORT(lParam), HISHORT(lParam), 0);
break;
case WM_MOUSEMOVE:
if( isDragging )
if(win) win->mouseDrag(LOSHORT(lParam), HISHORT(lParam), 0);
else
if(win) win->mouseMove(LOSHORT(lParam), HISHORT(lParam), 0);
break;
case WM_MOUSEWHEEL:
break;
case WM_SYSKEYDOWN:
{
// alt-f4 ... pass to close the window
bool alt_down = (GetKeyState(VK_LMENU) & 0x80) || (GetKeyState(VK_RMENU) & 0x80) || (GetKeyState(VK_MENU) & 0x80);
if(VK_F4 == wParam && alt_down) {
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
}
}
case WM_KEYDOWN:
if(VK_F1 == wParam)
doFullscreen(hwnd, !is_fullscreen);
else
if(win) win->keyDown(mapVirtualKey(wParam), wParam, getKeyModifiers());
break;
case WM_SYSKEYUP:
case WM_KEYUP:
if(win) win->keyUp(mapVirtualKey(wParam), wParam, getKeyModifiers());
break;
case WM_KILLFOCUS:
// if we lose capture during a drag, post a mouse up event as a notifier
if( isDragging ) {
if(win) win->mouseDrag(LOSHORT(lParam), HISHORT(lParam), 0);
}
isDragging = false;
break;
case WM_ACTIVATE:
// make sure our fullscreen window plays nice with the task switcher
if(is_fullscreen) {
// if we're loosing focus, minimize to system tray
bool is_deactivated = WA_INACTIVE == LOWORD(wParam);
if(is_deactivated)
ShowWindow(hwnd,SW_SHOWMINIMIZED);
else
// sw_showmaximized flashes the title bar
// sw_show flashes the system tray, go figure
ShowWindow(hwnd,SW_SHOWMAXIMIZED);
}
break;
//.........这里部分代码省略.........
开发者ID:Potion,项目名称:pocode,代码行数:101,代码来源:main.cpp
示例5: DatePageProc
/* Property page dialog callback */
INT_PTR CALLBACK
DatePageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
PGLOBALDATA pGlobalData;
pGlobalData = (PGLOBALDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg)
{
case WM_INITDIALOG:
pGlobalData = (PGLOBALDATA)((LPPROPSHEETPAGE)lParam)->lParam;
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGlobalData);
InitMinMaxDateSpin(hwndDlg, pGlobalData->lcid);
UpdateDateLocaleSamples(hwndDlg, pGlobalData->lcid);
InitShortDateCB(hwndDlg, pGlobalData->lcid);
InitLongDateCB(hwndDlg, pGlobalData->lcid);
InitShortDateSepSamples(hwndDlg, pGlobalData->lcid);
/* TODO: Add other calendar types */
break;
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_SECONDYEAR_EDIT:
{
if(HIWORD(wParam)==EN_CHANGE)
{
SetMinData(hwndDlg);
}
}
case IDC_SCR_MAX_YEAR:
{
/* Set "Apply" button enabled */
/* FIXME */
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
case IDC_CALTYPE_COMBO:
case IDC_HIJCHRON_COMBO:
case IDC_SHRTDATEFMT_COMBO:
case IDC_SHRTDATESEP_COMBO:
case IDC_LONGDATEFMT_COMBO:
{
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE)
{
/* Set "Apply" button enabled */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
}
break;
}
}
break;
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR)lParam;
/* If push apply button */
if (lpnm->code == (UINT)PSN_APPLY)
{
SetMaxDate(hwndDlg, pGlobalData->lcid);
if(!SetShortDateSep(hwndDlg, pGlobalData->lcid)) break;
if(!SetShortDateFormat(hwndDlg, pGlobalData->lcid)) break;
if(!SetLongDateFormat(hwndDlg, pGlobalData->lcid)) break;
InitShortDateCB(hwndDlg, pGlobalData->lcid);
/* FIXME: */
//Sleep(15);
UpdateDateLocaleSamples(hwndDlg, pGlobalData->lcid);
}
}
break;
}
return FALSE;
}
开发者ID:RareHare,项目名称:reactos,代码行数:80,代码来源:date.c
示例6: DlgProcColorToolWindow
INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static COLORCHOOSER* pCC = NULL;
static int iCurrentHotTrack;
static BOOL bChoosing;
static int iRows;
static int iColumns;
static HWND hPreviousActiveWindow;
switch(msg) {
case WM_INITDIALOG:
{
RECT rc;
int iSquareRoot;
int width ;
int height;
TranslateDialogDefault(hwndDlg);
pCC = (COLORCHOOSER*) lParam;
iCurrentHotTrack = -2;
bChoosing = FALSE;
iSquareRoot = (int)sqrt(pCC->pModule->nColorCount);
iColumns = iSquareRoot * iSquareRoot == pCC->pModule->nColorCount?iSquareRoot:iSquareRoot+1;
iRows = iSquareRoot;
rc.top = rc.left = 100;
rc.right = 100 + iColumns * 25 + 1;
rc.bottom = iRows * 20 + 100 + 20;
AdjustWindowRectEx(&rc, GetWindowLongPtr(hwndDlg, GWL_STYLE), FALSE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE));
width = rc.right - rc.left;
height = rc.bottom - rc.top;
pCC->yPosition -= height;
SetDlgItemText(hwndDlg, IDC_COLORTEXT, pCC->bForeground?TranslateT("Text colour"):TranslateT("Background colour"));
SetWindowPos(GetDlgItem(hwndDlg, IDC_COLORTEXT), NULL, 0, 0, width, 20, 0);
SetWindowPos(hwndDlg, NULL, pCC->xPosition, pCC->yPosition, width, height, SWP_SHOWWINDOW);
}
break;
case WM_CTLCOLOREDIT:
case WM_CTLCOLORSTATIC:
if (( HWND )lParam == GetDlgItem( hwndDlg, IDC_COLORTEXT )) {
SetTextColor((HDC)wParam,RGB(60,60,150));
SetBkColor((HDC)wParam,GetSysColor(COLOR_WINDOW));
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
}
break;
case WM_COMMAND:
switch ( LOWORD( wParam )) {
case IDOK:
if (iCurrentHotTrack >= 0)
PostMessage(hwndDlg, WM_LBUTTONUP, 0, 0);
break;
case IDCANCEL:
DestroyWindow(hwndDlg);
break;
}
break;
case WM_LBUTTONUP:
if (iCurrentHotTrack >= 0 && iCurrentHotTrack < pCC->pModule->nColorCount && pCC->hWndTarget != NULL) {
HWND hWindow;
CHARFORMAT2 cf;
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = 0;
cf.dwEffects = 0;
hWindow = GetParent( pCC->hWndTarget );
if ( pCC->bForeground ) {
pCC->si->bFGSet = TRUE;
pCC->si->iFG = iCurrentHotTrack;
if ( IsDlgButtonChecked( hWindow, IDC_COLOR )) {
cf.dwMask = CFM_COLOR;
cf.crTextColor = pCC->pModule->crColors[iCurrentHotTrack];
SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
else {
pCC->si->bBGSet = TRUE;
pCC->si->iBG = iCurrentHotTrack;
if ( IsDlgButtonChecked( hWindow, IDC_BKGCOLOR )) {
cf.dwMask = CFM_BACKCOLOR;
cf.crBackColor = pCC->pModule->crColors[iCurrentHotTrack];
SendMessage(pCC->hWndTarget, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
}
PostMessage(hwndDlg, WM_CLOSE, 0, 0);
break;
case WM_ACTIVATE:
if (wParam == WA_INACTIVE)
//.........这里部分代码省略.........
开发者ID:raoergsls,项目名称:miranda,代码行数:101,代码来源:colorchooser.c
示例7: FBOptionsMessagingProc
INT_PTR CALLBACK FBOptionsMessagingProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
FacebookProto *proto = reinterpret_cast<FacebookProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
switch (message)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<FacebookProto*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
LoadDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS);
LoadDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD, DEFAULT_KEEP_UNREAD);
LoadDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN, DEFAULT_MESSAGES_ON_OPEN);
LoadDBCheckState(proto, hwnd, IDC_LOGIN_SYNC, FACEBOOK_KEY_LOGIN_SYNC, DEFAULT_LOGIN_SYNC);
LoadDBCheckState(proto, hwnd, IDC_ENABLE_CHATS, FACEBOOK_KEY_ENABLE_CHATS, DEFAULT_ENABLE_CHATS);
LoadDBCheckState(proto, hwnd, IDC_HIDE_CHATS, FACEBOOK_KEY_HIDE_CHATS, DEFAULT_HIDE_CHATS);
int count = proto->getByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, 10);
count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT);
SetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, count, TRUE);
SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT, EM_LIMITTEXT, 2, 0);
SendDlgItemMessage(hwnd, IDC_MESSAGES_COUNT_SPIN, UDM_SETRANGE32, 1, 99);
} return TRUE;
case WM_COMMAND:
switch (LOWORD(wparam))
{
case IDC_MESSAGES_COUNT:
if (HIWORD(wparam) == EN_CHANGE && (HWND)lparam == GetFocus())
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
default:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
return TRUE;
case WM_NOTIFY:
{
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS);
StoreDBCheckState(proto, hwnd, IDC_KEEP_UNREAD, FACEBOOK_KEY_KEEP_UNREAD);
StoreDBCheckState(proto, hwnd, IDC_LOGIN_SYNC, FACEBOOK_KEY_LOGIN_SYNC);
StoreDBCheckState(proto, hwnd, IDC_MESSAGES_ON_OPEN, FACEBOOK_KEY_MESSAGES_ON_OPEN);
StoreDBCheckState(proto, hwnd, IDC_ENABLE_CHATS, FACEBOOK_KEY_ENABLE_CHATS);
StoreDBCheckState(proto, hwnd, IDC_HIDE_CHATS, FACEBOOK_KEY_HIDE_CHATS);
int count = GetDlgItemInt(hwnd, IDC_MESSAGES_COUNT, NULL, TRUE);
count = min(count, FACEBOOK_MESSAGES_ON_OPEN_LIMIT);
proto->setByte(FACEBOOK_KEY_MESSAGES_ON_OPEN_COUNT, count);
}
} return TRUE;
}
return FALSE;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:65,代码来源:dialogs.cpp
示例8: HookWindow
//===========================================================================
int HookWindow (HWND hwnd, int early)
{
LONG_PTR lStyle = GetWindowLongPtr(hwnd, GWL_STYLE);
// if it does not have a caption, there is nothing to skin.
if (WS_CAPTION != (lStyle & WS_CAPTION))
{
//send_log(hwnd, "no caption");
return 0;
}
LONG_PTR lExStyle = GetWindowLongPtr(hwnd, GWL_EXSTYLE);
// child windows are excluded unless they have a sysmenu or are MDI clients
if ((lStyle & WS_CHILD)
&& false == (lStyle & WS_SYSMENU)
&& false == (WS_EX_MDICHILD & lExStyle)
)
{
//send_log(hwnd, "child, no sysmenu, not a MDI");
return 0;
}
// if it is already hooked, dont fall into loop
if (get_WinInfo(hwnd))
{
//send_log(hwnd, "already hooked");
return 0;
}
// being skeptical about windows without sysmenu
if (false == (lStyle & WS_SYSMENU) && false == (lStyle & WS_VISIBLE))
{
//if (0 == early) send_log(hwnd, "invisible without sysmenu");
return early;
}
// check for something like a vertical titlebar, erm...
if (lExStyle & WS_EX_TOOLWINDOW)
{
RECT rc; GetWindowRect(hwnd, &rc);
ScreenToClient(hwnd, (LPPOINT)&rc.left);
if (rc.top > -10)
{
//if (0 == early) send_log(hwnd, "abnormal caption");
return early;
}
}
// ------------------------------------------------------
// now check the exclusion list
int found = 0;
struct shmem sh;
SkinStruct *pSkin = (SkinStruct *)GetSharedMem(&sh);
if (NULL == pSkin)
return 0;
copy_skin(pSkin);
char sClassName[200]; sClassName[0] = 0;
GetClassName(hwnd, sClassName, sizeof sClassName);
char sFileName[200]; sFileName[0] = 0;
get_module(hwnd, sFileName, sizeof sFileName);
struct exclusion_item *ei = pSkin->exInfo.ei;
for (int i = pSkin->exInfo.count; i; --i)
{
char *f, *c = (f = ei->buff) + ei->flen;
// if filename matches and if class matches or is empty...
bool r = match(sFileName, f) && (0 == *c || match(sClassName, c));
//dbg_printf("check [%d,%d] %s:%s", r, ei->option, f, c);
if (r)
{
found = 1 == ei->option ? -1 : 1; // check 'hook-early' option
break;
}
ei = (struct exclusion_item *)(c + ei->clen);
}
ReleaseSharedMem(&sh);
// ------------------------------------------------------
if (early && 0 == found)
{
//send_log(hwnd, "Checking later:");
return 1;
}
// send message to log_window
if (mSkin.enableLog)
{
char msg[100];
sprintf_s(msg, 100, "%s%s",
found > 0 ? "Excluded" : early ? "Hooked early" : "Hooked",
IsWindowVisible(hwnd) ? "" : " invisible");
send_log(hwnd, msg);
//.........这里部分代码省略.........
开发者ID:ejasiunas,项目名称:bbclean-xzero450,代码行数:101,代码来源:hookctl.cpp
示例9: FBAccountProc
INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
FacebookProto *proto = reinterpret_cast<FacebookProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
switch (message)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<FacebookProto*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
ptrA login(db_get_sa(NULL, proto->ModuleName(), FACEBOOK_KEY_LOGIN));
if (login != NULL)
SetDlgItemTextA(hwnd, IDC_UN, login);
ptrA password(db_get_sa(NULL, proto->ModuleName(), FACEBOOK_KEY_PASS));
if (password != NULL)
SetDlgItemTextA(hwnd, IDC_PW, password);
if (!proto->isOffline())
{
SendDlgItemMessage(hwnd, IDC_UN, EM_SETREADONLY, 1, 0);
SendDlgItemMessage(hwnd, IDC_PW, EM_SETREADONLY, 1, 0);
}
return TRUE;
}
case WM_COMMAND:
if (LOWORD(wparam) == IDC_NEWACCOUNTLINK)
{
proto->OpenUrl(std::string(FACEBOOK_URL_HOMEPAGE));
return TRUE;
}
if (HIWORD(wparam) == EN_CHANGE && reinterpret_cast<HWND>(lparam) == GetFocus())
{
switch (LOWORD(wparam))
{
case IDC_UN:
case IDC_PW:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
}
break;
case WM_NOTIFY:
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
char str[128];
GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str));
db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str);
GetDlgItemTextA(hwnd, IDC_PW, str, _countof(str));
db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_PASS, str);
return TRUE;
}
break;
}
return FALSE;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:65,代码来源:dialogs.cpp
示例10: FBOptionsEventsProc
INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
FacebookProto *proto = reinterpret_cast<FacebookProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
switch (message)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<FacebookProto*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
for (size_t i = 0; i < _countof(feed_types); i++)
SendDlgItemMessageA(hwnd, IDC_FEED_TYPE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(feed_types[i].name)));
SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_FEED_TYPE, 0), 0);
for (size_t i = 0; i < _countof(server_types); i++)
SendDlgItemMessageA(hwnd, IDC_URL_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(server_types[i].name)));
SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_SERVER_TYPE, 0), 0);
LoadDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY);
LoadDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_CHATROOM, FACEBOOK_KEY_NOTIFICATIONS_CHATROOM, DEFAULT_NOTIFICATIONS_CHATROOM);
LoadDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_ENABLE, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_FEEDS_ENABLE, FACEBOOK_KEY_EVENT_FEEDS_ENABLE, DEFAULT_EVENT_FEEDS_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_FRIENDSHIP_ENABLE, FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE, DEFAULT_EVENT_FRIENDSHIP_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_TICKER_ENABLE, FACEBOOK_KEY_EVENT_TICKER_ENABLE, DEFAULT_EVENT_TICKER_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_ON_THIS_DAY_ENABLE, FACEBOOK_KEY_EVENT_ON_THIS_DAY_ENABLE, DEFAULT_EVENT_ON_THIS_DAY_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_FILTER_ADS, FACEBOOK_KEY_FILTER_ADS, DEFAULT_FILTER_ADS);
} return TRUE;
case WM_COMMAND:
switch (LOWORD(wparam))
{
case IDC_FEED_TYPE:
case IDC_URL_SERVER:
if (HIWORD(wparam) == CBN_SELCHANGE)
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
default:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
return TRUE;
case WM_NOTIFY:
{
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
proto->setByte(FACEBOOK_KEY_FEED_TYPE, SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_GETCURSEL, 0, 0));
proto->setByte(FACEBOOK_KEY_SERVER_TYPE, SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_GETCURSEL, 0, 0));
StoreDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_CHATROOM, FACEBOOK_KEY_NOTIFICATIONS_CHATROOM);
StoreDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_ENABLE, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE);
StoreDBCheckState(proto, hwnd, IDC_FEEDS_ENABLE, FACEBOOK_KEY_EVENT_FEEDS_ENABLE);
StoreDBCheckState(proto, hwnd, IDC_FRIENDSHIP_ENABLE, FACEBOOK_KEY_EVENT_FRIENDSHIP_ENABLE);
StoreDBCheckState(proto, hwnd, IDC_TICKER_ENABLE, FACEBOOK_KEY_EVENT_TICKER_ENABLE);
StoreDBCheckState(proto, hwnd, IDC_ON_THIS_DAY_ENABLE, FACEBOOK_KEY_EVENT_ON_THIS_DAY_ENABLE);
StoreDBCheckState(proto, hwnd, IDC_FILTER_ADS, FACEBOOK_KEY_FILTER_ADS);
}
} return TRUE;
}
return FALSE;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:70,代码来源:dialogs.cpp
示例11: FBOptionsProc
INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
FacebookProto *proto = reinterpret_cast<FacebookProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
switch (message)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
proto = reinterpret_cast<FacebookProto*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
ptrA login(db_get_sa(NULL, proto->ModuleName(), FACEBOOK_KEY_LOGIN));
if (login != NULL)
SetDlgItemTextA(hwnd, IDC_UN, login);
ptrA password(db_get_sa(NULL, proto->ModuleName(), FACEBOOK_KEY_PASS));
if (password != NULL)
SetDlgItemTextA(hwnd, IDC_PW, password);
if (!proto->isOffline()) {
SendDlgItemMessage(hwnd, IDC_UN, EM_SETREADONLY, TRUE, 0);
SendDlgItemMessage(hwnd, IDC_PW, EM_SETREADONLY, TRUE, 0);
}
SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0);
if (proto->m_tszDefaultGroup != NULL)
SetDlgItemText(hwnd, IDC_GROUP, proto->m_tszDefaultGroup);
LoadDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, DEFAULT_DISABLE_STATUS_NOTIFY);
LoadDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS);
LoadDBCheckState(proto, hwnd, IDC_NAME_AS_NICK, FACEBOOK_KEY_NAME_AS_NICK, DEFAULT_NAME_AS_NICK);
} return TRUE;
case WM_COMMAND:
{
switch (LOWORD(wparam)) {
case IDC_NEWACCOUNTLINK:
proto->OpenUrl(std::string(FACEBOOK_URL_HOMEPAGE));
return TRUE;
case IDC_UN:
case IDC_PW:
case IDC_GROUP:
if (HIWORD(wparam) == EN_CHANGE && (HWND)lparam == GetFocus())
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
default:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
} break;
case WM_NOTIFY:
if (reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY)
{
char str[128]; TCHAR tstr[128];
GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str));
db_set_s(0, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str);
GetDlgItemTextA(hwnd, IDC_PW, str, _countof(str));
proto->setString(FACEBOOK_KEY_PASS, str);
GetDlgItemText(hwnd, IDC_GROUP, tstr, _countof(tstr));
if (tstr[0] != '\0')
{
proto->m_tszDefaultGroup = mir_tstrdup(tstr);
proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr);
Clist_GroupCreate(0, tstr);
}
else {
proto->delSetting(FACEBOOK_KEY_DEF_GROUP);
proto->m_tszDefaultGroup = NULL;
}
StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS);
StoreDBCheckState(proto, hwnd, IDC_NAME_AS_NICK, FACEBOOK_KEY_NAME_AS_NICK);
return TRUE;
}
break;
}
return FALSE;
}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:90,代码来源:dialogs.cpp
示例12: FBMindProc
INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
post_status_data *data;
switch (message)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwnd);
Window_SetIcon_IcoLib(hwnd, GetIconHandle("mind"));
data = reinterpret_cast<post_status_data*>(lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
SendDlgItemMessage(hwnd, IDC_MINDMSG, EM_LIMITTEXT, FACEBOOK_MIND_LIMIT, 0);
SendDlgItemMessage(hwnd, IDC_URL, EM_LIMITTEXT, 1024, 0);
ptrT place(data->proto->getTStringA(FACEBOOK_KEY_PLACE));
SetDlgItemText(hwnd, IDC_PLACE, place != NULL ? place : _T("Miranda NG"));
bShowContacts = data->proto->getByte("PostStatusExpand", 0) > 0;
ResizeHorizontal(hwnd, bShowContacts);
HWND hwndClist = GetDlgItem(hwnd, IDC_CCLIST);
SetWindowLongPtr(hwndClist, GWL_STYLE, GetWindowLongPtr(hwndClist, GWL_STYLE) & ~CLS_HIDEOFFLINE);
for (std::vector<wall_data*>::size_type i = 0; i < data->walls.size(); i++)
SendDlgItemMessage(hwnd, IDC_WALL, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(data->walls[i]->title));
SendDlgItemMessage(hwnd, IDC_WALL, CB_SETCURSEL, 0, 0);
SendDlgItemMessage(hwnd, IDC_WALL, CB_SETCURSEL, data->proto->getByte(FACEBOOK_KEY_LAST_WALL, 0), 0);
RefreshPrivacy(hwnd, data);
ptrA firstname(data->proto->getStringA(FACEBOOK_KEY_FIRST_NAME));
if (firstname != NULL) {
char title[100];
mir_snprintf(title, Translate("What's on your mind, %s?"), firstname);
SetWindowTextA(hwnd, title);
}
}
EnableWindow(GetDlgItem(hwnd, IDOK), FALSE);
return TRUE;
case WM_NOTIFY:
{
NMCLISTCONTROL *nmc = (NMCLISTCONTROL *)lparam;
if (nmc->hdr.idFrom == IDC_CCLIST) {
switch (nmc->hdr.code) {
case CLN_LISTREBUILT:
data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
ClistPrepare(data->proto, NULL, nmc->hdr.hwndFrom);
break;
}
}
}
break;
case WM_COMMAND:
switch (LOWORD(wparam))
{
case IDC_WALL:
if (HIWORD(wparam) == CBN_SELCHANGE) {
data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
RefreshPrivacy(hwnd, data);
}
break;
case IDC_MINDMSG:
case IDC_URL:
if (HIWORD(wparam) == EN_CHANGE) {
bool ok = SendDlgItemMessage(hwnd, IDC_MINDMSG, WM_GETTEXTLENGTH, 0, 0) > 0;
if (!ok && SendDlgItemMessage(hwnd, IDC_URL, WM_GETTEXTLENGTH, 0, 0) > 0)
ok = true;
EnableWindow(GetDlgItem(hwnd, IDOK), ok);
return TRUE;
}
break;
case IDC_EXPAND:
bShowContacts = !bShowContacts;
ResizeHorizontal(hwnd, bShowContacts);
break;
case IDOK:
{
data = reinterpret_cast<post_status_data*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
TCHAR mindMessageT[FACEBOOK_MIND_LIMIT + 1];
TCHAR urlT[1024];
TCHAR placeT[100];
GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, _countof(mindMessageT));
GetDlgItemText(hwnd, IDC_PLACE, placeT, _countof(placeT));
GetDlgItemText(hwnd, IDC_URL, urlT, _countof(urlT));
ShowWindow(hwnd, SW_HIDE);
int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0);
//.........这里部分代码省略.........
开发者ID:ybznek,项目名称:miranda-ng,代码行数:101,代码来源:dialogs.cpp
示例13: win_proc
LRESULT CALLBACK win_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
struct ag_window* window = (struct ag_window*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch(msg)
{
case WM_CREATE:
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)((LPCREATESTRUCT)lparam)->lpCreateParams);
break;
case WM_DESTROY:
ag_event__push(ag_event__close_new(window));
break;
case WM_PAINT:
{
struct ag_surface32* surface = window->filtered_surface->output;
BITMAPINFO info;
PAINTSTRUCT ps;
info.bmiHeader.biSize = sizeof(BITMAPINFO);
info.bmiHeader.biWidth = surface->size.w;
info.bmiHeader.biHeight = -surface->size.h;
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 32;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = 0;
info.bmiHeader.biXPelsPerMeter = 1;
info.bmiHeader.biYPelsPerMeter = 1;
info.bmiHeader.biClrUsed = 0;
info.bmiHeader.biClrImportant = 0;
HDC hdc = BeginPaint(hwnd, &ps);
SetDIBitsToDevice(hdc, 0, 0, surface->size.w, surface->size.h, 0, 0, 0, surface->size.h, surface->data, &info, DIB_RGB_COLORS);
EndPaint(hwnd, &ps);
break;
}
case WM_SIZE:
window->size = ag_vec2i(LOWORD(lparam)/window->filtered_surface->scale, HIWORD(lparam)/window->filtered_surface->scale);
ag_window__reinit_surfaces(window);
if(ag_state_current)
ag_state__run_inner(ag_state_current);
break;
case WM_INPUT:
{
unsigned size;
GetRawInputData((HRAWINPUT)lparam, RID_INPUT, 0, &size, sizeof(RAWINPUTHEADER));
RAWINPUT* input = (RAWINPUT*)malloc(size);
GetRawInputData((HRAWINPUT)lparam, RID_INPUT, input, &size, sizeof(RAWINPUTHEADER));
RAWHID* hid = &input->data.hid;
for(int i = 0; i < hid->dwCount; ++i)
{
printf("[ ");
for(int j = 0; j < hid->dwSizeHid; ++j)
printf("%#04x ", hid->bRawData[j+i*hid->dwSizeHid]);
printf("] ");
}
printf("\n");
}
break;
case WM_MOUSEMOVE:
window->mouse_pos.x = GET_X_LPARAM(lparam) / window->filtered_surface->scale;
window->mouse_pos.y = GET_Y_LPARAM(lparam) / window->filtered_surface->scale;
ag_event__push(ag_event__mouse_move_new(window, window->mouse_pos));
break;
case WM_LBUTTONDOWN:
ag_event__push(ag_event__mouse_down_new(window, window->mouse_pos));
break;
case WM_LBUTTONUP:
ag_event__push(ag_event__mouse_up_new(window, window->mouse_pos));
break;
default:
return DefWindowProc(hwnd, msg, wparam, lparam);
}
return 0;
}
开发者ID:Athaudia,项目名称:athgame,代码行数:71,代码来源:platform.c
示例14: GetModuleHandle
bool Win32Factory::init()
{
const char* vlc_name = "VLC Media Player";
const char* vlc_icon = "VLC_ICON";
const char* vlc_class = "SkinWindowClass";
// Get instance handle
m_hInst = GetModuleHandle( NULL );
if( m_hInst == NULL )
{
msg_Err( getIntf(), "Cannot get module handle" );
}
// Create window class
WNDCLASS skinWindowClass;
skinWindowClass.style = CS_DBLCLKS;
skinWindowClass.lpfnWndProc = (WNDPROC)Win32Factory::Win32Proc;
skinWindowClass.lpszClassName = _T(vlc_class);
skinWindowClass.lpszMenuName = NULL;
skinWindowClass.cbClsExtra = 0;
skinWindowClass.cbWndExtra = 0;
skinWindowClass.hbrBackground = NULL;
skinWindowClass.hCursor = LoadCursor( NULL, IDC_ARROW );
skinWindowClass.hIcon = LoadIcon( m_hInst, _T(vlc_icon) );
skinWindowClass.hInstance = m_hInst;
// Register class and check it
if( !RegisterClass( &skinWindowClass ) )
{
WNDCLASS wndclass;
// Check why it failed. If it's because the class already exists
// then fine, otherwise return with an error.
if( !GetClassInfo( m_hInst, _T(vlc_class), &wndclass ) )
{
msg_Err( getIntf(), "cannot register window class" );
return false;
}
}
// Create Window
m_hParentWindow = CreateWindowEx( WS_EX_TOOLWINDOW, _T(vlc_class),
_T(vlc_name), WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX,
-200, -200, 0, 0, 0, 0, m_hInst, 0 );
if( m_hParentWindow == NULL )
{
msg_Err( getIntf(), "cannot create parent window" );
return false;
}
// Store with it a pointer to the interface thread
SetWindowLongPtr( m_hParentWindow, GWLP_USERDATA, (LONG_PTR)getIntf() );
// We do it this way otherwise CreateWindowEx will fail
// if WS_EX_LAYERED is not supported
SetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE,
GetWindowLongPtr( m_hParentWindow, GWL_EXSTYLE ) |
WS_EX_LAYERED );
ShowWindow( m_hParentWindow, SW_SHOW );
// Initialize the systray icon
m_trayIcon.cbSize = sizeof( NOTIFYICONDATA );
m_trayIcon.hWnd = m_hParentWindow;
m_trayIcon.uID = 42;
m_trayIcon.uFlags = NIF_ICON|NIF_TIP|NIF_MESSAGE;
m_trayIcon.uCallbackMessage = MY_WM_TRAYACTION;
m_trayIcon.hIcon = LoadIcon( m_hInst, _T(vlc_icon) );
strcpy( m_trayIcon.szTip, vlc_name );
// Show the systray icon if needed
if( var_InheritBool( getIntf(), "skins2-systray" ) )
{
addInTray();
}
// Show the task in the task bar if needed
if( var_InheritBool( getIntf(), "skins2-taskbar" ) )
{
addInTaskBar();
}
// Initialize the OLE library (for drag & drop)
OleInitialize( NULL );
// Initialize the resource path
char *datadir = config_GetUserDir( VLC_DATA_DIR );
m_resourcePath.push_back( (string)datadir + "\\skins" );
free( datadir );
datadir = config_GetDataDir();
m_resourcePath.push_back( (string)datadir + "\\skins" );
m_resourcePath.push_back( (string)datadir + "\\skins2" );
m_resourcePath.push_back( (string)datadir + "\\share\\skins" );
m_resourcePath.push_back( (string)datadir + "\\share\\skins2" );
free( datadir );
// Enumerate all monitors available
EnumDisplayMonitors( NULL, NULL, MonitorEnumProc, (LPARAM)&m_monitorList );
int num = 0;
for( list<HMONITOR>::iterator it = m_monitorList.begin();
//.........这里部分代码省略.........
开发者ID:RicoP,项目名称:vlcfork,代码行数:101,代码来源:win32_factory.cpp
示例15: Creds_OnUpdate
void Creds_OnUpdate (HWND hDlg)
{
LPTSTR pszCell = (LPTSTR)GetWindowLongPtr (hDlg, DWLP_USER);
if (!pszCell || !*pszCell)
{
BOOL fRunning = IsServiceRunning();
ShowWindow (GetDlgItem (hDlg, IDC_RUNNING), fRunning);
ShowWindow (GetDlgItem (hDlg, IDC_STOPPED), !fRunning);
ShowWindow (GetDlgItem (hDlg, IDC_CREDS_OBTAIN), fRunning);
return;
}
lock_ObtainMutex(&g.credsLock);
size_t iCreds;
for (iCreds = 0; iCreds < g.cCreds; ++iCreds)
{
if (!lstrcmpi (g.aCreds[ iCreds ].szCell, pszCell))
break;
}
TCHAR szGateway[cchRESOURCE] = TEXT("");
if (!g.fIsWinNT)
GetGatewayName (szGateway);
if (!szGateway[0])
{
SetDlgItemText (hDlg, IDC_CREDS_CELL, pszCell);
}
else
{
TCHAR szCell[ cchRESOURCE ];
TCHAR szFormat[ cchRESOURCE ];
GetString (szFormat, IDS_CELL_GATEWAY);
wsprintf (szCell, szFormat, pszCell, szGateway);
SetDlgItemText (hDlg, IDC_CREDS_CELL, szCell);
}
if (iCreds == g.cCreds)
{
TCHAR szText[cchRESOURCE];
GetString (szText, IDS_NO_CREDS);
SetDlgItemText (hDlg, IDC_CREDS_INFO, szText);
}
else
{
// FormatString(%t) expects a date in GMT, not the local time zone...
//
FILETIME ftLocal;
SystemTimeToFileTime (&g.aCreds[ iCreds ].stExpires, &ftLocal);
FILETIME ftGMT;
LocalFileTimeToFileTime (&ftLocal, &ftGMT);
SYSTEMTIME stGMT;
FileTimeToSystemTime (&ftGMT, &stGMT);
SYSTEMTIME stNow;
GetLocalTime (&stNow);
FILETIME ftNow;
SystemTimeToFileTime (&stNow, &ftNow);
LONGLONG llNow = (((LONGLONG)ftNow.dwHighDateTime) << 32) + (LONGLONG)(ftNow.dwLowDateTime);
LONGLONG llExpires = (((LONGLONG)ftLocal.dwHighDateTime) << 32) + (LONGLONG)(ftLocal.dwLowDateTime);
llNow /= c100ns1SECOND;
llExpires /= c100ns1SECOND;
LPTSTR pszCreds = NULL;
if (llExpires <= (llNow + (LONGLONG)cminREMIND_WARN * csec1MINUTE))
pszCreds = FormatString (IDS_CREDS_EXPIRED, TEXT("%s"), g.aCreds[ iCreds ].szUser);
if (!pszCreds || !pszCreds[0])
pszCreds = FormatString (IDS_CREDS, TEXT("%s%t"), g.aCreds[ iCreds ].szUser, &stGMT);
SetDlgItemText (hDlg, IDC_CREDS_INFO, pszCreds);
FreeString (pszCreds);
}
lock_ReleaseMutex(&g.credsLock);
CheckDlgButton (hDlg, IDC_CREDS_REMIND, (iCreds == g.cCreds) ? FALSE : g.aCreds[iCreds].fRemind);
EnableWindow (GetDlgItem (hDlg, IDC_CREDS_OBTAIN), IsServiceRunning());
EnableWindow (GetDlgItem (hDlg, IDC_CREDS_REMIND), (iCreds != g.cCreds));
EnableWindow (GetDlgItem (hDlg, IDC_CREDS_DESTROY), (iCreds != g.cCreds));
}
开发者ID:sanchit-matta,项目名称:openafs,代码行数:85,代码来源:credstab.cpp
示例16: DefWindowProc
LRESULT CALLBACK Win32Factory::Win32Proc( HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam )
{
// Get pointer to thread info: should only work with the parent window
intf_thread_t *p_intf = (intf_thread_t *)GetWindowLongPtr( hwnd,
GWLP_USERDATA );
// If doesn't exist, treat windows message normally
if( p_intf == NULL || p_intf->p_sys->p_osFactory == NULL )
{
return DefWindowProc( hwnd, uMsg, wParam, lParam );
}
Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( p_intf );
GenericWindow *pWin = pFactory->m_windowMap[hwnd];
if( hwnd == pFactory->getParentWindow() )
{
if( uMsg == WM_SYSCOMMAND )
{
// If closing parent window
if( (wParam & 0xFFF0) == SC_CLOSE )
{
libvlc_Quit( p_intf->p_libvlc );
return 0;
}
else if( (wParam & 0xFFF0) == SC_MINIMIZE )
{
pFactory->minimize();
return 0;
}
else if( (wParam & 0xFFF0) == SC_RESTORE )
{
pFactory->restore();
return 0;
}
else
{
msg_Dbg( p_intf, "WM_SYSCOMMAND %i", (wParam & 0xFFF0) );
}
}
// Handle systray notifications
else if( uMsg == MY_WM_TRAYACTION )
{
if( (UINT)lParam == WM_LBUTTONDOWN )
{
p_intf->p_sys->p_theme->getWindowManager().raiseAll();
CmdDlgHidePopupMenu aCmdPopup( p_intf );
aCmdPopup.execute();
return 0;
}
else if( (UINT)lParam == WM_RBUTTONDOWN )
{
CmdDlgShowPopupMenu aCmdPopup( p_intf );
aCmdPopup.execute();
return 0;
}
else if( (UINT)lParam == WM_LBUTTONDBLCLK )
{
CmdRestore aCmdRestore( p_intf );
aCmdRestore.execute();
return 0;
}
}
}
else if( pW
|
请发表评论