本文整理汇总了C++中MAKELPARAM函数的典型用法代码示例。如果您正苦于以下问题:C++ MAKELPARAM函数的具体用法?C++ MAKELPARAM怎么用?C++ MAKELPARAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAKELPARAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SettingsDlgProc
static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
hwndSettingsDlg = hwndDlg;
LCID locale = Langpack_GetDefaultLocale();
SendDlgItemMessage(hwndDlg, IDC_ICON_HEADER, STM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon("AutoShutdown_Header"));
{
HFONT hBoldFont;
LOGFONT lf;
if (GetObject((HFONT)SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_GETFONT, 0, 0), sizeof(lf), &lf)) {
lf.lfWeight = FW_BOLD;
hBoldFont = CreateFontIndirect(&lf);
}
else hBoldFont = NULL;
SendDlgItemMessage(hwndDlg, IDC_TEXT_HEADER, WM_SETFONT, (WPARAM)hBoldFont, FALSE);
}
/* read-in watcher flags */
{
WORD watcherType = db_get_w(NULL, "AutoShutdown", "WatcherFlags", SETTING_WATCHERFLAGS_DEFAULT);
CheckRadioButton(hwndDlg, IDC_RADIO_STTIME, IDC_RADIO_STCOUNTDOWN, (watcherType&SDWTF_ST_TIME) ? IDC_RADIO_STTIME : IDC_RADIO_STCOUNTDOWN);
CheckDlgButton(hwndDlg, IDC_CHECK_SPECIFICTIME, (watcherType&SDWTF_SPECIFICTIME) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_MESSAGE, (watcherType&SDWTF_MESSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_FILETRANSFER, (watcherType&SDWTF_FILETRANSFER) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_IDLE, (watcherType&SDWTF_IDLE) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_STATUS, (watcherType&SDWTF_STATUS) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_CPUUSAGE, (watcherType&SDWTF_CPUUSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
}
/* read-in countdown val */
{
SYSTEMTIME st;
if (!TimeStampToSystemTime((time_t)db_get_dw(NULL, "AutoShutdown", "TimeStamp", SETTING_TIMESTAMP_DEFAULT), &st))
GetLocalTime(&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), GDT_VALID, &st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DATE_TIMESTAMP), GDT_VALID, &st);
SendMessage(hwndDlg, M_CHECK_DATETIME, 0, 0);
}
{
DWORD setting = db_get_dw(NULL, "AutoShutdown", "Countdown", SETTING_COUNTDOWN_DEFAULT);
if (setting < 1) setting = SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETRANGE, 0, MAKELPARAM(UD_MAXVAL, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_COUNTDOWN, EM_SETLIMITTEXT, (WPARAM)10, 0);
SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
SetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, setting, FALSE);
}
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_COUNTDOWNUNIT);
DWORD lastUnit = db_get_dw(NULL, "AutoShutdown", "CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_INITSTORAGE, _countof(unitNames), _countof(unitNames) * 16); /* approx. */
for (int i = 0; i < _countof(unitNames); ++i) {
int index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(unitNames[i]));
if (index != LB_ERR) {
SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)unitValues[i]);
if (i == 0 || unitValues[i] == lastUnit) SendMessage(hwndCombo, CB_SETCURSEL, index, 0);
}
}
}
{
DBVARIANT dbv;
if (!db_get_ts(NULL, "AutoShutdown", "Message", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_MESSAGE, dbv.ptszVal);
mir_free(dbv.ptszVal);
}
}
/* cpuusage threshold */
{
BYTE setting = DBGetContactSettingRangedByte(NULL, "AutoShutdown", "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETRANGE, 0, MAKELPARAM(100, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_CPUUSAGE, EM_SETLIMITTEXT, (WPARAM)3, 0);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
SetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, setting, FALSE);
}
/* shutdown types */
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_SHUTDOWNTYPE);
BYTE lastShutdownType = db_get_b(NULL, "AutoShutdown", "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
SendMessage(hwndCombo, CB_INITSTORAGE, SDSDT_MAX, SDSDT_MAX * 32);
for (BYTE shutdownType = 1; shutdownType <= SDSDT_MAX; ++shutdownType)
if (ServiceIsTypeEnabled(shutdownType, 0)) {
TCHAR *pszText = (TCHAR*)ServiceGetTypeDescription(shutdownType, GSTDF_TCHAR); /* never fails */
int index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)pszText);
if (index != LB_ERR) {
SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)shutdownType);
if (shutdownType == 1 || shutdownType == lastShutdownType) SendMessage(hwndCombo, CB_SETCURSEL, (WPARAM)index, 0);
}
}
SendMessage(hwndDlg, M_UPDATE_SHUTDOWNDESC, 0, (LPARAM)hwndCombo);
}
/* check if proto is installed that supports instant messages and check if a message dialog plugin is installed */
if (!AnyProtoHasCaps(PF1_IMRECV) || !ServiceExists(MS_MSG_SENDMESSAGE)) { /* no srmessage present? */
CheckDlgButton(hwndDlg, IDC_CHECK_MESSAGE, BST_UNCHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_MESSAGE), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_MESSAGE), FALSE);
}
/* check if proto is installed that supports file transfers and check if a file transfer dialog is available */
//.........这里部分代码省略.........
示例2: MAKELPARAM
// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
// style.
void wxNotebook::SetTabSize(const wxSize& sz)
{
::SendMessage(GetHwnd(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y));
}
示例3: Refresh
void wxNotebook::OnSize(wxSizeEvent& event)
{
if ( GetPageCount() == 0 )
{
// Prevents droppings on resize, but does cause some flicker
// when there are no pages.
Refresh();
event.Skip();
return;
}
#ifndef __WXWINCE__
else
{
// Without this, we can sometimes get droppings at the edges
// of a notebook, for example a notebook in a splitter window.
// This needs to be reconciled with the RefreshRect calls
// at the end of this function, which weren't enough to prevent
// the droppings.
wxSize sz = GetClientSize();
// Refresh right side
wxRect rect(sz.x-4, 0, 4, sz.y);
RefreshRect(rect);
// Refresh bottom side
rect = wxRect(0, sz.y-4, sz.x, 4);
RefreshRect(rect);
// Refresh left side
rect = wxRect(0, 0, 4, sz.y);
RefreshRect(rect);
}
#endif // !__WXWINCE__
// fit all the notebook pages to the tab control's display area
RECT rc;
rc.left = rc.top = 0;
GetSize((int *)&rc.right, (int *)&rc.bottom);
// save the total size, we'll use it below
int widthNbook = rc.right - rc.left,
heightNbook = rc.bottom - rc.top;
// there seems to be a bug in the implementation of TabCtrl_AdjustRect(): it
// returns completely false values for multiline tab controls after the tabs
// are added but before getting the first WM_SIZE (off by ~50 pixels, see
//
// http://sf.net/tracker/index.php?func=detail&aid=645323&group_id=9863&atid=109863
//
// and the only work around I could find was this ugly hack... without it
// simply toggling the "multiline" checkbox in the notebook sample resulted
// in a noticeable page displacement
if ( HasFlag(wxNB_MULTILINE) )
{
// avoid an infinite recursion: we get another notification too!
static bool s_isInOnSize = false;
if ( !s_isInOnSize )
{
s_isInOnSize = true;
SendMessage(GetHwnd(), WM_SIZE, SIZE_RESTORED,
MAKELPARAM(rc.right, rc.bottom));
s_isInOnSize = false;
}
// The best size depends on the number of rows of tabs, which can
// change when the notepad is resized.
InvalidateBestSize();
}
#if wxUSE_UXTHEME
// background bitmap size has changed, update the brush using it too
UpdateBgBrush();
#endif // wxUSE_UXTHEME
TabCtrl_AdjustRect(GetHwnd(), false, &rc);
int width = rc.right - rc.left,
height = rc.bottom - rc.top;
size_t nCount = m_pages.Count();
for ( size_t nPage = 0; nPage < nCount; nPage++ ) {
wxNotebookPage *pPage = m_pages[nPage];
pPage->SetSize(rc.left, rc.top, width, height);
}
// unless we had already repainted everything, we now need to refresh
if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) )
{
// invalidate areas not covered by pages
RefreshRect(wxRect(0, 0, widthNbook, rc.top), false);
RefreshRect(wxRect(0, rc.top, rc.left, height), false);
RefreshRect(wxRect(0, rc.bottom, widthNbook, heightNbook - rc.bottom),
false);
RefreshRect(wxRect(rc.right, rc.top, widthNbook - rc.right, height),
false);
}
//.........这里部分代码省略.........
示例4: __declspec
//.........这里部分代码省略.........
error="download incomplete";
else
{
bSuccess=TRUE;
error = "success";
}
} else {
if (get->get_status () == 0) {
// progressFunc ("Connecting ...", 0);
if (last_recv_time+timeout_ms < GetTickCount())
error = "Timed out on connecting.";
else
Sleep(10); // don't busy-loop while connecting
} else if (get->get_status () == 1) {
progress_callback("Reading headers", 0);
if (last_recv_time+timeout_ms < GetTickCount())
error = "Timed out on getting headers.";
else
Sleep(10); // don't busy-loop while reading headers
} else if (get->get_status () == 2) {
if (! has_printed_headers) {
has_printed_headers = 1;
last_recv_time=GetTickCount();
cl = get->content_length ();
if (cl == 0)
error = "Server did not specify content length.";
else if (g_hwndProgressBar) {
SendMessage(g_hwndProgressBar, PBM_SETRANGE, 0, MAKELPARAM(0, 30000));
g_file_size = cl;
}
}
int data_downloaded = 0;
while ((len = get->bytes_available ()) > 0) {
data_downloaded++;
if (len > 8192)
len = 8192;
len = get->get_bytes (buf, len);
if (len > 0) {
last_recv_time=GetTickCount();
DWORD dw;
WriteFile(hFile,buf,len,&dw,NULL);
sofar += len;
int time_sofar=(GetTickCount()-start_time)/1000;
int bps = (int)(sofar/(time_sofar?time_sofar:1));
int remain = MulDiv64(time_sofar, cl, sofar) - time_sofar;
if (translation_version == 2) {
char *rtext=remain==1?szSecond:szSeconds;;
if (remain >= 60)
{
remain/=60;
rtext=remain==1?szMinute:szMinutes;
if (remain >= 60)
{
remain/=60;
rtext=remain==1?szHour:szHours;
}
}
示例5: logThread
void logThread(void *dummy)
{
SetProcessPriorityBoost (GetCurrentProcess(),TRUE);
logWindow = CreateDialog(
HINSTANCE(GetModuleHandle(0)),
MAKEINTRESOURCE(IDD_LOG),
0, logDlgProc );
if (!logWindow) {
R_CHK (GetLastError());
};
SetWindowPos(logWindow,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);
hwLog = GetDlgItem(logWindow, IDC_LOG);
hwProgress = GetDlgItem(logWindow, IDC_PROGRESS);
hwInfo = GetDlgItem(logWindow, IDC_INFO);
hwStage = GetDlgItem(logWindow, IDC_STAGE);
hwTime = GetDlgItem(logWindow, IDC_TIMING);
hwPText = GetDlgItem(logWindow, IDC_P_TEXT);
hwPhaseTime = GetDlgItem(logWindow, IDC_PHASE_TIME);
SendMessage(hwProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 1000));
SendMessage(hwProgress, PBM_SETPOS, 0, 0);
Msg("\"LevelBuilder v4.1\" beta build\nCompilation date: %s\n",__DATE__);
{
char tmpbuf[128];
Msg("Startup time: %s",_strtime(tmpbuf));
}
BOOL bHighPriority = FALSE;
string256 u_name;
unsigned long u_size = sizeof(u_name)-1;
GetUserName (u_name,&u_size);
_strlwr (u_name);
if ((0==xr_strcmp(u_name,"oles"))||(0==xr_strcmp(u_name,"alexmx"))) bHighPriority = TRUE;
// Main cycle
u32 LogSize = 0;
float PrSave = 0;
while (TRUE)
{
SetPriorityClass (GetCurrentProcess(),IDLE_PRIORITY_CLASS); // bHighPriority?NORMAL_PRIORITY_CLASS:IDLE_PRIORITY_CLASS
// transfer data
while (!csLog.TryEnter()) {
_process_messages ( );
Sleep (1);
}
if (progress>1.f) progress = 1.f;
else if (progress<0) progress = 0;
BOOL bWasChanges = FALSE;
char tbuf [256];
csLog.Enter ();
if (LogSize!=LogFile->size())
{
bWasChanges = TRUE;
for (; LogSize<LogFile->size(); LogSize++)
{
const char *S = *(*LogFile)[LogSize];
if (0==S) S = "";
SendMessage ( hwLog, LB_ADDSTRING, 0, (LPARAM) S);
}
SendMessage ( hwLog, LB_SETTOPINDEX, LogSize-1, 0);
FlushLog ( );
}
csLog.Leave ();
if (_abs(PrSave-progress)>EPS_L) {
bWasChanges = TRUE;
PrSave = progress;
SendMessage ( hwProgress, PBM_SETPOS, u32(progress*1000.f), 0);
// timing
if (progress>0.005f) {
u32 dwCurrentTime = timeGetTime();
u32 dwTimeDiff = dwCurrentTime-phase_start_time;
u32 secElapsed = dwTimeDiff/1000;
u32 secRemain = u32(float(secElapsed)/progress)-secElapsed;
sprintf(tbuf,
"Elapsed: %s\n"
"Remain: %s",
make_time(secElapsed).c_str(),
make_time(secRemain).c_str()
);
SetWindowText ( hwTime, tbuf );
} else {
SetWindowText ( hwTime, "" );
}
// percentage text
sprintf(tbuf,"%3.2f%%",progress*100.f);
SetWindowText ( hwPText, tbuf );
}
if (bStatusChange) {
bWasChanges = TRUE;
bStatusChange = FALSE;
SetWindowText ( hwInfo, status);
}
if (bWasChanges) {
//.........这里部分代码省略.........
示例6: WinMain
/**
* Program start point, build the windows GUI, initialise the emulator.
* Enter the program main loop, and tidy up when finished.
*/
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
static const char szClassName[] = "WindowsApp";
MSG messages = {0}; /**< Here messages to the application are saved */
WNDCLASSEX wincl; /**< Data structure for the windowclass */
hinstance=hThisInstance;
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use custom icon and default mouse-pointer */
wincl.hIcon = LoadIcon(hThisInstance, "allegro_icon");
wincl.hIconSm = LoadIcon(hThisInstance, "allegro_icon");
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* Load Menu from resources file */
menu=LoadMenu(hThisInstance,TEXT("MainMenu"));
/* Add in CDROM links to the settings menu dynamically */
initmenu();
/* The class is registered, let's create the program*/
ghwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"RPCEmu v" VERSION, /* Title Text */
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, /* overlapped window with no sizing frame */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
640 + (GetSystemMetrics(SM_CXFIXEDFRAME) * 2), /* The window width */
480 + (GetSystemMetrics(SM_CYFIXEDFRAME) * 2) + GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CYCAPTION), /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
menu, /* Menu handle */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
ShowWindow (ghwnd, nFunsterStil);
win_set_window(ghwnd);
allegro_init(); /* allegro */
/* Allegro does not appear to read the window position until it
receives a window move message. This results in the mousehack
pointer being offset incorrectly until the window is moved.
To workaround this issue, we generate a window move message to the
window's current position.
*/
{
WINDOWINFO wi;
GetWindowInfo(ghwnd, &wi);
PostMessage(ghwnd, WM_MOVE, 0, MAKELPARAM(wi.rcClient.left, wi.rcClient.top));
}
/* Initialise the emulation and read the config file */
if (startrpcemu())
return -1;
/* Initialise the podules */
opendlls();
/* Based on the contents of config file, dynamically update the Windows GUI items */
if (config.cdromtype > 2) {
WindowProcedure(ghwnd, WM_COMMAND, IDM_CDROM_DISABLED + config.cdromtype, 0);
}
CheckMenuItem(menu, IDM_CDROM_DISABLED + config.cdromtype, MF_CHECKED);
CheckMenuItem(menu, IDM_MOUSE_TWOBUTTON,
config.mousetwobutton ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(menu, IDM_CPUIDLE,
config.cpu_idle ? MF_CHECKED : MF_UNCHECKED);
if (config.mousehackon) {
CheckMenuItem(menu, IDM_MOUSE_FOL, MF_CHECKED);
} else {
//.........这里部分代码省略.........
示例7: MyMessageBoxProc
//.........这里部分代码省略.........
// ボタン 2
if(nButtonNum >= 2){
if(uMskType == MB_DEFBUTTON2)
dwStyle = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP;
else dwStyle = WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP;
if(bOwnerDraw) dwStyle |= BS_OWNERDRAW;
CreateWindow("BUTTON","bt2",dwStyle,x2,y,MSGBOXBTWIDTH,MSGBOXBTHEIGHT,hWnd,(HMENU)IDC_BT2,hInst,NULL);
}
// ボタン 3
if(nButtonNum == 3){
if(uMskType == MB_DEFBUTTON3)
dwStyle = WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON|WS_TABSTOP;
else dwStyle = WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|WS_TABSTOP;
if(bOwnerDraw) dwStyle |= BS_OWNERDRAW;
CreateWindow("BUTTON","bt3",dwStyle,x3,y,MSGBOXBTWIDTH,MSGBOXBTHEIGHT,hWnd,(HMENU)IDC_BT3,hInst,NULL);
}
// ボタン用フォント作成
if(!bOwnerDraw) hFont=CreateFont(10,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,DEFAULT_CHARSET
,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"MS Pゴシック");
// ボタンにフォントと文字セット
hWndBt[0] = GetDlgItem(hWnd,IDC_BT1);
hWndBt[1] = GetDlgItem(hWnd,IDC_BT2);
hWndBt[2] = GetDlgItem(hWnd,IDC_BT3);
for(i=0;i<3;i++)
{
// フォントセット
if(!bOwnerDraw) SendMessage(hWndBt[i],WM_SETFONT,(WPARAM)hFont,(LPARAM)MAKELPARAM(TRUE,0));
SetWindowText(hWndBt[i],szBtStr[i]);
}
// フォーカス移動
switch(uMskType){
case MB_DEFBUTTON2:
uCurFocus = IDC_BT2;
SetFocus(hWndBt[1]);
break;
case MB_DEFBUTTON3:
uCurFocus = IDC_BT3;
SetFocus(hWndBt[2]);
break;
default:
uCurFocus = IDC_BT1;
SetFocus(hWndBt[0]);
}
// 中心移動
SetDlgCenter(hWnd);
// forgrand
if(lpMsgBoxData->uType & MB_SETFOREGROUND) SetForegroundWindow(hWnd);
break;
case WM_CTLCOLORDLG: // 背景色を変えたい場合
示例8: window_proc
NOEXPORT LRESULT CALLBACK window_proc(HWND main_window_handle,
UINT message, WPARAM wParam, LPARAM lParam) {
NOTIFYICONDATA nid;
POINT pt;
RECT rect;
SERVICE_OPTIONS *section;
unsigned int section_number;
#if 0
if(message!=WM_CTLCOLORSTATIC && message!=WM_TIMER)
s_log(LOG_DEBUG, "Window message: %d", message);
#endif
switch(message) {
case WM_CREATE:
#ifdef _WIN32_WCE
/* create command bar */
command_bar_handle=CommandBar_Create(ghInst, main_window_handle, 1);
if(!command_bar_handle)
error_box("CommandBar_Create");
if(!CommandBar_InsertMenubar(command_bar_handle, ghInst, IDM_MAINMENU, 0))
error_box("CommandBar_InsertMenubar");
if(!CommandBar_AddAdornments(command_bar_handle, 0, 0))
error_box("CommandBar_AddAdornments");
#endif
/* create child edit window */
edit_handle=CreateWindow(TEXT("EDIT"), NULL,
WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|ES_MULTILINE|ES_READONLY,
0, 0, 0, 0, main_window_handle, (HMENU)IDE_EDIT, ghInst, NULL);
#ifndef _WIN32_WCE
SendMessage(edit_handle, WM_SETFONT,
(WPARAM)CreateFont(-12, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
DEFAULT_CHARSET, OUT_RASTER_PRECIS, CLIP_DEFAULT_PRECIS,
PROOF_QUALITY, DEFAULT_PITCH, TEXT("Courier")),
MAKELPARAM(FALSE, 0)); /* no need to redraw right, now */
#endif
/* NOTE: there's no return statement here -> proceeding with resize */
case WM_SIZE:
GetClientRect(main_window_handle, &rect);
#ifdef _WIN32_WCE
MoveWindow(edit_handle, 0, CommandBar_Height(command_bar_handle),
rect.right, rect.bottom-CommandBar_Height(command_bar_handle), TRUE);
#else
MoveWindow(edit_handle, 0, 0, rect.right, rect.bottom, TRUE);
#endif
UpdateWindow(edit_handle);
/* CommandBar_Show(command_bar_handle, TRUE); */
return TRUE;
case WM_SETFOCUS:
SetFocus(edit_handle);
return TRUE;
case WM_TIMER:
if(visible)
update_logs();
return TRUE;
case WM_CLOSE:
ShowWindow(main_window_handle, SW_HIDE);
return TRUE;
case WM_SHOWWINDOW:
visible=wParam; /* setup global variable */
if(tray_menu_handle)
CheckMenuItem(tray_menu_handle, IDM_SHOW_LOG,
visible ? MF_CHECKED : MF_UNCHECKED);
if(visible)
update_logs();
return TRUE;
case WM_DESTROY:
#ifdef _WIN32_WCE
CommandBar_Destroy(command_bar_handle);
#else
if(main_menu_handle)
DestroyMenu(main_menu_handle);
#endif
if(tray_menu_handle)
DestroyMenu(tray_menu_handle);
ZeroMemory(&nid, sizeof nid);
nid.cbSize=sizeof nid;
nid.hWnd=main_window_handle;
nid.uID=1;
nid.uFlags=NIF_TIP; /* not really sure what to put here, but it works */
Shell_NotifyIcon(NIM_DELETE, &nid); /* this removes the icon */
PostQuitMessage(0);
KillTimer(main_window_handle, 0x29a);
return TRUE;
case WM_COMMAND:
if(wParam>=IDM_PEER_MENU && wParam<IDM_PEER_MENU+number_of_sections) {
for(section=service_options.next, section_number=0;
section && wParam!=IDM_PEER_MENU+section_number;
section=section->next, ++section_number)
;
if(!section)
return TRUE;
if(save_text_file(section->file, section->chain))
//.........这里部分代码省略.........
示例9: SendMessage
/////////////////////////////////////////////////////////////////////////////
//
//Method......: OnLButtonDblClk
//Class.......: CHSShadeButton
//
//Author......: Milan Gardian
//Created.....: MAR-2001
//
//Return value: NONE
//Parameters..: Used only to be forwarded as WM_LBUTTONDOWN message parameters
//Exceptions..: NONE
//------------
//Description :
//
// > We do not care about doublelicks - handle this event
// like an ordinary left-button-down event
//
//---------------------------------------------------------
void CHSShadeButton::OnLButtonDblClk(UINT flags, CPoint point)
{
SendMessage(WM_LBUTTONDOWN, flags, MAKELPARAM(point.x, point.y));
}
示例10: if
LRESULT CComboWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if( uMsg == WM_CREATE ) {
m_pm.SetForceUseSharedRes(true);
m_pm.Init(m_hWnd);
// The trick is to add the items to the new container. Their owner gets
// reassigned by this operation - which is why it is important to reassign
// the items back to the righfull owner/manager when the window closes.
m_pLayout = new CVerticalLayoutUI;
m_pLayout->SetManager(&m_pm, NULL, true);
LPCTSTR pDefaultAttributes = m_pOwner->GetManager()->GetDefaultAttributeList(_T("VerticalLayout"));
if( pDefaultAttributes ) {
m_pLayout->ApplyAttributeList(pDefaultAttributes);
}
m_pLayout->SetInset(CDuiRect(1, 1, 1, 1));
m_pLayout->SetBkColor(0xFFFFFFFF);
m_pLayout->SetBorderColor(0xFFC6C7D2);
m_pLayout->SetBorderSize(1);
m_pLayout->SetAutoDestroy(false);
m_pLayout->EnableScrollBar();
m_pLayout->ApplyAttributeList(m_pOwner->GetDropBoxAttributeList());
for( int i = 0; i < m_pOwner->GetCount(); i++ ) {
m_pLayout->Add(static_cast<CControlUI*>(m_pOwner->GetItemAt(i)));
}
m_pm.AttachDialog(m_pLayout);
m_pm.AddNotifier(this);
return 0;
}
else if( uMsg == WM_CLOSE ) {
m_pOwner->SetManager(m_pOwner->GetManager(), m_pOwner->GetParent(), false);
RECT rcNull = { 0 };
for( int i = 0; i < m_pOwner->GetCount(); i++ ) static_cast<CControlUI*>(m_pOwner->GetItemAt(i))->SetPos(rcNull);
m_pOwner->SetFocus();
}
else if( uMsg == WM_LBUTTONUP ) {
POINT pt = { 0 };
::GetCursorPos(&pt);
::ScreenToClient(m_pm.GetPaintWindow(), &pt);
CControlUI* pControl = m_pm.FindControl(pt);
if( pControl && _tcsicmp(pControl->GetClass(), _T("ScrollBarUI")) != 0 ) PostMessage(WM_KILLFOCUS);
}
else if( uMsg == WM_KEYDOWN ) {
switch( wParam ) {
case VK_ESCAPE:
m_pOwner->SelectItem(m_iOldSel, true);
EnsureVisible(m_iOldSel);
case VK_RETURN:
PostMessage(WM_KILLFOCUS);
break;
default:
TEventUI event;
event.Type = UIEVENT_KEYDOWN;
event.chKey = (TCHAR)wParam;
m_pOwner->DoEvent(event);
EnsureVisible(m_pOwner->GetCurSel());
return 0;
}
}
else if( uMsg == WM_MOUSEWHEEL ) {
int zDelta = (int) (short) HIWORD(wParam);
TEventUI event = { 0 };
event.Type = UIEVENT_SCROLLWHEEL;
event.wParam = MAKELPARAM(zDelta < 0 ? SB_LINEDOWN : SB_LINEUP, 0);
event.lParam = lParam;
event.dwTimestamp = ::GetTickCount();
m_pOwner->DoEvent(event);
EnsureVisible(m_pOwner->GetCurSel());
return 0;
}
else if( uMsg == WM_KILLFOCUS ) {
if( m_hWnd != (HWND) wParam ) PostMessage(WM_CLOSE);
}
LRESULT lRes = 0;
if( m_pm.MessageHandler(uMsg, wParam, lParam, lRes) ) return lRes;
return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
示例11: TRACE
//.........这里部分代码省略.........
}
else
{
m_menuBar = NULL;
}
// Remove the old hooks if the menu type changed, or we don't have a menu anymore
if (old && (!m_current || old->type != m_current->type))
{
if (m_current && m_current->type != TrackedMenuEntry)
{
DisableMouseTrack(m_current->hwnd, FALSE);
}
hr = RemoveHooks();
if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
// And place new ones if necessary
if (m_current && (!old || old->type != m_current->type))
{
hr = PlaceHooks();
if (FAILED_UNEXPECTEDLY(hr))
return hr;
}
// Give the user a chance to move the mouse to the new menu
if (m_parent)
{
DisableMouseTrack(m_parent->hwnd, TRUE);
}
if (m_current && m_current->type == MenuPopupEntry)
{
if (m_captureHwnd == NULL)
{
// We need to restore the capture after a non-shell submenu or context menu is shown
StackEntry * topMenu = m_bandStack;
if (topMenu->type == MenuBarEntry)
topMenu++;
// Get the top-level window from the top popup
CComPtr<IServiceProvider> bandSite;
CComPtr<IOleWindow> deskBar;
hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider, &bandSite));
if (FAILED(hr))
goto NoCapture;
hr = bandSite->QueryService(SID_SMenuPopup, IID_PPV_ARG(IOleWindow, &deskBar));
if (FAILED(hr))
goto NoCapture;
CComPtr<IOleWindow> deskBarSite;
hr = IUnknown_GetSite(deskBar, IID_PPV_ARG(IOleWindow, &deskBarSite));
if (FAILED(hr))
goto NoCapture;
// FIXME: Find the correct place for this
HWND hWndOwner;
hr = deskBarSite->GetWindow(&hWndOwner);
if (FAILED(hr))
goto NoCapture;
m_PreviousForeground = ::GetForegroundWindow();
if (m_PreviousForeground != hWndOwner)
::SetForegroundWindow(hWndOwner);
else
m_PreviousForeground = NULL;
// Get the HWND of the top-level window
HWND hWndSite;
hr = deskBar->GetWindow(&hWndSite);
if (FAILED(hr))
goto NoCapture;
SetMenuCapture(hWndSite);
}
NoCapture:
if (!m_parent || m_parent->type == MenuBarEntry)
{
if (old && old->type == TrackedMenuEntry)
{
// FIXME: Debugging code, probably not right
POINT pt2;
RECT rc2;
GetCursorPos(&pt2);
ScreenToClient(m_current->hwnd, &pt2);
GetClientRect(m_current->hwnd, &rc2);
if (PtInRect(&rc2, pt2))
SendMessage(m_current->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(pt2.x, pt2.y));
else
SendMessage(m_current->hwnd, WM_MOUSELEAVE, 0, 0);
}
}
}
_ASSERT(!m_parent || m_parent->type != TrackedMenuEntry);
return S_OK;
}
示例12: GET_X_LPARAM
LRESULT CMenuFocusManager::ProcessMouseMove(MSG* msg)
{
HWND child;
int iHitTestResult = -1;
POINT pt2 = { GET_X_LPARAM(msg->lParam), GET_Y_LPARAM(msg->lParam) };
ClientToScreen(msg->hwnd, &pt2);
// Don't do anything if the mouse has not been moved
POINT pt = msg->pt;
if (pt.x == m_ptPrev.x && pt.y == m_ptPrev.y)
return TRUE;
// Don't do anything if another window is capturing the mouse.
HWND cCapture = ::GetCapture();
if (cCapture && cCapture != m_captureHwnd && m_current->type != TrackedMenuEntry)
return TRUE;
m_movedSinceDown = TRUE;
m_ptPrev = pt;
child = WindowFromPoint(pt);
StackEntry * entry = NULL;
if (IsTrackedWindow(child, &entry) == S_OK)
{
TRACE("MouseMove %d\n", m_isLButtonDown);
}
BOOL isTracking = FALSE;
if (entry && (entry->type == MenuBarEntry || m_current->type != TrackedMenuEntry))
{
ScreenToClient(child, &pt);
iHitTestResult = SendMessageW(child, TB_HITTEST, 0, (LPARAM) &pt);
isTracking = entry->mb->_IsTracking();
if (SendMessage(child, WM_USER_ISTRACKEDITEM, iHitTestResult, 0) == S_FALSE)
{
// The current tracked item has changed, notify the toolbar
TRACE("Hot item tracking detected a change (capture=%p / cCapture=%p)...\n", m_captureHwnd, cCapture);
DisableMouseTrack(NULL, FALSE);
if (isTracking && iHitTestResult >= 0 && m_current->type == TrackedMenuEntry)
SendMessage(entry->hwnd, WM_CANCELMODE, 0, 0);
PostMessage(child, WM_USER_CHANGETRACKEDITEM, iHitTestResult, MAKELPARAM(isTracking, TRUE));
if (m_current->type == TrackedMenuEntry)
return FALSE;
}
}
if (m_entryUnderMouse != entry)
{
// Mouse moved away from a tracked window
if (m_entryUnderMouse)
{
m_entryUnderMouse->mb->_ChangeHotItem(NULL, -1, HICF_MOUSE);
}
}
if (m_hwndUnderMouse != child)
{
if (entry)
{
// Mouse moved to a tracked window
if (m_current->type == MenuPopupEntry)
{
ScreenToClient(child, &pt2);
SendMessage(child, WM_MOUSEMOVE, msg->wParam, MAKELPARAM(pt2.x, pt2.y));
}
}
m_hwndUnderMouse = child;
m_entryUnderMouse = entry;
}
if (m_current->type == MenuPopupEntry)
{
HWND parent = GetAncestor(child, GA_ROOT);
DisableMouseTrack(parent, FALSE);
}
return TRUE;
}
示例13: ListWndInfoApply
static int ListWndInfoApply(void)
{
RECT rc;
HFONT hFontPre = NULL;
DWORD fdwPitch = (ListWndInfo.fontFlags&FONT_FLAGS_FIXED)?FIXED_PITCH:VARIABLE_PITCH;
DWORD fdwItalic = (ListWndInfo.fontFlags&FONT_FLAGS_ITALIC)?TRUE:FALSE;
HFONT hFont =
CreateFont(ListWndInfo.fontHeight,ListWndInfo.fontWidth,0,0,FW_DONTCARE,fdwItalic,FALSE,FALSE,
DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
fdwPitch | FF_DONTCARE,ListWndInfo.fontName);
if(hFont != NULL){
hFontPre = ListWndInfo.hFontListBox;
ListWndInfo.hFontListBox = hFont;
SendMessage(ListWndInfo.hwndListBox,WM_SETFONT,(WPARAM)ListWndInfo.hFontListBox,(LPARAM)MAKELPARAM(TRUE,0));
}
GetWindowRect(ListWndInfo.hwnd,&rc);
MoveWindow(ListWndInfo.hwnd,rc.left,rc.top,ListWndInfo.Width,ListWndInfo.Height,TRUE);
// InvalidateRect(hwnd,&rc,FALSE);
// UpdateWindow(hwnd);
if(hFontPre!=NULL) CloseHandle(hFontPre);
INISaveListWnd();
return 0;
}
示例14: GROUP_GroupWndProc
static
LRESULT
CALLBACK
GROUP_GroupWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PROGGROUP* group;
INT iItem;
LVITEMW lvItem;
POINT pt;
group = (PROGGROUP*)GetWindowLongPtrW(hWnd, 0);
switch (uMsg)
{
case WM_NCCREATE:
{
LPCREATESTRUCTW pcs = (LPCREATESTRUCTW)lParam;
LPMDICREATESTRUCTW pMDIcs = (LPMDICREATESTRUCTW)pcs->lpCreateParams;
group = (PROGGROUP*)pMDIcs->lParam;
SetWindowLongPtrW(hWnd, 0, (LONG_PTR)group);
if (group->bIsCommonGroup)
{
DefMDIChildProcW(hWnd, WM_SETICON, ICON_BIG,
(LPARAM)CopyImage(Globals.hCommonGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_COPYFROMRESOURCE));
DefMDIChildProcW(hWnd, WM_SETICON, ICON_SMALL,
(LPARAM)CopyImage(Globals.hCommonGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_COPYFROMRESOURCE));
}
else
{
DefMDIChildProcW(hWnd, WM_SETICON, ICON_BIG,
(LPARAM)CopyImage(Globals.hPersonalGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_COPYFROMRESOURCE));
DefMDIChildProcW(hWnd, WM_SETICON, ICON_SMALL,
(LPARAM)CopyImage(Globals.hPersonalGroupIcon,
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_COPYFROMRESOURCE));
}
break;
}
case WM_NCDESTROY:
SetWindowLongPtrW(hWnd, 0, 0);
break;
case WM_CREATE:
{
DWORD dwStyle;
RECT rect;
GetClientRect(hWnd, &rect);
group->hListView = CreateWindowW(WC_LISTVIEW,
NULL,
WS_CHILD | WS_VISIBLE | WS_OVERLAPPED,
0, 0,
rect.right - rect.left,
rect.bottom - rect.top,
hWnd,
NULL,
Globals.hInstance,
NULL);
dwStyle = (GetWindowLongPtrW(group->hListView, GWL_STYLE) | LVS_SHOWSELALWAYS) & ~LVS_AUTOARRANGE;
SetWindowLongPtrW(group->hListView, GWL_STYLE, dwStyle);
dwStyle = SendMessageA(group->hListView, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0) | LVS_EX_BORDERSELECT;
SendMessageA(group->hListView, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_SNAPTOGRID, dwStyle);
InitUxTheme();
SetWindowTheme(group->hListView, L"Explorer", NULL);
group->hListLarge = ImageList_Create(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), ILC_COLOR24 | ILC_MASK, 1, 1);
SendMessageA(group->hListView, LVM_SETIMAGELIST, 0, (LPARAM)group->hListLarge);
SendMessageA(group->hListView, LVM_SETICONSPACING, 0, MAKELPARAM(80, 64));
break;
}
case WM_DESTROY:
{
SendMessageA(group->hListView, LVM_SETIMAGELIST, 0, 0);
ImageList_Destroy(group->hListLarge);
DestroyWindow(group->hListView);
break;
}
case WM_SIZE:
{
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = LOWORD(lParam);
rect.bottom = HIWORD(lParam);
//.........这里部分代码省略.........
示例15: PostMessage
void CMainUIDlg::MoveMainDlg(int iArg1 , int iArg2)
{
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(iArg1,iArg2));
return;
}