--- mstools/samples/maskblt/maskblt.c 2018/08/09 18:20:45 1.1.1.1 +++ mstools/samples/maskblt/maskblt.c 2018/08/09 18:21:44 1.1.1.2 @@ -1,6 +1,11 @@ + /**************************************************************************\ * maskblt.c -- sample program demonstrating MaskBlt() * +* Steve Firebaugh +* Microsoft Developer Support +* Copyright (c) 1992 Microsoft Corporation +* * design: There is one main window with one dialog box maskblted to fill * the top of it. The parameters for the MaskBlt() are stored in the * entry fields of this dialog box. The user may change these values and @@ -143,7 +148,7 @@ int APIENTRY WinMain(HINSTANCE hInstance * hbmSrc, hbmMask - bitmap handles for source and mask. * iPatternBrush - Selection from combo box, set into the hdc. \**************************************************************************/ -LRESULT MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static int miniWidth; static RECT rect; @@ -343,15 +348,20 @@ static HANDLE hPenGrid, hPenSeparator; /* get high order ROP byte and shift left by two bytes. */ GetDlgItemText(hwndDlg, DID_ROP0, buffer, MAXCHARS); sscanf (buffer, "%lx", &ropByte); - rop = ropByte * 256 * 256; + rop = ropByte * 256 * 256 * 256; /* get the next ROP byte and shift left by one byte. */ GetDlgItemText(hwndDlg, DID_ROP1, buffer, MAXCHARS); sscanf (buffer, "%lx", &ropByte); + rop += ropByte * 256 * 256; + + /* get the next ROP byte and shift left by one byte. */ + GetDlgItemText(hwndDlg, DID_ROP2, buffer, MAXCHARS); + sscanf (buffer, "%lx", &ropByte); rop += ropByte * 256; /* finally, get the low order ROP byte. */ - GetDlgItemText(hwndDlg, DID_ROP2, buffer, MAXCHARS); + GetDlgItemText(hwndDlg, DID_ROP3, buffer, MAXCHARS); sscanf (buffer, "%lx", &ropByte); rop += ropByte; @@ -546,7 +556,7 @@ static HANDLE hPenGrid, hPenSeparator; * hdcDest, hdcSrc, hdcMask - HDCs for the 3 sub regions of the window. * hbmSrc, hbmMask - bitmap handles for source and mask. \**************************************************************************/ -LRESULT DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK DlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { char buffer[MAXCHARS]; HBITMAP hbm; @@ -565,9 +575,10 @@ HBITMAP hbm; SetDlgItemText(hwnd, i, "0"); /* these are the three bytes from SRCCOPY */ - SetDlgItemText(hwnd, DID_ROP0 , "cc"); - SetDlgItemText(hwnd, DID_ROP1 , "00"); - SetDlgItemText(hwnd, DID_ROP2 , "20"); + SetDlgItemText(hwnd, DID_ROP0 , "00"); + SetDlgItemText(hwnd, DID_ROP1 , "cc"); + SetDlgItemText(hwnd, DID_ROP2 , "00"); + SetDlgItemText(hwnd, DID_ROP3 , "20"); for (i = 0; i< NROPS; i++) SendDlgItemMessage (hwnd, DID_CB_ROPS, CB_INSERTSTRING, @@ -748,13 +759,13 @@ HBITMAP hbm; iSel = SendMessage ((HWND) lParam, CB_GETCURSEL, 0,0); rop = StandardROPs[iSel].Value; sprintf (buffer, "%2x", (rop & 0x000000ff)); - SetDlgItemText(hwnd, DID_ROP2, buffer); + SetDlgItemText(hwnd, DID_ROP3, buffer); rop /= 256; sprintf (buffer, "%2x", (rop & 0x000000ff)); - SetDlgItemText(hwnd, DID_ROP1, buffer); + SetDlgItemText(hwnd, DID_ROP2, buffer); rop /= 256; sprintf (buffer, "%2x", (rop & 0x000000ff)); - SetDlgItemText(hwnd, DID_ROP0, buffer); + SetDlgItemText(hwnd, DID_ROP1, buffer); SendMessage (hwndMain, WM_MASKBLT, 0,0); }