void FASTCALL CmdPrintOutbasket( HWND hwnd ) { HPRINT hPr; BOOL fOk = TRUE; LPSTR lpOBPrintBuf; /* Show and get the print terminal dialog box. */ if( !Adm_Dialog( hRscLib, hwnd, MAKEINTRESOURCE(IDDLG_PRINTOUTBASKET), PrintOutbasketDlg, 0L ) ) return; fNewMemory( &lpOBPrintBuf, LEN_TEMPBUF ); GetWindowText( hwnd, lpOBPrintBuf, LEN_TEMPBUF ); if( NULL != ( hPr = BeginPrint( hwnd, lpOBPrintBuf, &lfFixedFont ) ) ) { register int cCount; for( cCount = 0; fOk && cCount < cCopies; ++cCount ) { int nCount; int c; HWND hwndList; ResetPageNumber( hPr ); fOk = BeginPrintPage( hPr ); hwndList = GetDlgItem( hwnd, IDD_LIST ); nCount = ListBox_GetCount( hwndList ); for( c = 0; c != nCount; c++ ) { OBINFO obinfo; LPOB lpob; lpob = (LPOB)ListBox_GetItemData( hwndList, c ); Amob_GetObInfo( lpob, &obinfo ); Amob_Describe( lpob, lpOBPrintBuf ); if( TestF(obinfo.obHdr.wFlags, OBF_HOLD) ) wsprintf( lpOBPrintBuf, "%s (H)", lpOBPrintBuf ); if( TestF(obinfo.obHdr.wFlags, OBF_KEEP) ) wsprintf( lpOBPrintBuf, "%s (K)", lpOBPrintBuf ); if( fOk ) fOk = PrintLine( hPr, lpOBPrintBuf ); } if( fOk ) EndPrintPage( hPr ); } } EndPrint( hPr ); if( NULL != lpOBPrintBuf ) FreeMemory( &lpOBPrintBuf ); }
/* This function updates the out-basket status */ void FASTCALL UpdateOutBasketStatus( void ) { if( hwndOutBasket ) { BOOL fIsEditable; BOOL fHasItem; BOOL fCanDelete; HWND hwndList; int nSelCount; hwndList = GetDlgItem( hwndOutBasket, IDD_LIST ); fIsEditable = FALSE; fHasItem = ( ListBox_GetCount( hwndList ) > 0 ); fCanDelete = FALSE; if( ( nSelCount = ListBox_GetSelCount( hwndList ) ) > 0 ) { OBINFO obinfo; LPOB lpob; int nSel; ListBox_GetSelItems( hwndList, 1, &nSel ); lpob = (LPOB)ListBox_GetItemData( hwndList, nSel ); Amob_GetObInfo( lpob, &obinfo ); SetWindowText( GetDlgItem( hwndOutBasket, IDD_HOLD ), ( obinfo.obHdr.wFlags & OBF_HOLD ) ? GS(IDS_STR282) : GS(IDS_STR281) ); SetWindowText( GetDlgItem( hwndOutBasket, IDD_KEEP ), ( obinfo.obHdr.wFlags & OBF_KEEP ) ? GS(IDS_STR318) : GS(IDS_STR319) ); fIsEditable = !fInitiatingBlink && Amob_IsEditable( obinfo.obHdr.clsid ) && !TestF(obinfo.obHdr.wFlags, OBF_PENDING ) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE ); fCanDelete = !fInitiatingBlink && !TestF(obinfo.obHdr.wFlags, OBF_PENDING ) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE ); } EnableControl( hwndOutBasket, IDOK, fIsEditable ); EnableControl( hwndOutBasket, IDD_LIST, fHasItem ); EnableControl( hwndOutBasket, IDD_DELETE, fCanDelete ); EnableControl( hwndOutBasket, IDD_HOLD, fHasItem && fCanDelete ); EnableControl( hwndOutBasket, IDD_KEEP, fHasItem && fCanDelete ); } }
GLDEF_C void TestTDes<T,S,L,R>::test_TBuf() // // Test the TBuf class special member functions // { test.Start(_L("TBuf default view, no params")); Test7(); test.Next(_L("TBuf view with a length")); Test8(); test.Next(_L("TBuf view over a string")); Test9(); test.Next(_L("TBuf view over a descriptor")); Test10(); test.Next(_L("TBuf view over a buffer")); Test11(); test.Next(_L("String assignment")); TestD(); test.Next(_L("Descriptor assignment")); TestE(); test.Next(_L("Buffer assignment")); TestF(); }
/* This function intercepts messages for the out-basket list box window * so that we can handle the right mouse button. */ LRESULT EXPORT FAR PASCAL OutBaskListProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch( msg ) { case WM_ERASEBKGND: { RECT rc; GetClientRect( hwnd, &rc ); FillRect( (HDC)wParam, &rc, hbrOutBaskWnd ); return( TRUE ); } case WM_CONTEXTMENU: /*!!SM!!*/ case WM_RBUTTONDOWN: { POINT pt; LPOB lpob; HWND hwndOpen; HMENU hPopupMenu; int index; AEPOPUP aep; /* Make sure this window is active and select the item * at the cursor. */ if( hwndActive != GetParent( hwnd ) ) SendMessage( hwndMDIClient, WM_MDIACTIVATE, (WPARAM)hwndOutBasket, 0L ); /* Select the item under the cursor only if nothing is * currently selected. */ index = ItemFromPoint( hwnd, (short)LOWORD(lParam), (short)HIWORD(lParam) ); if( ListBox_GetSel( hwnd, index ) == 0 ) { CallWindowProc( lpProcListCtl, hwnd, WM_LBUTTONDOWN, wParam, lParam ); CallWindowProc( lpProcListCtl, hwnd, WM_LBUTTONUP, wParam, lParam ); } /* Get the out-basket menu. */ hPopupMenu = GetSubMenu( hPopupMenus, IPOP_OBASKWINDOW ); hwndOpen = GetDlgItem( GetParent( hwnd ), IDOK ); MenuEnable( hPopupMenu, IDOK, IsWindowEnabled( hwndOpen ) ); /* If we have any selected items, use the attributes * of the first item to determine the menu items. */ if( ListBox_GetSelCount( hwnd ) > 0 ) { OBINFO obinfo; ListBox_GetSelItems( hwnd, 1, &index ); lpob = (LPOB)ListBox_GetItemData( hwnd, index ); Amob_GetObInfo( lpob, &obinfo ); if( TestF(obinfo.obHdr.wFlags, OBF_HOLD) ) MenuString( hPopupMenu, IDD_HOLD, GS(IDS_STR275) ); else MenuString( hPopupMenu, IDD_HOLD, GS(IDS_STR277) ); if( TestF(obinfo.obHdr.wFlags, OBF_KEEP) ) MenuString( hPopupMenu, IDD_KEEP, GS(IDS_STR440) ); else MenuString( hPopupMenu, IDD_KEEP, GS(IDS_STR439) ); MenuEnable( hPopupMenu, IDOK, !fInitiatingBlink && Amob_IsEditable( obinfo.obHdr.clsid ) && !TestF(obinfo.obHdr.wFlags, OBF_PENDING) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE ) ); MenuEnable( hPopupMenu, IDD_DELETE, !fInitiatingBlink && !TestF(obinfo.obHdr.wFlags, OBF_PENDING ) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE ) ); MenuEnable( hPopupMenu, IDD_KEEP, !fInitiatingBlink && !TestF(obinfo.obHdr.wFlags, OBF_PENDING ) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE ) ); MenuEnable( hPopupMenu, IDD_HOLD, !fInitiatingBlink && !TestF(obinfo.obHdr.wFlags, OBF_PENDING ) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE ) ); } else { MenuEnable( hPopupMenu, IDOK, FALSE ); MenuEnable( hPopupMenu, IDD_KEEP, FALSE ); MenuEnable( hPopupMenu, IDD_HOLD, FALSE ); MenuEnable( hPopupMenu, IDD_DELETE, FALSE ); } /* Call the AE_POPUP event. */ aep.wType = WIN_OUTBASK; aep.pFolder = NULL; aep.pSelectedText = NULL; aep.cchSelectedText = 0; aep.hMenu = hPopupMenu; aep.nInsertPos = 2; Amuser_CallRegistered( AE_POPUP, (LPARAM)(LPSTR)&aep, 0L ); GetCursorPos( &pt ); TrackPopupMenu( hPopupMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwndFrame, NULL ); return( 0 ); } case WM_KEYDOWN: /* Trap the Delete and Shift+Delete key in the outbasket * list box to handle the Delete command. */ if( wParam == VK_DELETE ) { PostDlgCommand( GetParent( hwnd ), IDD_DELETE, 0 ); return( 0 ); } /* Trap the Pause and Shift+Pause key in the outbasket * list box to handle the Hold command. */ if( wParam == VK_PAUSE ) { PostDlgCommand( GetParent( hwnd ), IDD_HOLD, 1 ); return( 0 ); } break; } return( CallWindowProc( lpProcListCtl, hwnd, msg, wParam, lParam ) ); }