本文整理汇总了C++中MPFROM2SHORT函数的典型用法代码示例。如果您正苦于以下问题:C++ MPFROM2SHORT函数的具体用法?C++ MPFROM2SHORT怎么用?C++ MPFROM2SHORT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MPFROM2SHORT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSysMenu
/*
*
* SetSysMenu
*
* DESCRIPTION:
*
* Set dialog box so only move and close are active.
*
*/
static VOID
SetSysMenu( HWND hDlg)
{
HWND hSysMenu;
MENUITEM Mi;
ULONG Pos;
MRESULT Id;
SHORT cItems;
/******************************************************************/
/* We only want Move and Close in the system menu. */
/******************************************************************/
hSysMenu = WinWindowFromID(hDlg, FID_SYSMENU);
WinSendMsg( hSysMenu, MM_QUERYITEM
, MPFROM2SHORT(SC_SYSMENU, FALSE), MPFROMP((PCH) & Mi));
Pos = 0L;
cItems = (SHORT)WinSendMsg( Mi.hwndSubMenu, MM_QUERYITEMCOUNT,
(MPARAM)NULL, (MPARAM)NULL);
while( cItems--){
Id = WinSendMsg( Mi.hwndSubMenu, MM_ITEMIDFROMPOSITION
, MPFROMLONG(Pos), (MPARAM)NULL);
switch (SHORT1FROMMR(Id))
{
case SC_MOVE:
case SC_CLOSE:
Pos++; /* Don't delete that one. */
break;
default:
WinSendMsg( Mi.hwndSubMenu, MM_DELETEITEM
, MPFROM2SHORT((USHORT)Id, TRUE), (MPARAM)NULL);
}
}
}
示例2: CheckHost
PMINIRECORDCORE
CheckHost(char *_Host)
{
PNAMEENTRY pRecord;
char locbuf[512];
sprintf(locbuf, "Checking Host for duplicate [%-100.100s]", _Host);
MsgLog(locbuf);
/* Get first item NAMES_CONTAINER Container */
pRecord=(PNAMEENTRY)WinSendDlgItemMsg(sHwnd, sID,
CM_QUERYRECORD,
MPFROMP(0), /* pointer to reference record */
MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
while (pRecord) {
if (pRecord->pszHost[0] == _Host[0] && strcmp(pRecord->pszHost, _Host) == 0)
return((PMINIRECORDCORE)pRecord);
sprintf(locbuf, "pRecord [%100.100s] Next->%x", pRecord->pszHost, pRecord->Record.preccNextRecord);
MsgLog(locbuf);
pRecord=(PNAMEENTRY)WinSendDlgItemMsg(sHwnd, sID,
CM_QUERYRECORD,
MPFROMP(pRecord), /* pointer to reference record */
MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
// pRecord = (PNAMEENTRY)pRecord->Record.preccNextRecord;
} /* endwhile */
return(0);
}
示例3: wpCTTrack
MRESULT EXPENTRY wpCTTrack(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
{
switch(msg)
{
case WM_CHAR:
{
SHORT fsflags = SHORT1FROMMP(mp1);
SHORT usvkey = SHORT2FROMMP(mp2);
if(fsflags & KC_KEYUP) break;
if((fsflags & KC_SHIFT) && (usvkey == VK_F10))
{
RECORDCORE *record;
record = searchRecords(hwnd, 0, (RECORDCORE *) CMA_FIRST, CRA_SELECTED);
processPopUp(WinQueryWindow(hwnd, QW_PARENT), WinQueryWindowUShort(hwnd,QWS_ID),
record, PUM_CDRECORD, PUM_CDCONTAINER, &sourceEmphasisInfo);
WinSendMsg(sourceEmphasisInfo.PUMHwnd, MM_SETITEMATTR,
MPFROM2SHORT(IDM_MINIICONS, FALSE),
MPFROM2SHORT(MIA_CHECKED, miniIcons ? MIA_CHECKED : 0));
return 0;
}
else if((fsflags & KC_SHIFT) && (usvkey == VK_F9))
{
CNREDITDATA editdata;
CNRINFO cnrInfo;
WinSendMsg(hwnd,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),MPFROMLONG(sizeof(cnrInfo)));
editdata.cb = sizeof(editdata);
editdata.hwndCnr = hwnd;
editdata.pRecord = searchRecords(hwnd, 0, (RECORDCORE *) CMA_FIRST, CRA_CURSORED);
editdata.ppszText = NULL;
editdata.cbText = 0;
if(cnrInfo.flWindowAttr & CV_DETAIL)
{
editdata.pFieldInfo = (FIELDINFO*) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPFROMP(NULL), MPFROMSHORT(CMA_FIRST));
editdata.pFieldInfo = (FIELDINFO*) WinSendMsg(hwnd, CM_QUERYDETAILFIELDINFO, MPFROMP(editdata.pFieldInfo), MPFROMSHORT(CMA_NEXT));
editdata.id = CID_LEFTDVWND;
}
else
{
editdata.pFieldInfo = NULL;
editdata.id = WinQueryWindowUShort(hwnd,QWS_ID);
}
WinSendMsg(hwnd,CM_OPENEDIT,MPFROMP(&editdata),0);
return 0;
}
break;
}
}
return wpCT( hwnd, msg, mp1, mp2 );
}
示例4: GetHMenuOf
void wxMenuItem::Enable(
bool bEnable
)
{
bool bOk;
if (m_isEnabled == bEnable)
return;
if (bEnable)
bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
,MM_SETITEMATTR
,MPFROM2SHORT(GetRealId(), TRUE)
,MPFROM2SHORT(MIA_DISABLED, FALSE)
);
else
bOk = (bool)::WinSendMsg( GetHMenuOf(m_parentMenu)
,MM_SETITEMATTR
,MPFROM2SHORT(GetRealId(), TRUE)
,MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED)
);
if (!bOk)
{
wxLogLastError(wxT("EnableMenuItem"));
}
wxMenuItemBase::Enable(bEnable);
} // end of wxMenuItem::Enable
示例5: WinCheckButton
void NextBarDlg::setButtons()
{
ULONG usTemp;
for(usTemp=0; usTemp<=(sizeof(usSessionTypeRBs)/sizeof(ULONG)); usTemp++)
if(usSessionTypeIDs[usTemp] == event->session) {
WinCheckButton(hwnd, usSessionTypeRBs[usTemp], TRUE);
WinSendMsg(hwnd, WM_CONTROL, MPFROM2SHORT(usSessionTypeRBs[usTemp], BN_CLICKED), NULL); }
switch(event->session)
{
case PROG_WINDOW_REAL:
case PROG_WINDOW_PROT:
case PROG_31_ENH:
for(usTemp=0; usTemp<=(sizeof(usChild2WINOS2)/sizeof(ULONG)); usTemp++)
if(usWINOS2TypeIDs[usTemp] == event->session)
WinCheckButton(hwnd, usChild2WINOS2[usTemp], TRUE);
WinCheckButton(hwnd, NHX_SEAMLESS, TRUE);
WinSendMsg(hwnd, WM_CONTROL, MPFROM2SHORT(NHX_SEAMLESS, BN_CLICKED), NULL);
break;
default:
WinCheckButton(hwnd, NHX_WINSTD, TRUE);
break;
}
if(event->session == SSF_TYPE_WPSOBJECT) {
OCL::disableControls(hwnd, usChild2WINOS2, sizeof(usChild2WINOS2));
OCL::hideControls(hwnd, WPSOControls, sizeof(WPSOControls)); }
}
示例6: MainSize
MRESULT MainSize(HWND hwnd, /* handle to the main client window */
SHORT sTotalMsgs,
MPARAM mp1, /* first parameter of WM_SIZE message */
MPARAM mp2) /* second parameter of WM_SIZE message */
{
cxClient = SHORT1FROMMP (mp2) ;
cyClient = SHORT2FROMMP (mp2) ;
sHscrollMax = max (0, cxTextTotal - cxClient) ;
sHscrollPos = min (sHscrollPos, sHscrollMax) ;
WinSendMsg (hwndHscroll, SBM_SETSCROLLBAR,
MPFROM2SHORT (sHscrollPos, 0),
MPFROM2SHORT (0, sHscrollMax)) ;
WinEnableWindow (hwndHscroll, (BOOL)((sHscrollMax != 0) ? TRUE : FALSE)) ;
sVscrollMax = max (0, sTotalMsgs - cyClient / cyChar) ;
sVscrollPos = min (sVscrollPos, sVscrollMax) ;
WinSendMsg (hwndVscroll, SBM_SETSCROLLBAR,
MPFROM2SHORT (sVscrollPos, 0),
MPFROM2SHORT (0, sVscrollMax)) ;
WinEnableWindow (hwndVscroll, (BOOL)((sVscrollMax != 0) ? TRUE : FALSE)) ;
return (MRFROMLONG(0));
}
示例7: while
// given an item, move it up in the container
void Container::moveUp(UserData *ud)
{
PRECORDCORE parent,parents_parent;
array<PRECORDCORE> children;
int num_children=0;
parent = (PRECORDCORE)WinSendMsg(cont,CM_QUERYRECORD,MPFROMP(ud),MPFROM2SHORT(CMA_PREV,CMA_ITEMORDER));
if (parent)
{
// if there is any children associated with this record we must save them
children[0] = (PRECORDCORE)WinSendMsg(cont,CM_QUERYRECORD,MPFROMP(ud),MPFROM2SHORT(CMA_FIRSTCHILD,CMA_ITEMORDER));
if (children[0] != NULL)
{
num_children = 1;
PRECORDCORE next;
do
{
next = (PRECORDCORE)WinSendMsg(cont,CM_QUERYRECORD,MPFROMP(children[num_children-1]),MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
if (next != NULL)
{
children[num_children] = next;
num_children++;
}
} while (next != NULL);
}
parents_parent = (PRECORDCORE)WinSendMsg(cont,CM_QUERYRECORD,MPFROMP(parent),MPFROM2SHORT(CMA_PREV,CMA_ITEMORDER));
if (parents_parent == NULL)
parents_parent = (PRECORDCORE)CMA_FIRST;
// remove but don't delete
WinSendMsg(cont,CM_REMOVERECORD,MPFROMP(&ud),MPFROM2SHORT(1,0));
RECORDINSERT ri;
memset(&ri,0,sizeof(RECORDINSERT));
ri.cb = sizeof(RECORDINSERT);
if (!ud->getParent() || !ud->getParent()->getCollapsed())
ri.fInvalidateRecord = FALSE; // TRUE;
ri.pRecordParent = (PRECORDCORE)ud->getParent();
ri.pRecordOrder = (RECORDCORE*)parents_parent;
ri.cRecordsInsert = 1; // number of records to insert
// re-insert
WinSendMsg(cont,CM_INSERTRECORD,MPFROMP((PRECORDCORE)ud),MPFROMP(&ri));
if (num_children > 0)
{
ri.pRecordParent = (PRECORDCORE)ud;
ri.pRecordOrder = (RECORDCORE*)CMA_END;
for (int i=0; i<num_children; i++)
{
WinSendMsg(cont,CM_INSERTRECORD,MPFROMP(children[i]),MPFROMP(&ri));
}
}
setItemFocus(ud);
}
}
示例8: InitLineBits
APIRET InitLineBits(HWND hwnd)
{
APIRET rc;
ULONG DataPacketLen;
rc = DosDevIOCtl (HandleComm,
IOCTL_ASYNC,
ASYNC_GETLINECTRL,
NULL, //no parameter packet
0, // = 0
NULL, // length of parm packet
(PULONG) &DataPacket,
sizeof(DataPacket),
&DataPacketLen);
rc = DosDevIOCtl (HandleComm,
IOCTL_ASYNC,
ASYNC_GETLINECTRL,
NULL, //no parameter packet
0, // = 0
NULL, // length of parm packet
(PULONG) &DataPacket,
sizeof(DataPacket),
&DataPacketLen);
if (rc)
{
sprintf(PrintBuf,"RC=%u Line=%u\nFile: %s",rc,__LINE__,__FILE__);
WinDebugMsg(PrintBuf,hwnd);
}
WinSendDlgItemMsg(hwnd,
(ULONG) IDC_DATA_BIT5 + (DataPacket.bDataBits - 5),
(ULONG) BM_SETCHECK,
MPFROM2SHORT(TRUE,0),
NULL);
WinSendDlgItemMsg(hwnd,IDC_PARITY_NO + DataPacket.bParity,
BM_SETCHECK,
MPFROM2SHORT(TRUE,0),
NULL);
WinSendDlgItemMsg(hwnd,IDC_STOP_BIT1 + DataPacket.bStopBits,
BM_SETCHECK,
MPFROM2SHORT(TRUE,0),
NULL);
WinSetFocus (HWND_DESKTOP, WinWindowFromID(hwnd,DID_OK));
return 0;
}
示例9: findSelectedRecord
void Container::setItemFocus(UserData *it)
{
UserData *ud = findSelectedRecord(NULL);
if (ud != NULL)
WinSendMsg(cont,CM_SETRECORDEMPHASIS,MPFROMP((RECORDCORE*)ud),MPFROM2SHORT(FALSE,CRA_SELECTED));
if (it != NULL)
WinSendMsg(cont,CM_SETRECORDEMPHASIS,MPFROMP((RECORDCORE*)it),MPFROM2SHORT(TRUE,CRA_SELECTED));
}
示例10: ComboBox_Processor
extern MRESULT EXPENTRY ComboBox_Processor ( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {
static PWINDOWPROC DefaultProcessor = 0 ;
switch ( msg ) {
case WM_CREATE: {
CLASSINFO ClassInfo ;
WinQueryClassInfo ( WinQueryAnchorBlock(hwnd), WC_COMBOBOX, &ClassInfo ) ;
DefaultProcessor = ClassInfo.pfnWindowProc ;
MRESULT Result = DefaultProcessor ( hwnd, msg, mp1, mp2 ) ;
HWND Entryfield = WinWindowFromID ( hwnd, CBID_EDIT ) ;
ULONG Style = WinQueryWindowULong ( hwnd, QWL_STYLE ) ;
if ( Style & CBS_DROPDOWNLIST ) {
OldComboEntry_Processor1 = WinSubclassWindow ( Entryfield, ComboEntry_Processor1 ) ;
} else {
OldComboEntry_Processor2 = WinSubclassWindow ( Entryfield, ComboEntry_Processor2 ) ;
} /* endif */
return ( Result ) ; }
case WM_CONTROL: {
USHORT Id = WinQueryWindowUShort ( hwnd, QWS_ID ) ;
SHORT Control = SHORT1FROMMP ( mp1 ) ;
SHORT Message = SHORT2FROMMP ( mp1 ) ;
switch ( Control ) {
case CBID_EDIT: {
switch ( Message ) {
case EN_SETFOCUS: {
Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_SETFOCUS), 0 ) ;
break; }
case EN_KILLFOCUS: {
Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_KILLFOCUS), 0 ) ;
break; }
} /* endswitch */
break; }
case CBID_LIST: {
switch ( Message ) {
case LN_SETFOCUS: {
Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_SETFOCUS), 0 ) ;
break; }
case LN_KILLFOCUS: {
Sys_SendMessage( OWNER(hwnd), WM_CONTROL, MPFROM2SHORT(Id,CBN_KILLFOCUS), 0 ) ;
break; }
} /* endswitch */
break; }
} /* endswitch */
break; }
case WM_MEASUREITEM:
return ( Sys_SendMessage( OWNER(hwnd), msg, mp1, mp2 ) ) ;
case WM_DRAWITEM:
return ( Sys_SendMessage( OWNER(hwnd), msg, mp1, mp2 ) ) ;
} /* endswitch */
return ( DefaultProcessor ? DefaultProcessor ( hwnd, msg, mp1, mp2 ) : 0 ) ;
}
示例11: EnableMenuItem
/*---------------------------------------------
Helper subroutines to work over menu items.
---------------------------------------------*/
VOID EnableMenuItem (HWND hwnd, SHORT sMenuItem, BOOL fEnable)
{
HWND hwndParent = WinQueryWindow (hwnd, QW_PARENT, FALSE) ;
HWND hwndMenu = WinWindowFromID (hwndParent, FID_MENU) ;
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (sMenuItem, TRUE),
MPFROM2SHORT (MIA_DISABLED, fEnable ? 0 : MIA_DISABLED)) ;
}
示例12: _NewWindow
/*
* _NewWindow - create a new window
*/
unsigned _NewWindow( char *name, ... )
{
LPWDATA w;
MENUITEM menus;
HWND hwnd,frame,temp;
char str[80];
int x1,x2,y1,y2;
ULONG style;
RECTL rcl;
va_list al;
_GetWindowNameAndCoords( name, str, &x1, &x2, &y1, &y2 );
style = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX |
FCF_VERTSCROLL;
frame = WinCreateStdWindow( _MainWindow,
WS_VISIBLE | WS_CLIPSIBLINGS,
&style, _ClassName, str, 0, NULL, 0, &hwnd );
if( frame == 0 ) return( FALSE );
WinSetOwner( hwnd, _MainWindow );
va_start( al, name );
w = _AnotherWindowData( hwnd, al );
w->frame = frame;
w->text_color = CLR_WHITE;
w->background_color = CLR_BLACK;
WinSendMsg( frame, WM_SETICON,
MPFROMLONG( WinQuerySysPointer( HWND_DESKTOP, SPTR_APPICON, TRUE ) ), 0 );
WinSetWindowBits( WinWindowFromID( w->frame, FID_VERTSCROLL ), QWL_STYLE,
SBS_AUTOTRACK, SBS_AUTOTRACK );
_CreateFont( w );
_PositionScrollThumb( w );
WinQueryWindowRect( _MainWindow, &rcl );
WinSetWindowPos( frame, HWND_TOP,
x1*w->xchar,
(rcl.yTop - rcl.yBottom)-y1*w->ychar-y2*w->ychar,
x2*w->xchar,
y2*w->ychar,
SWP_SIZE | SWP_MOVE | SWP_ZORDER );
menus.iPosition = _MainWindowData->window_count - 1;
menus.afStyle = MIS_TEXT;
menus.afAttribute = 0;
menus.id = DID_WIND_STDIO + w->handles[0];
menus.hwndSubMenu = NULL;
menus.hItem = 0;
if ( MIT_ERROR == (BOOL)WinSendMsg( menuHandle, ( ULONG )MM_INSERTITEM, MPFROMP( &menus ), MPFROMP( str ) ) ) abort();
temp = WinWindowFromID( frame, FID_SYSMENU );
WinSendMsg( temp, MM_QUERYITEM, MPFROM2SHORT(SC_SYSMENU, TRUE),
MPFROMP((PSZ)&menus) );
WinSendMsg( menus.hwndSubMenu, MM_DELETEITEM, MPFROM2SHORT( SC_CLOSE, TRUE ), 0 );
WinUpdateWindow( hwnd );
WinSetFocus( HWND_DESKTOP, hwnd );
return( TRUE );
} /* _NewWindow */
示例13: EnableMenu
VOID EnableMenu(ULONG id, BOOL fEnable)
{
WinSendMsg(hwndMenu, /* global main menu handle */
MM_SETITEMATTR, /* set menu attribute */
MPFROM2SHORT(id, TRUE), /* menu id */
MPFROM2SHORT(MIA_DISABLED, /* mask = disable bit */
fEnable ? ~MIA_DISABLED : MIA_DISABLED)); /* turn off/on */
} /* end EnableMenu() */
示例14: ClearScreen
VOID ClearScreen(THREAD *pstThd)
{
VIOCELL Cell;
VIOPS *pVio = &pstThd->stVio;
BYTE byBackground;
BYTE byForeground;
byBackground = ClrTable[pVio->wBackground].PSClr;
byForeground = ClrTable[pVio->wForeground].PSClr;
/*
** Set foreground and background colors in ANSI, so that the
** VioWrtTTY function will pick up the correct colors.
*/
chAnsi[ANSI_FORE] = QueryAnsiClr(byForeground);
chAnsi[ANSI_BACK] = QueryAnsiClr(byBackground);
VioSetAnsi (ANSI_ON,pVio->hpsVio);
VioWrtTTY( (PCH)chAnsi,sizeof(chAnsi),pVio->hpsVio);
if (!pstThd->stCfg.bEnableAnsi)
VioSetAnsi (ANSI_OFF,pVio->hpsVio);
/*
** Set Presentation Space to a known state - full of spaces.
*/
Cell.vc = ' ';
Cell.ExtAttr = Cell.Spare = 0;
Cell.Attr = (byBackground << 4) | byForeground;
VioWrtNCell((PBYTE)&Cell,pVio->usPsWidth * pVio->usPsDepth,0,0,pVio->hpsVio);
VioSetOrg(0,0,pVio->hpsVio);
VioSetCurPos(0,0,pVio->hpsVio);
/*
** Zero the scroll bars.
*/
WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_VERTSCROLL),
SBM_SETPOS,
MPFROMSHORT(0),
MPFROMSHORT(0));
WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_HORZSCROLL),
SBM_SETPOS,
MPFROMSHORT(0),
MPFROMSHORT(0));
WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_VERTSCROLL),
SBM_SETTHUMBSIZE,
MPFROM2SHORT(pVio->usWndWidth,pVio->usPsWidth),
(MPARAM)NULL);
WinSendMsg(WinWindowFromID(pstThd->hwndFrame,FID_HORZSCROLL),
SBM_SETTHUMBSIZE,
MPFROM2SHORT(pVio->usWndDepth,pVio->usPsDepth),
(MPARAM)NULL);
}
示例15: EnableMenuItem
/**************************************************************************
*
* Name : EnableMenuItem(hwndMenu, idItem, fEnable)
*
* Description: Enables or disables the menu item
*
* Concepts: Called whenever a menu item is to be enabled or
* disabled
*
* Sends a MM_SETITEMATTR to the menu with the
* given item id. Sets the MIA_DISABLED attribute
* flag if the item is to be disabled, clears the flag
* if enabling.
*
* API's : WinSendMsg
*
* Parameters : hwndmenu = menu window handle
* idItem = menu item i.d.
* fEnable = enable (yes) or disable (no)
*
* Return : [none]
*
*************************************************************************/
VOID EnableMenuItem(HWND hwndMenu, USHORT idItem, BOOL fEnable)
{ SHORT fsFlag;
if(fEnable) fsFlag = 0;
else fsFlag = MIA_DISABLED;
WinSendMsg(hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT(idItem, TRUE),
MPFROM2SHORT(MIA_DISABLED, fsFlag));
} /* End of EnableMenuItem() */