Jump to content
Tuts 4 You

Edit History

Progman

Progman

https://people.symlink.me/~rom1/dev/

windows_2000_source_code.zip\win2k\private\ntos\w32\ntuser\client - ZIP archive, unpacked size 658,114,889 bytes

WinRAR can even search the archive for you if you don't want to extract it.

menuc.c - however menu is really a combination of a check box button and a static control I think.

btnctl.c - complete with owner draw example for buttons

statctl.c - complete with owner draw example for statics

SYSRGB(GRAYTEXT) seems to be referenced for disabled.  Of course this is old source and by now they have rewritten and changed a lot with Aero and other features.  But the core of Windows UI programming is still based off this which is why Microsoft continues to rigorously sanitize that leaked source from the web 20 years later!!!

But I will solve this for you now for real:

mngrayc.c - the entire drawing code for the draw state (sounds like menu gray to me).  If this snippet is not allowed for wrath of MSFT then admin could kindly remove it...

        /*
         * Is our scratch bitmap big enough?  We need potentially
         * cx+1 by cy pixels for default etc.
         */
        if ((gcxGray < cx + 1) || (gcyGray < cy)) {

            if (hbmpT = CreateBitmap(max(gcxGray, cx + 1), max(gcyGray, cy), 1, 1, 0L)) {

                HBITMAP hbmGray;

                hbmGray = SelectObject(ghdcGray, hbmpT);
                DeleteObject(hbmGray);

                gcxGray = max(gcxGray, cx + 1);
                gcyGray = max(gcyGray, cy);

            } else {
                cx = gcxGray - 1;
                cy = gcyGray;
            }
        }

        PatBlt(ghdcGray, 0, 0, gcxGray, gcyGray, WHITENESS);
    /*
     * DISABLED state
     * Emboss
     * Draw over-1/down-1 in hilight color, and in same position in shadow.
     *
     * DEFAULT state
     * Drop shadow
     * Draw over-1/down-1 in shadow color, and in same position in foreground
     * Draw offset down in shadow color,
     */
    if (uFlags & DSS_DISABLED) {

        BltColor(hdcDraw,
                 SYSHBR(3DHILIGHT),
                 ghdcGray,
                 x + 1,
                 y + 1,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

        BltColor(hdcDraw,
                 SYSHBR(3DSHADOW),
                 ghdcGray,
                 x,
                 y,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

    } else if (uFlags & DSS_DEFAULT) {

        BltColor(hdcDraw,
                 SYSHBR(3DSHADOW),
                 ghdcGray,
                 x+1,
                 y+1,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

        goto DrawNormal;

    } else {

DrawNormal:

        BltColor(hdcDraw, hbrFore, ghdcGray, x, y, cx, cy, 0, 0, BC_INVERT);
    }

And then finally the work happens in BltColor with this line:

    BitBlt(hdc, xO, yO, cx, cy, hdcSrce,
        xO1, yO1, ((uBltFlags & BC_INVERT) ? 0xB8074AL : 0xE20746L));
        //xO1, yO1, (fInvert ? 0xB80000 : 0xE20000));

So some really almost impossible to come up with on your own code with a 3D highlight/3D shadow and special hardcoded color inversion codes.  And with Aero its probably 10 times worse if you need to support that.  Have to decompile user32.dll in Win10 perhaps ;)

Why Visual Studio does not automatically generate the pages of original user32 code for you, I have no idea but it would sure make more professional consistent custom drawn Windows apps for sure!!!

I hope a new source code leak comes soon :D  I really liked the Win2k one - especially for the user32 code a real gem for those of us who have done owner drawing and want to exactly replicate original functionality without coming up with hacked up slightly incorrect alternatives.

Progman

Progman

https://people.symlink.me/~rom1/dev/

windows_2000_source_code.zip\win2k\private\ntos\w32\ntuser\client - ZIP archive, unpacked size 658,114,889 bytes

WinRAR can even search the archive for you if you don't want to extract it.

menuc.c - however menu is really a combination of a check box button and a static control I think.

btnctl.c - complete with owner draw example for buttons

statctl.c - complete with owner draw example for statics

SYSRGB(GRAYTEXT) seems to be referenced for disabled.  Of course this is old source and by now they have rewritten and changed a lot with Aero and other features.  But the core of Windows UI programming is still based off this which is why Microsoft continues to rigorously sanitize that leaked source from the web 20 years later!!!

But I will solve this for you now for real:

mngrayc.c - the entire drawing code for the draw state (sounds like menu gray to me).  If this snippet is not allowed for wrath of MSFT then admin could kindly remove it...

        /*
         * Is our scratch bitmap big enough?  We need potentially
         * cx+1 by cy pixels for default etc.
         */
        if ((gcxGray < cx + 1) || (gcyGray < cy)) {

            if (hbmpT = CreateBitmap(max(gcxGray, cx + 1), max(gcyGray, cy), 1, 1, 0L)) {

                HBITMAP hbmGray;

                hbmGray = SelectObject(ghdcGray, hbmpT);
                DeleteObject(hbmGray);

                gcxGray = max(gcxGray, cx + 1);
                gcyGray = max(gcyGray, cy);

            } else {
                cx = gcxGray - 1;
                cy = gcyGray;
            }
        }

        PatBlt(ghdcGray, 0, 0, gcxGray, gcyGray, WHITENESS);
    /*
     * DISABLED state
     * Emboss
     * Draw over-1/down-1 in hilight color, and in same position in shadow.
     *
     * DEFAULT state
     * Drop shadow
     * Draw over-1/down-1 in shadow color, and in same position in foreground
     * Draw offset down in shadow color,
     */
    if (uFlags & DSS_DISABLED) {

        BltColor(hdcDraw,
                 SYSHBR(3DHILIGHT),
                 ghdcGray,
                 x + 1,
                 y + 1,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

        BltColor(hdcDraw,
                 SYSHBR(3DSHADOW),
                 ghdcGray,
                 x,
                 y,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

    } else if (uFlags & DSS_DEFAULT) {

        BltColor(hdcDraw,
                 SYSHBR(3DSHADOW),
                 ghdcGray,
                 x+1,
                 y+1,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

        goto DrawNormal;

    } else {

DrawNormal:

        BltColor(hdcDraw, hbrFore, ghdcGray, x, y, cx, cy, 0, 0, BC_INVERT);
    }

Why Visual Studio does not automatically generate the pages of original user32 code for you, I have no idea but it would sure make more professional consistent custom drawn Windows apps for sure!!!

I hope a new source code leak comes soon :D  I really liked the Win2k one - especially for the user32 code a real gem for those of us who have done owner drawing and want to exactly replicate original functionality without coming up with hacked up slightly incorrect alternatives.

Progman

Progman

https://people.symlink.me/~rom1/dev/

windows_2000_source_code.zip\win2k\private\ntos\w32\ntuser\client - ZIP archive, unpacked size 658,114,889 bytes

WinRAR can even search the archive for you if you don't want to extract it.

menuc.c - however menu is really a combination of a check box button and a static control I think.

btnctl.c - complete with owner draw example for buttons

statctl.c - complete with owner draw example for statics

SYSRGB(GRAYTEXT) seems to be referenced for disabled.  Of course this is old source and by now they have rewritten and changed a lot with Aero and other features.  But the core of Windows UI programming is still based off this which is why Microsoft continues to rigorously sanitize that leaked source from the web 20 years later!!!

But I will solve this for you now for real:

mngrayc.c - the entire drawing code for the draw state (sounds like menu gray to me).  If this snippet is not allowed for wrath of MSFT then admin could kindly remove it...

        /*
         * Is our scratch bitmap big enough?  We need potentially
         * cx+1 by cy pixels for default etc.
         */
        if ((gcxGray < cx + 1) || (gcyGray < cy)) {

            if (hbmpT = CreateBitmap(max(gcxGray, cx + 1), max(gcyGray, cy), 1, 1, 0L)) {

                HBITMAP hbmGray;

                hbmGray = SelectObject(ghdcGray, hbmpT);
                DeleteObject(hbmGray);

                gcxGray = max(gcxGray, cx + 1);
                gcyGray = max(gcyGray, cy);

            } else {
                cx = gcxGray - 1;
                cy = gcyGray;
            }
        }

        PatBlt(ghdcGray, 0, 0, gcxGray, gcyGray, WHITENESS);
    /*
     * DISABLED state
     * Emboss
     * Draw over-1/down-1 in hilight color, and in same position in shadow.
     *
     * DEFAULT state
     * Drop shadow
     * Draw over-1/down-1 in shadow color, and in same position in foreground
     * Draw offset down in shadow color,
     */
    if (uFlags & DSS_DISABLED) {

        BltColor(hdcDraw,
                 SYSHBR(3DHILIGHT),
                 ghdcGray,
                 x + 1,
                 y + 1,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

        BltColor(hdcDraw,
                 SYSHBR(3DSHADOW),
                 ghdcGray,
                 x,
                 y,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

    } else if (uFlags & DSS_DEFAULT) {

        BltColor(hdcDraw,
                 SYSHBR(3DSHADOW),
                 ghdcGray,
                 x+1,
                 y+1,
                 cx,
                 cy,
                 0,
                 0,
                 BC_INVERT);

Why Visual Studio does not automatically generate the pages of original user32 code for you, I have no idea but it would sure make more professional consistent custom drawn Windows apps for sure!!!

I hope a new source code leak comes soon :D  I really liked the Win2k one - especially for the user32 code a real gem for those of us who have done owner drawing and want to exactly replicate original functionality without coming up with hacked up slightly incorrect alternatives.

Progman

Progman

https://people.symlink.me/~rom1/dev/

windows_2000_source_code.zip\win2k\private\ntos\w32\ntuser\client - ZIP archive, unpacked size 658,114,889 bytes

WinRAR can even search the archive for you if you don't want to extract it.

menuc.c - however menu is really a combination of a check box button and a static control I think.

btnctl.c - complete with owner draw example for buttons

statctl.c - complete with owner draw example for statics

SYSRGB(GRAYTEXT) seems to be referenced for disabled.  Of course this is old source and by now they have rewritten and changed a lot with Aero and other features.  But the core of Windows UI programming is still based off this which is why Microsoft continues to rigorously sanitize that leaked source from the web 20 years later!!!

But I will solve this for you now for real:

mngrayc.c - the entire drawing code for the draw state (sounds like menu gray to me).  If this snippet is not allowed for wrath of MSFT then admin could kindly remove it...

        /*
         * Is our scratch bitmap big enough?  We need potentially
         * cx+1 by cy pixels for default etc.
         */
        if ((gcxGray < cx + 1) || (gcyGray < cy)) {

            if (hbmpT = CreateBitmap(max(gcxGray, cx + 1), max(gcyGray, cy), 1, 1, 0L)) {

                HBITMAP hbmGray;

                hbmGray = SelectObject(ghdcGray, hbmpT);
                DeleteObject(hbmGray);

                gcxGray = max(gcxGray, cx + 1);
                gcyGray = max(gcyGray, cy);

            } else {
                cx = gcxGray - 1;
                cy = gcyGray;
            }
        }

        PatBlt(ghdcGray, 0, 0, gcxGray, gcyGray, WHITENESS);

Why Visual Studio does not automatically generate the pages of original user32 code for you, I have no idea but it would sure make more professional consistent custom drawn Windows apps for sure!!!

I hope a new source code leak comes soon :D  I really liked the Win2k one - especially for the user32 code a real gem for those of us who have done owner drawing and want to exactly replicate original functionality without coming up with hacked up slightly incorrect alternatives.

Progman

Progman

https://people.symlink.me/~rom1/dev/

windows_2000_source_code.zip\win2k\private\ntos\w32\ntuser\client - ZIP archive, unpacked size 658,114,889 bytes

WinRAR can even search the archive for you if you don't want to extract it.

menuc.c - however menu is really a combination of a check box button and a static control I think.

btnctl.c - complete with owner draw example for buttons

statctl.c - complete with owner draw example for statics

SYSRGB(GRAYTEXT) seems to be referenced for disabled.  Of course this is old source and by now they have rewritten and changed a lot with Aero and other features.  But the core of Windows UI programming is still based off this which is why Microsoft continues to rigorously sanitize that leaked source from the web 20 years later!!!

But I will solve this for you now for real:

mngrayc.c - the entire drawing code for the draw state (sounds like menu gray to me).

        /*
         * Is our scratch bitmap big enough?  We need potentially
         * cx+1 by cy pixels for default etc.
         */
        if ((gcxGray < cx + 1) || (gcyGray < cy)) {

            if (hbmpT = CreateBitmap(max(gcxGray, cx + 1), max(gcyGray, cy), 1, 1, 0L)) {

                HBITMAP hbmGray;

                hbmGray = SelectObject(ghdcGray, hbmpT);
                DeleteObject(hbmGray);

                gcxGray = max(gcxGray, cx + 1);
                gcyGray = max(gcyGray, cy);

            } else {
                cx = gcxGray - 1;
                cy = gcyGray;
            }
        }

        PatBlt(ghdcGray, 0, 0, gcxGray, gcyGray, WHITENESS);

Why Visual Studio does not automatically generate the pages of original user32 code for you, I have no idea but it would sure make more professional consistent custom drawn Windows apps for sure!!!

I hope a new source code leak comes soon :D  I really liked the Win2k one - especially for the user32 code a real gem for those of us who have done owner drawing and want to exactly replicate original functionality without coming up with hacked up slightly incorrect alternatives.

×
×
  • Create New...