本文整理汇总了C++中SetTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ SetTimer函数的具体用法?C++ SetTimer怎么用?C++ SetTimer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetTimer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetTimer
// Enable or disable the OK button
void PromptDialog::OnChange()
{
SetTimer(TIMER_ID_CHECK_OK, 10, NULL);
}
示例2: DlgProcUrlSend
//.........这里部分代码省略.........
sttUpdateTitle(hwndDlg, dat->hContact);
break;
case WM_COMMAND:
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
switch (LOWORD(wParam)) {
case IDOK:
{
char *body, *url;
int bodySize, urlSize;
urlSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS))+1;
url = (char*)mir_alloc(urlSize);
GetDlgItemTextA(hwndDlg, IDC_URLS, url, urlSize);
if (url[0] == 0) {
mir_free(url);
break;
}
bodySize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE))+1;
body = (char*)mir_alloc(bodySize);
GetDlgItemTextA(hwndDlg, IDC_MESSAGE, body, bodySize);
dat->sendBuffer = (char*)mir_realloc(dat->sendBuffer, lstrlenA(url)+lstrlenA(body)+2);
lstrcpyA(dat->sendBuffer, url);
lstrcpyA(dat->sendBuffer+lstrlenA(url)+1, body);
dat->hAckEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_EVENTSENT);
dat->hSendId = (HANDLE)CallContactService(dat->hContact, PSS_URL, 0, (LPARAM)dat->sendBuffer);
mir_free(url);
mir_free(body);
//create a timeout timer
SetTimer(hwndDlg, 0, TIMEOUT_URLSEND, NULL);
EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_URLS), FALSE);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETREADONLY, TRUE, 0);
return TRUE;
}
case IDCANCEL:
DestroyWindow(hwndDlg);
return TRUE;
case IDC_URLS:
if (HIWORD(wParam) == CBN_SELCHANGE) {
int i, urlSize;
char *title;
i = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETCURSEL, 0, 0);
title = (char*)SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETITEMDATA, (WPARAM)i, 0);
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, title);
urlSize = SendDlgItemMessage(hwndDlg, IDC_URLS, CB_GETLBTEXTLEN, (WPARAM)i, 0);
EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0));
}
else if (HIWORD(wParam) == CBN_EDITCHANGE) {
int urlSize = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_URLS));
EnableWindow(GetDlgItem(hwndDlg, IDOK), (urlSize>0));
}
break;
case IDC_USERMENU:
{
RECT rc;
HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0);
GetWindowRect(GetDlgItem(hwndDlg, IDC_USERMENU), &rc);
TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL);
示例3: DateTimePageProc
/* Property page dialog callback */
INT_PTR CALLBACK
DateTimePageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
SYSTEMTIME st;
GetLocalTime(&st);
switch (uMsg)
{
case WM_INITDIALOG:
FillMonthsComboBox(GetDlgItem(hwndDlg,
IDC_MONTHCB));
SetTimer(hwndDlg, ID_TIMER, 1000, NULL);
/* Set range and current year */
SendMessageW(GetDlgItem(hwndDlg, IDC_YEAR), UDM_SETRANGE, 0, MAKELONG ((short) 9999, (short) 1900));
SendMessageW(GetDlgItem(hwndDlg, IDC_YEAR), UDM_SETPOS, 0, MAKELONG( (short) st.wYear, 0));
pOldWndProc = (WNDPROC) SetWindowLongPtrW(GetDlgItem(hwndDlg, IDC_TIMEPICKER), GWL_WNDPROC, (INT_PTR) DTPProc);
break;
case WM_TIMER:
SendMessageW(GetDlgItem(hwndDlg, IDC_TIMEPICKER), DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM) &st);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_MONTHCB:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
ChangeMonthCalDate(GetDlgItem(hwndDlg,
IDC_MONTHCALENDAR),
(WORD) -1,
GetCBSelectedMonth((HWND)lParam),
(WORD) -1);
}
break;
}
break;
case WM_CTLCOLORSTATIC:
if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_YEARTEXT))
return (INT_PTR)GetSysColorBrush(COLOR_WINDOW);
break;
case WM_NOTIFY:
{
LPNMHDR lpnm = (LPNMHDR)lParam;
switch (lpnm->idFrom)
{
case IDC_YEAR:
switch (lpnm->code)
{
case UDN_DELTAPOS:
{
SHORT wYear;
LPNMUPDOWN updown = (LPNMUPDOWN)lpnm;
wYear = (SHORT)SendMessageW(GetDlgItem(hwndDlg, IDC_YEAR), UDM_GETPOS, 0, 0);
/* Enable the 'Apply' button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
ChangeMonthCalDate(GetDlgItem(hwndDlg,
IDC_MONTHCALENDAR),
(WORD) -1,
(WORD) -1,
(WORD) (wYear + updown->iDelta));
}
break;
}
break;
case IDC_TIMEPICKER:
switch (lpnm->code)
{
case DTN_DATETIMECHANGE:
/* Stop the timer */
KillTimer(hwndDlg, ID_TIMER);
/* Tell the clock to stop ticking */
SendDlgItemMessageW(hwndDlg, IDC_CLOCKWND, CLM_STOPCLOCK,
0, 0);
/* Enable the 'Apply' button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
}
break;
case IDC_MONTHCALENDAR:
switch (lpnm->code)
{
case MCCN_SELCHANGE:
/* Enable the 'Apply' button */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
//.........这里部分代码省略.........
示例4: Extract
bool Extract(std::list<CString> &ParamList,CConfigManager &ConfigManager,DLL_ID ForceDLL,LPCTSTR lpSpecificOutputDir,const CMDLINEINFO* lpCmdLineInfo)
{
TRACE(_T("Function ::Extract() started.\n"));
CConfigGeneral ConfGeneral;
CConfigExtract ConfExtract;
ConfGeneral.load(ConfigManager);
ConfExtract.load(ConfigManager);
//設定上書き
if(lpCmdLineInfo){
if(-1!=lpCmdLineInfo->OutputToOverride){
ConfExtract.OutputDirType=lpCmdLineInfo->OutputToOverride;
}
if(-1!=lpCmdLineInfo->CreateDirOverride){
ConfExtract.CreateDir=lpCmdLineInfo->CreateDirOverride;
}
if(-1!=lpCmdLineInfo->DeleteAfterProcess){
ConfExtract.DeleteArchiveAfterExtract=lpCmdLineInfo->DeleteAfterProcess;
}
}
//セマフォによる排他処理
CSemaphoreLocker SemaphoreLock;
if(ConfExtract.LimitExtractFileCount){
SemaphoreLock.Lock(LHAFORGE_EXTRACT_SEMAPHORE_NAME,ConfExtract.MaxExtractFileCount);
}
UINT uFiles=ParamList.size(); //引数にあるファイルの数
//プログレスバー
CProgressDialog dlg;
//メッセージループを回すためのタイマー
int timer=NULL;
if(uFiles>=2){ //ファイルが複数ある時に限定
dlg.Create(NULL);
dlg.SetTotalFileCount(uFiles);
dlg.ShowWindow(SW_SHOW);
timer=SetTimer(NULL,NULL,1000,UtilMessageLoopTimerProc);
}
//指定の出力先
CPath pathSpecificOutputDir(lpSpecificOutputDir ? lpSpecificOutputDir : _T(""));
std::vector<ARCLOG> LogArray; //処理結果を保持
bool bAllOK=true; //すべて問題なく解凍されればtrue
//解凍処理
for(std::list<CString>::iterator ite_param=ParamList.begin();ite_param!=ParamList.end();++ite_param){
//プログレスバーを進める
if(dlg.IsWindow())dlg.SetNextState(*ite_param);
ARCLOG arcLog;
//メッセージループ
while(UtilDoMessageLoop())continue;
//アーカイバハンドラ取得
//ここでUNICODE非対応DLLにユニコードファイル名を渡そうとした場合は弾かれる。そして、ここでは失敗の原因を解明できない
CArchiverDLL *lpArchiver=CArchiverDLLManager::GetInstance().GetArchiver(*ite_param,ConfExtract.DenyExt,ForceDLL);
if(!lpArchiver){
//対応するハンドラがなかった
arcLog.Result=EXTRACT_NOTARCHIVE;
arcLog.strMsg.Format(IDS_ERROR_ILLEGAL_HANDLER,(LPCTSTR)*ite_param);
arcLog.strFile=*ite_param;
bAllOK=false;
LogArray.push_back(arcLog);
continue;
}
CPath pathOpenDir; //ファイラが開くべきフォルダ
//解凍実行
bool bRet=ExtractOneArchive(ConfigManager,ConfGeneral,ConfExtract,lpArchiver,*ite_param,pathSpecificOutputDir,arcLog,pathOpenDir);
//ログ保存
LogArray.push_back(arcLog);
if(!bRet){
bAllOK=false;
}else{
//出力先フォルダを開く
if(ConfExtract.OpenDir){
if(ConfGeneral.Filer.UseFiler){
//パラメータ展開に必要な情報
std::map<stdString,CString> envInfo;
MakeExpandInformationEx(envInfo,pathOpenDir,NULL);
//コマンド・パラメータ展開
CString strCmd,strParam;
UtilExpandTemplateString(strCmd,ConfGeneral.Filer.FilerPath,envInfo); //コマンド
UtilExpandTemplateString(strParam,ConfGeneral.Filer.Param,envInfo); //パラメータ
ShellExecute(NULL, _T("open"), strCmd,strParam, NULL, SW_SHOWNORMAL);
}else{
//Explorerで開く
UtilNavigateDirectory(pathOpenDir);
}
}
//正常に解凍できた圧縮ファイルを削除orごみ箱に移動
if(bRet && ConfExtract.DeleteArchiveAfterExtract){
if(!ConfExtract.ForceDelete && lpArchiver->IsWeakErrorCheck()){
//.........这里部分代码省略.........
示例5: GetDlgItem
//.........这里部分代码省略.........
m_FilterOpaque.SetCheck( true );
m_FilterTranslucent.SetCheck( true );
m_FilterSelfIllum.SetCheck( true );
m_FilterEnvMask.SetCheck( true );
m_ShowErrors.SetCheck( true );
//
// Create CTextureWindow that takes up area of dummy control.
//
RECT r;
GetDlgItem(IDC_BROWSERDUMMY)->GetClientRect(&r);
m_cTextureWindow.Create(this, r);
// Show everything initially
m_cTextureWindow.SetTypeFilter( ~0, true );
//
// Add latest history to the filter combo.
//
for (int i = 0; i < m_nFilterHistory; i++)
{
m_cFilter.AddString(m_FilterHistory[i]);
}
//
// Set the name filter unless one was explicitly specified.
//
if (m_szNameFilter[0] == '\0')
{
//
// No name filter specified. Use whatever is on top of the history.
//
if (m_cFilter.GetCount() > 0)
{
m_cFilter.GetLBText(0, m_szNameFilter);
m_cFilter.SetCurSel(0);
}
}
m_cFilter.SetWindowText(m_szNameFilter);
m_cTextureWindow.SetNameFilter(m_szNameFilter);
//
// Done with the name filter; clear it for next time.
//
m_szNameFilter[0] = '\0';
//
// Add the global list of keywords to the keywords combo.
//
POSITION pos = g_Textures.KeywordsGetHeadPosition();
while (pos != NULL)
{
char *pszKeyword = g_Textures.KeywordsGetNext(pos);
m_cKeywords.AddString(pszKeyword);
}
//
// Set the keyword filter.
//
m_cKeywords.SetWindowText(m_szLastKeywords);
m_cTextureWindow.SetKeywords(m_szLastKeywords);
m_cUsed.SetCheck(m_bUsed);
CWinApp *pApp = AfxGetApp();
CString str = pApp->GetProfileString(pszIniSection, "Position");
if (!str.IsEmpty())
{
CRect r;
sscanf(str, "%d %d %d %d", &r.left, &r.top, &r.right, &r.bottom);
if (r.left < 0)
{
ShowWindow(SW_SHOWMAXIMIZED);
}
else
{
MoveWindow(r.left, r.top, r.right-r.left, r.bottom-r.top, FALSE);
}
}
int iSize = pApp->GetProfileInt(pszIniSection, "ShowSize", 0);
m_cSizeList.SetCurSel(iSize);
OnSelendokTexturesize();
if (szInitialTexture[0])
{
m_cTextureWindow.SelectTexture(szInitialTexture);
}
m_cTextureWindow.ShowWindow(SW_SHOW);
SetTimer(1, 500, NULL);
m_cFilter.SetFocus();
return(FALSE);
}
示例6: DisplayProc
LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_ACTIVATE:
break;
case WM_SETFOCUS:
break;
case WM_SIZE:
break;
case WM_ERASEBKGND:
return DefWindowProc(hWnd, message, wParam, lParam);
// Poor man's touch - mouse input. We send the data both as an input_state pointer,
// and as asynchronous touch events for minimal latency.
case WM_LBUTTONDOWN:
// Hack: Take the opportunity to show the cursor.
mouseButtonDown = true;
{
lock_guard guard(input_state.lock);
input_state.mouse_valid = true;
input_state.pointer_down[0] = true;
int factor = g_Config.iWindowZoom == 1 ? 2 : 1;
input_state.pointer_x[0] = GET_X_LPARAM(lParam) * factor;
input_state.pointer_y[0] = GET_Y_LPARAM(lParam) * factor;
TouchInput touch;
touch.id = 0;
touch.flags = TOUCH_DOWN;
touch.x = GET_X_LPARAM(lParam);
touch.y = GET_Y_LPARAM(lParam);
NativeTouch(touch);
}
break;
case WM_MOUSEMOVE:
{
// Hack: Take the opportunity to show the cursor.
mouseButtonDown = (wParam & MK_LBUTTON) != 0;
int cursorX = GET_X_LPARAM(lParam);
int cursorY = GET_Y_LPARAM(lParam);
if (abs(cursorX - prevCursorX) > 1 || abs(cursorY - prevCursorY) > 1) {
hideCursor = false;
SetTimer(hwndMain, TIMER_CURSORMOVEUPDATE, CURSORUPDATE_MOVE_TIMESPAN_MS, 0);
}
prevCursorX = cursorX;
prevCursorY = cursorY;
lock_guard guard(input_state.lock);
int factor = g_Config.iWindowZoom == 1 ? 2 : 1;
input_state.pointer_x[0] = GET_X_LPARAM(lParam) * factor;
input_state.pointer_y[0] = GET_Y_LPARAM(lParam) * factor;
if (wParam & MK_LBUTTON) {
TouchInput touch;
touch.id = 0;
touch.flags = TOUCH_MOVE;
touch.x = GET_X_LPARAM(lParam);
touch.y = GET_Y_LPARAM(lParam);
NativeTouch(touch);
}
}
break;
case WM_LBUTTONUP:
// Hack: Take the opportunity to hide the cursor.
mouseButtonDown = false;
{
lock_guard guard(input_state.lock);
input_state.pointer_down[0] = false;
int factor = g_Config.iWindowZoom == 1 ? 2 : 1;
input_state.pointer_x[0] = GET_X_LPARAM(lParam) * factor;
input_state.pointer_y[0] = GET_Y_LPARAM(lParam) * factor;
TouchInput touch;
touch.id = 0;
touch.flags = TOUCH_UP;
touch.x = GET_X_LPARAM(lParam);
touch.y = GET_Y_LPARAM(lParam);
NativeTouch(touch);
}
break;
// Actual touch! Unfinished
case WM_TOUCH:
{
// TODO: Enabling this section will probably break things on Windows XP.
// We probably need to manually fetch pointers to GetTouchInputInfo and CloseTouchInputHandle.
#if ENABLE_TOUCH
UINT inputCount = LOWORD(wParam);
TOUCHINPUT *inputs = new TOUCHINPUT[inputCount];
if (GetTouchInputInfo((HTOUCHINPUT)lParam,
inputCount,
inputs,
sizeof(TOUCHINPUT)))
//.........这里部分代码省略.........
示例7: SplashWindowProc
LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_LOADED:
#ifdef _DEBUG
logMessage(_T("WM_LOADED"), _T("called"));
#endif
if (!options.showtime)
SetTimer(hwnd, 7, 2000, 0);
break;
case WM_LBUTTONDOWN:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case WM_TIMER:
#ifdef _DEBUG
TCHAR b[40];
mir_sntprintf(b, _T("%d"), wParam);
logMessage(_T("Timer ID"), b);
mir_sntprintf(b, _T("%d"), options.showtime);
logMessage(_T("ShowTime value"), b);
#endif
if (options.showtime > 0) { // TimeToShow enabled
if (wParam == 6) {
PostMessage(hwnd, WM_CLOSE, 0, 0);
#ifdef _DEBUG
logMessage(_T("Showtime timer"), _T("triggered"));
#endif
}
}
else {
PostMessage(hwnd, WM_CLOSE, 0, 0);
if (wParam == 7) {
#ifdef _DEBUG
logMessage(_T("On Modules Loaded timer"), _T("triggered"));
#endif
}
}
break;
case WM_RBUTTONDOWN:
ShowWindow(hwndSplash, SW_HIDE);
DestroyWindow(hwndSplash);
bpreviewruns = false; // preview is stopped.
break;
case WM_CLOSE:
{
RECT rc; GetWindowRect(hwndSplash, &rc);
POINT ptDst = { rc.left, rc.top };
POINT ptSrc = { 0, 0 };
SIZE sz = { rc.right - rc.left, rc.bottom - rc.top };
BLENDFUNCTION blend;
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags = 0;
blend.SourceConstantAlpha = 255;
blend.AlphaFormat = AC_SRC_ALPHA;
// Fade Out
if (options.fadeout) {
int i;
for (i = 255; i >= 0; i -= options.fosteps) {
blend.SourceConstantAlpha = i;
UpdateLayeredWindow(hwndSplash, NULL, &ptDst, &sz, SplashBmp->getDC(), &ptSrc, 0xffffffff, &blend, LWA_ALPHA);
Sleep(1);
}
}
}
if (bserviceinvoked) bserviceinvoked = false;
if (bpreviewruns) bpreviewruns = false;
DestroyWindow(hwndSplash);
break;
case WM_MOUSEMOVE:
if (bserviceinvoked)
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
case WM_DESTROY:
#ifdef _DEBUG
logMessage(_T("WM_DESTROY"), _T("called"));
#endif
ShowWindow(hwndSplash, SW_HIDE);
DestroyWindow(hwndSplash);
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
示例8: SetPixelFormat
int CGLWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// Get the device context
m_hDC = ::GetDC(this->m_hWnd);
// Set the Pixel Format
SetPixelFormat(m_hDC, m_nPixelFormat, NULL);
// Create the rendering context and make it current
m_hRC = wglCreateContext(m_hDC);
if(m_hRC != NULL)
wglMakeCurrent(m_hDC, m_hRC);
// Setup the context
if(m_hRC != NULL)
{
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glGenTextures(6, m_Sides);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glFrontFace(GL_CCW);
BYTE *pBytes;
int nWidth, nHeight;
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_REPLACE);
// Load the texture objects
pBytes = gltResourceBMPBits(IDB_BITMAP1, &nWidth, &nHeight);
glBindTexture(GL_TEXTURE_2D, m_Sides[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,nWidth, nHeight, 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pBytes);
pBytes = gltResourceBMPBits(IDB_BITMAP2, &nWidth, &nHeight);
glBindTexture(GL_TEXTURE_2D, m_Sides[1]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,nWidth, nHeight, 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pBytes);
pBytes = gltResourceBMPBits(IDB_BITMAP3, &nWidth, &nHeight);
glBindTexture(GL_TEXTURE_2D, m_Sides[2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,nWidth, nHeight, 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pBytes);
pBytes = gltResourceBMPBits(IDB_BITMAP4, &nWidth, &nHeight);
glBindTexture(GL_TEXTURE_2D, m_Sides[3]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,nWidth, nHeight, 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pBytes);
pBytes = gltResourceBMPBits(IDB_BITMAP5, &nWidth, &nHeight);
glBindTexture(GL_TEXTURE_2D, m_Sides[4]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,nWidth, nHeight, 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pBytes);
pBytes = gltResourceBMPBits(IDB_BITMAP6, &nWidth, &nHeight);
glBindTexture(GL_TEXTURE_2D, m_Sides[5]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,nWidth, nHeight, 0,
GL_BGR_EXT, GL_UNSIGNED_BYTE, pBytes);
}
SetTimer(101, 30, NULL);
return 0;
}
示例9: switch
//.........这里部分代码省略.........
//视图位置
m_wViewChairID[i]=SwitchViewChairID(i);
//桌面筹码
if(m_lTableScore[i]>0L)m_GameClientView.SetUserTableScore(m_wViewChairID[i],m_lTableScore[i]);
//获取用户
const tagUserData * pUserData=GetUserData(i);
if (pUserData==NULL) continue;
//游戏信息
m_cbPlayStatus[i]=TRUE;
//用户名字
lstrcpyn(m_szAccounts[i],pUserData->szName,CountArray(m_szAccounts[i]));
}
//设置筹码
if (!IsLookonMode() && pStatusScore->lTurnMaxScore>0L && m_lTableScore[GetMeChairID()]==0L)
{
LONGLONG lUserMaxScore[GAME_PLAYER];
ZeroMemory(lUserMaxScore,sizeof(lUserMaxScore));
LONGLONG lTemp=m_lTurnMaxScore;
for (WORD i=0;i<GAME_PLAYER;i++)
{
if(i>0)lTemp/=2;
lUserMaxScore[i]=__max(lTemp,1L);
}
//更新控件
UpdateScoreControl(lUserMaxScore,SW_SHOW);
//实际定时器
SetTimer(IDI_TIME_USER_ADD_SCORE,(TIME_USER_ADD_SCORE)*1000,NULL);
}
//庄家标志
WORD wID=m_wViewChairID[m_wBankerUser];
m_GameClientView.SetBankerUser(wID);
//等待标志
m_GameClientView.SetWaitInvest(true);
//辅助显示中心时钟
SetGameTimer(GetMeChairID(),IDI_NULLITY,TIME_USER_ADD_SCORE);
return true;
}
case GS_TK_PLAYING: //游戏状态
{
//效验数据
if (wDataSize!=sizeof(CMD_S_StatusPlay)) return false;
CMD_S_StatusPlay * pStatusPlay=(CMD_S_StatusPlay *)pBuffer;
//设置变量
m_lTurnMaxScore=pStatusPlay->lTurnMaxScore;
m_wBankerUser=pStatusPlay->wBankerUser;
CopyMemory(m_lTableScore,pStatusPlay->lTableScore,sizeof(m_lTableScore));
CopyMemory(m_bUserOxCard,pStatusPlay->bOxCard,sizeof(m_bUserOxCard));
for (WORD i=0;i<GAME_PLAYER;i++)
{
//视图位置
m_wViewChairID[i]=SwitchViewChairID(i);
//桌面筹码
示例10: StartTimedRedraw
void StartTimedRedraw(UINT millis)
{
SetTimer(g_hWnd, REFRESH_TIMER, millis, NULL);
}
示例11: SetTimer
void CMainFrame::StartTimer()
{
// Start timer that checks for continued existence of attached HWND
SetTimer(HWND_CHECK_TIMER, 200, 0);
}
示例12: SplashWndProc
LRESULT CALLBACK SplashWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
UINT_PTR iRes = 0; // for SetTimer ret val
switch (message)
{
case WM_CREATE:
TRACE( _T("SplashWndProc> WM_CREATE\n") );
iRes = SetTimer( hWnd, 1, g_dwSplashScreenTimeToLive, NULL );
// InvalidateRect( hWnd, NULL, FALSE );
// OnSplashWndPaint(hWnd);
CenterWindow( hWnd );
MakeWindowTransparent( hWnd, transparentFactor, crTransparent );
SetCursor( LoadCursor( NULL, MAKEINTRESOURCE(IDC_ARROW) ) );
break;
case WM_PAINT:
// TRACE( _T("SplashWndProc> WM_PAINT\n") );
OnSplashWndPaint(hWnd);
break;
case WM_LBUTTONUP:
if( g_bDragSplash )
{
g_bDragSplash = FALSE;
ReleaseCapture();
}
break;
case WM_MOUSEMOVE:
if( g_bDragSplash )
{
POINT p1 = g_ptMouseDragBegin;
RECT r = g_rWindowDragBegin;
POINT p2;
GetCursorPos( &p2 );
int dx = p2.x - p1.x;
int dy = p2.y - p1.y;
MoveWindow( hWnd, r.left + dx, r.top + dy, r.right - r.left, r.bottom - r.top, TRUE );
}
break;
case WM_LBUTTONDOWN:
#ifdef EXIT_ON_MOUSE_CLICK
::DestroyWindow(hWnd);
#else
SetCapture(hWnd);
GetCursorPos( &g_ptMouseDragBegin );
GetWindowRect( hWnd, &g_rWindowDragBegin );
g_bDragSplash = TRUE; // Set flag to check for key down in mouse move
// message.
#endif
break;
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
// TRACE( _T("SplashWndProc> Mouse click\n") );
#ifdef EXIT_ON_MOUSE_CLICK
::DestroyWindow(hWnd);
#else
#ifdef TOGGLE_SPLASH
g_bStopSplashOnTimer = !g_bStopSplashOnTimer;
#endif
#endif
break;
case WM_KEYDOWN:
// TRACE( _T("SplashWndProc> WM_KEYDOWN: VK = %X\n"), wParam );
if( wParam == VK_ESCAPE )
{
::DestroyWindow(hWnd);
}
else
{
#ifdef EXIT_ON_KBD_HIT
::DestroyWindow(hWnd);
#else
#ifdef TOGGLE_SPLASH
g_bStopSplashOnTimer = !g_bStopSplashOnTimer;
#endif
#endif
}
//return DefWindowProc(hWnd, message, wParam, lParam);
break;
case WM_TIMER:
TRACE( _T("SplashWndProc> WM_TIMER\n") );
if( g_bStopSplashOnTimer )
{
::DestroyWindow(hWnd);
}
break;
case WM_DESTROY:
TRACE( _T("SplashWndProc> WM_DESTROY\n") );
#ifdef EXIT_AFTER_SPLASH
PostQuitMessage( 0 );
#endif
//.........这里部分代码省略.........
示例13: EnterCriticalSection
void CControlBar::FilterToolTipMsg(UINT message, CPoint point)
{
EnterCriticalSection(_afxCriticalSection);
if (message == WM_LBUTTONDOWN || message == WM_LBUTTONUP ||
message == WM_NCLBUTTONDOWN || message == WM_NCLBUTTONUP ||
(message >= WM_KEYFIRST && message <= WM_KEYLAST) ||
(message >= WM_SYSKEYFIRST && message <= WM_SYSKEYLAST))
{
// clicking or typing causes the tooltip to go away
DestroyToolTip(TRUE, TRUE);
ScreenToClient(&point);
m_nHitLast = OnCmdHitTest(point, NULL);
m_pBarLast = (m_nHitLast == (UINT)-1 ? NULL : this);
// set a timer to detect moving out of the window and don't
// bother with a long timer before showing next tip
ClientToScreen(&point);
int nHitType = HitTestToolTip(point, NULL);
if (nHitType >= -1 ||
nHitType == HITTYPE_DISABLED || nHitType == HITTYPE_TRACKING)
{
VERIFY(SetTimer(ID_TIMER, 200, NULL) != 0);
m_bDelayDone = TRUE;
}
}
else if (message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ||
message == WM_TIMER)
{
// moving the mouse changes the state of the timer/tooltip
// timer is used to detect when to display tooltips and to detect
// when mouse has left the window. In Win32, can't capture the
// mouse across apps when the mouse button is not down, so have
// to use the timer
UINT nHit;
int nHitType = HitTestToolTip(point, &nHit);
if (nHitType >= 0)
{
if (!m_bDelayDone)
{
if (point != m_pointLastMove)
{
// first delay timer not done yet, so reset
DestroyToolTip(FALSE, TRUE);
VERIFY(SetTimer(ID_TIMER, 600, NULL) != 0);
}
}
else if (message != WM_TIMER || point != m_pointLastMove)
{
if (m_nHitLast != nHit)
{
DestroyToolTip(FALSE, TRUE);
m_bDelayDone = TRUE;
KillTimer(ID_TIMER);
VERIFY(SetTimer(ID_TIMER, 50, NULL) != 0);
}
}
else
{
// second delay already done so show tooltip for item hit
KillTimer(ID_TIMER);
VERIFY(SetTimer(ID_TIMER, 200, NULL) != 0);
ShowToolTip(point, nHit);
}
}
else
{
// different levels of tooltip removal is necessary
switch (nHitType)
{
case HITTYPE_NOTHING:
DestroyToolTip(TRUE, !m_bDelayDone);
m_nHitLast = (UINT)-1;
m_pBarLast = NULL;
break;
case HITTYPE_FOCUS:
case HITTYPE_OUTSIDE:
case HITTYPE_INACTIVE:
DestroyToolTip(TRUE, TRUE);
m_nHitLast = (UINT)-1;
m_pBarLast = NULL;
break;
case HITTYPE_TRACKING:
case HITTYPE_DISABLED:
DestroyToolTip(FALSE, FALSE);
ScreenToClient(&point);
m_nHitLast = OnCmdHitTest(point, NULL);
if (m_nHitLast == (UINT)-1)
m_pBarLast = NULL;
ClientToScreen(&point);
break;
}
}
}
m_pointLastMove = point;
LeaveCriticalSection(_afxCriticalSection);
//.........这里部分代码省略.........
示例14: FirstTimeCheck
void FirstTimeCheck()
{
hFirstCheckTimer = SetTimer(NULL, 0, 5 * 1000, OnFirstCheckTimer);
}
示例15: DlgProcAlarm
//.........这里部分代码省略.........
}
else {
HRGN hRgn1;
RECT r;
int w = 10;
GetWindowRect(hwndDlg, &r);
int h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
h = (h < v) ? h : v;
hRgn1 = CreateRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1));
SetWindowRgn(hwndDlg, hRgn1, 1);
}
// transparency
#ifdef WS_EX_LAYERED
SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, GetWindowLongPtr(hwndDlg, GWL_EXSTYLE) | WS_EX_LAYERED);
#endif
#ifdef LWA_ALPHA
SetLayeredWindowAttributes(hwndDlg, RGB(0, 0, 0), (int)((100 - opt->aw_trans) / 100.0 * 255), LWA_ALPHA);
#endif
return TRUE;
case WMU_SETALARM:
{
ALARM *data = (ALARM *)lParam;
SetWindowText(hwndDlg, data->szTitle);
SetWindowText(GetDlgItem(hwndDlg, IDC_TITLE), data->szTitle);
SetDlgItemText(hwndDlg, IDC_ED_DESC, data->szDesc);
wd->alarm = data;
if (data->action & AAF_SOUND && options.loop_sound) {
if (data->sound_num <= 3)
SetTimer(hwndDlg, ID_TIMER_SOUND, SOUND_REPEAT_PERIOD, nullptr);
else if (data->sound_num == 4)
SetTimer(hwndDlg, ID_TIMER_SOUND, SPEACH_REPEAT_PERIOD, nullptr);
}
HWND hw = GetDlgItem(hwndDlg, IDC_SNOOZE);
EnableWindow(hw, !(data->flags & ALF_NOSNOOZE));
ShowWindow(hw, (data->flags & ALF_NOSNOOZE) ? SW_HIDE : SW_SHOWNA);
}
return TRUE;
case WMU_FAKEALARM:
SetWindowText(hwndDlg, TranslateT("Example alarm"));
SetDlgItemText(hwndDlg, IDC_TITLE, TranslateT("Example alarm"));
SetDlgItemText(hwndDlg, IDC_ED_DESC, TranslateT("Some example text. Example, example, example."));
return TRUE;
case WM_TIMER:
if (wParam == ID_TIMER_SOUND && wd) {
ALARM *data = wd->alarm;
if (data && data->action & AAF_SOUND) {
if (data->sound_num <= 3) {
char buff[128];
mir_snprintf(buff, "Triggered%d", data->sound_num);
Skin_PlaySound(buff);
}
else if (data->sound_num == 4) {
if (data->szTitle != nullptr && data->szTitle[0] != '\0') {
if (ServiceExists("Speak/Say")) {
CallService("Speak/Say", 0, (LPARAM)data->szTitle);
}
}
}