windows»·¾³ÏÂ32λ»ã±àÓïÑÔ³ÌÐòÉè¼Æ-µÚ37ÕÂ
°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·ҳ£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
hMaskBmpÖ¸¶¨ÁËÒ»·ùºÚ°×λͼ£¬Èç¹ûλͼÖжÔӦλÖõÄÏñËØΪºÚ£¨¼´Îª0£©£¬ÄÇôʹÓñ³¾°ROPÂ룬Èç¹û¶ÔӦλÖõÄÏñËØΪ°×£¨¼´Îª1£©£¬ÄÇôʹÓÃÇ°¾°ROPÂë¡£×¢Ò⣺ÕÚÑÚλͼһ¶¨ÒªÊǺڰ×Á½É«µÄ£¬Èç¹ûʹÓÃÆäËûÑÕÉ«Éî¶ÈµÄλͼ£¬ÄÇôº¯Êýµ÷Óý«»áʧ°Ü¡£
¶ÁÕßÒ»¶¨ÓиöÎÊÌ⣺²ÎÊýÖÐÖ»ÓÐÒ»¸ödwROP²ÎÊý£¬ÈçºÎÖ¸¶¨Á½¸öROPÂ룿ÕâÕýÊÇÕâ¸öº¯Êý±È½Ï·Ñ½âµÄµØ·½£¬Êµ¼ÊÉÏdwROP²ÎÊýÊÇÁ½¸öROPÂëµÄ×éºÏ£¬×éºÏµÄËã·¨ÊÇ£º
£¨£¨±³¾°ROPÂë¡¡shl¡¡8£©&¡¡0ff000000h£©or¡¡Ç°¾°ROPÂë
Áé»îʹÓÃÕâ¸öº¯Êý¿ÉÒÔ´øÀ´ºÜ¶àµÄ·½±ã£¬±ÈÈçÔÚ_CreateBackGround×Ó³ÌÐòÖУ¬ÒÔ¡°£»¡±Îª×¢ÊÍÖ®¼äµÄ8¾ä´úÂëÍêÈ«¿ÉÒԸijÉÏÂÃæµÄ4¾ä£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡CreatePatternBrush£»@hBmpBack
¡¡¡¡¡¡¡¡invoke¡¡¡¡SelectObject£»hDcBack£»eax
¡¡¡¡¡¡¡¡invoke¡¡¡¡DeleteObject£»eax
¡¡¡¡¡¡¡¡invoke¡¡¡¡MaskBlt£»hDcBack£»0£»0£»CLOCK_SIZE£»CLOCK_SIZE£»
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡@hDcCircle£»0£»0£»@hBmpMask£»0£»0£»
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£¨£¨SRCCOPY¡¡shl¡¡8£©¡¡and¡¡0ff000000h£©¡¡or¡¡PATCOPY
Ïà±ÈÖ®ÏÂÉÙÁËÒ»¸öPatBltºÍÒ»¸öBitBltµ÷Óá£ÒòΪ³ÌÐòµÄÒªÇóÊÇÕÚÑÚͼƬÖкÚÉ«µÄ²¿·ÖʹÓñ߿òͼƬ£¬¶ø°×É«²¿·ÖʹÓñ³¾°£¬ËùÒÔ½«±³¾°ROPÉèÖÃΪSRCCOPY¾Í¿ÉÒÔ½«ÐèÒªµÄ±ß¿ò²¿·Ö¸´ÖƹýÈ¥£¬¶øÇ°¾°ROPʹÓÃPATCOPY¾ÍÃâ³ýÁËʹÓÃPatBltÌî³ä±³¾°µÄ²½Öè¡£µ±È»£¬Ê¹ÓÃÇ°ÐèÒª°ÑMask1¡£bmpºÍMask2¡£bmpÖØб£´æ³ÉºÚ°×É«£¬ÒòΪÏÖÔÚÕâÁ½¸öλͼÎļþÊÇ256É«¸ñʽµÄ¡£
Èç¹ûhMaskBmp²»Ö¸¶¨£¨²ÎÊýдΪNULL£©£¬ÄÇôMasmBltº¯Êý¾ÍÏ൱ÓÚBitBltº¯Êý£¬Ö»²»¹ýROPÊÇʹÓÃdwROPÖÐÖ¸¶¨µÄÇ°¾°ROPÂë¡£
¡¡
4¡£¡¡PlgBltº¯Êý
PlgBltʵÏÖƽÐÐËıßÐÎÐýת´«ËͲÙ×÷£¨Parallelogram¡¡Block¡¡Transfer£©£¬Ëü¸´ÖÆÒ»·ùλͼ£¬Í¬Ê±½«Æäת»»³ÉÒ»¸öƽÐÐËıßÐΣ¬ËùÒÔÀûÓÃËü¿É¶Ôλͼ½øÐÐÐýת´¦Àí¡£PlgBltº¯ÊýµÄʹÓÃÓï·¨ÊÇ£º
invoke¡¡¡¡PlgBlt£¬hdcDest£¬lpPoint£¬
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hdcSrc£¬xSrc£¬ySrc£¬dwWidth£¬dwHeight£¬
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hBmpMask£¬xMask£¬yMask
Õâ¸öº¯ÊýºÍROPÂëÎ޹أ¬µ«ËüͬÑùÖ¸¶¨ÁËÒ»¸öµ¥É«µÄÕÚÑÚλͼ£¬ÕÚÑÚλͼÖÐΪ1µÄÏñËضÔÓ¦µÄλÖûᱻ´«ËÍ£¬Îª0µÄÏñËز»±»´«ËÍ¡££¨xSrc£¬ySrc£©Ö¸¶¨ÁËÔ´DCÖÐÐèÒª´«Ë͵ľØÐεÄ×óÉϽǣ¬dwWidthºÍdwHeightÖ¸¶¨¿í¶ÈºÍ¸ß¶È£¬Õâ¸ö¾ØÐν«±»Ðýתºó´«Ë͵½Ä¿µÄDCÖÐÈ¥£¬ÐýתºóµÄƽÐÐËıßÐÎλÖÃÓÉlpPointÖ¸¶¨µÄPOINT½á¹¹ÕóÁÐÖ¸³ö¡£
lpPointÊÇÒ»¸öÖ¸Õ룬ָÏòº¬ÓÐ3¸öPOINT½á¹¹µÄÄÚ´æÖУ¨ÕâÖÖʹÓÃPOINT½á¹¹Êý×éµÄ·½·¨ÔÚPolyLineÖÐÒѾʹÓùý£©£¬ÆäÖеÚÒ»¸öµã¶ÔÓ¦ÓÚÒ»¸öƽÐÐËıßÐεÄ×óÉϽÇλÖ㬵ڶþ¸öµã´ú±íÓÒÉϽÇλÖ㬵ÚÈý¸öµã´ú±íÓÒϽǵÄλÖ㬲»ÐèÒªµÚËĸöµãÊÇÒòΪËü¿ÉÒÔ´ÓÉÏÃæ3¸öµãµÄ×ø±êÍƵ¼³öÀ´¡£
5¡£¡¡StretchBltº¯Êý
StretchBltº¯ÊýʵÏÖÏñËصÄËõ·Å¹¦ÄÜ£¬ËüµÄÓï·¨ÊÇ£º
invoke¡¡¡¡¡¡¡¡¡¡¡¡StretchBlt£»hDcDest£»xDest£»yDest£»dwWidthDest£»dwHeightDest£»
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hDcSrc£»xSrc£»ySrc£»dwWidthSrc£»dwHeightSrc£»dwROP¡¡
Õâ¸öº¯Êý½«Ô´hDcSrcÖÐÒÔ£¨xSrc£¬ySrc£©Îª×óÉϽǣ¬dwWidthSrcºÍdwHeightSrcΪ¿í¶ÈºÍ¸ß¶ÈµÄ¾ØÐÎÒÔdwROPÖ¸¶¨µÄ·½Ê½´«Ë͵½Ä¿±êhDcDestÖÐÈ¥£¬Ä¿±êλÖÃÊÇ£¨xDest£¬yDest£©£¬ÐµľØÐÎÇøÓò´óСΪdwWidthDestºÍdwHeight£¬Èç¹ûÔ´DCÖеľØÐδóСºÍÄ¿±êDCÖеIJ»Ò»Ñù£¬º¯Êý»á½«ÏñËØÊý¾Ý×Ô¶¯Ëõ·Å¡£
µ«ÊÇStretchBlt¶ÔÏñËصÄËõ·Å°ì·¨½ö½öÊÇɾ³ý¶àÓàµÄÏñËØ£¨´Ó´óµ½Ð¡£©»òÕßÖظ´ÏñËØ£¨´ÓСµ½´ó£©£¬²¢²»ÏñһЩͼÐδ¦ÀíÈí¼þÒ»Ñù½øÐвåÖµ¼ÆË㣬ËùÒÔËõ·ÅµÄЧ¹û²¢²»ºÃ£¬±ÊÕß½¨ÒéÈç¹ûÄܹ»²»ÓÃÕâ¸öº¯Êý¾Í²»ÒªÈ¥ÓÃËü£¬³ý·Ç¶ÔͼÐεÄÖÊÁ¿²¢Ã»ÓÐÒªÇó¡£
6¡£¡¡TransparentBltº¯Êý
»¹ÓÐÒ»¸öº¯Êý¿ÉÒÔ·½±ãµØʵÏÖ²»¹æÔòÇøÓòµÄÏñËØ¿½±´²Ù×÷£¬ÄǾÍÊÇTransparentBltº¯Êý£¬ËüµÄÓ÷¨ÈçÏ£º
invoke¡¡¡¡TransparentBlt£»hDcDest£»xDest£»yDest£»dwWidthDest£»dwHeightDest£»
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hDcSrc£»xSrc£»ySrc£»dwWidthSrc£»dwHeightSrc£»crTransparent
¿ÉÒÔ¿´³ö£¬ËüºÍStretchBltº¯ÊýµÄ²ÎÊýºÜÏñ£¬Ò²ÓÐdwWidthSrcºÍdwHeightSrc²ÎÊý£¬ÄѵÀÕâ¸öº¯ÊýÒ²¿ÉÒÔËõ·ÅÂ𣿴ð°¸Êǿ϶¨µÄ£¬ËüÒ²¿ÉÒÔ½øÐÐÏñËØËõ·Å¡£TransparentBltº¯ÊýµÄ×îºóÒ»¸ö²ÎÊýÖ¸¶¨ÁËÒ»¸ö͸Ã÷É«£¬Ô´DCÖ¸¶¨µÄ¾ØÐÎÇøÓòÖкÍÕâ¸öÑÕÉ«ÏàͬµÄÏñËز»»á±»¿½±´£¬ËùÒÔ£¬BmpClock³ÌÐòÖеÄÏÂÁÐÁ½¸öÓï¾ä£º
invoke¡¡¡¡BitBlt£»hDcBack£»0£»0£»CLOCK_SIZE£»CLOCK_SIZE£»@hDcMask£»0£»0£»SRCAND
invoke¡¡¡¡BitBlt£»hDcBack£»0£»0£»CLOCK_SIZE£»CLOCK_SIZE£»
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡@hDcCircle£»0£»0£»SRCPAINT
ÍêÈ«¿ÉÒÔÓÃÏÂÃæÕâÒ»¾äÀ´´úÌ棺
invoke¡¡¡¡TransparentBlt£»hDcBack£»0£»0£»CLOCK_SIZE£»CLOCK_SIZE£»
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡@hDcCircle£»0£»0£»CLOCK_SIZE£»CLOCK_SIZE£»0
ÕâÑùÉõÖÁÁ¬ÕÚÑÚͼƬBack1¡£bmpºÍBack2¡£bmp¶¼¿ÉÒÔÊ¡µôÁË¡£
µ±È»£¬Õâ¸öº¯ÊýµÄ´«ËÍ·½Ê½Ê¹Óÿ½±´·½Ê½£¬Èç¹ûÐèÒªÓõ½ROPÂ룬ÄÇôֻÓÐʹÓÃÆäËûº¯ÊýÁË¡£Óɴ˿ɼû£¬¸÷ÖÖ¿é´«Ëͺ¯Êý¶¼ÓÐËüÃǵÄÓÅȱµã£¬ÔÚʵ¼ÊÓ¦ÓÃÖУ¬×îºÃµÄ°ì·¨¾ÍÊǸù¾Ýʵ¼ÊÇé¿öÁé»îʹÓá£
TransparentBltº¯Êý²¢²»°üº¬ÔÚGdi32¡£dllÖУ¬¶øÊÇÔÚMsimg32¡£dllÖУ¬ËùÒÔʹÓÃʱעÒâÔÚÔ´³ÌÐòÍ·²¿¼ÓÉÏÏÂÃæµÄ°üº¬Óï¾ä£º
include¡¡¡¡¡¡¡¡¡¡Msimg32¡£inc
includelib¡¡¡¡Msimg32¡£lib
¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡
µÚ7Õ¡¡Í¼ÐβÙ×÷
7¡£5¡¡ÇøÓòºÍ·¾¶
¡¡¡¡¡¡¡¡
Èç¹û¶ÁÕßÓùýPhotoShop»æͼÈí¼þ£¬¾ÍÒ»¶¨¼ÇµÃËüÓС°Ñ¡ÔñÇøÓò¡±ÒÔ¼°¡°Â·¾¶¡±µÄ¸ÅÄÇøÓòÓÃÀ´Ñ¡¶¨Ò»¸ö·¶Î§£¬ÒÔ±ã¶ÔÖ¸¶¨µÄ·¶Î§½øÐÐijÖÖ²Ù×÷£»¶ø·¾¶Ï൱ÓÚÓÃÐéÄâµÄÏßÌõÈ¥½øÐС°È¦µØÔ˶¯¡±£¬ËäȻ·¾¶È¦³öÀ´µÄ¿´ÉÏÈ¥Ò²ÊÇÒ»¸öÇøÓò£¬µ«Â·¾¶¼Ç¼µÄÊÇ¡°È¦µØ¡±ÓõÄÏßÌõ¶ø²»ÊÇȦ³öÀ´µÄµØ¡£
7¡£5¡£1¡¡¡¡Ê¹ÓÃÇøÓò
1¡£¡¡´´½¨ÇøÓò
Ê×ÏÈÀ´¿´ÈçºÎ½¨Á¢Ò»¸öÇøÓò£¬GDIÖпÉÒÔÓÃÏÂÁÐÇøÓò½¨Á¢º¯ÊýÀ´´´½¨ÇøÓò£º
£¨1£©¡¡invoke¡¡¡¡CreateRectRgn£¬dwLeft£¬dwTop£¬dwRight£¬dwBottom
£¨2£©¡¡invoke¡¡¡¡CreateEllipticRgn£¬dwLeft£¬dwTop£¬dwRight£¬dwBottom
£¨3£©¡¡invoke¡¡¡¡CreateEllipticRgnIndirect£¬lpRect
£¨4£©¡¡invoke¡¡¡¡CreatePolygonRgn£¬lpPoint£¬iCount£¬iPolyFillMode
£¨5£©¡¡invoke¡¡¡¡CreateRoundRectRgn£¬dwLeft£¬dwTop£¬dwRight£¬dwBottom£¬
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dwWidthEllipse£¬dwHeightEllipse
ÕâЩº¯Êý·Ö±ð´´½¨¾ØÐΣ¨1£©¡¢ÍÖÔ²£¨2£©ºÍ£¨3£©¡¢¶à±ßÐΣ¨4£©ºÍÔ²½Ç¾ØÐΣ¨5£©µÄÇøÓò£¬²ÎÊýÖÐ×ø±êÖµµÄº¬ÒåºÍ»æ»Ìî³äÇøÓòµÄº¯ÊýRectangle£¬Ellipse£¬PolygonÓëRoundRectµÄ²ÎÊý¶¨ÒåÊÇÏàͬµÄ¡£
CreateRectRgnº¯ÊýµÄ²ÎÊýÖ¸¶¨ÁË×óÉϺÍÓÒÏÂÁ½¸ö¶Ô½ÇµÄ×ø±ê¡£CreateEllipticRgnµÄ²ÎÊýÖ¸¶¨ÁËÒ»¸ö¾ØÐΣ¬²úÉúµÄÍÖÔ²ÇøÓòºÍÕâ¸ö¾ØÐÎÊÇÏàÇеġ£
CreateEllipticRgnIndirectº¯ÊýͬÑù½¨Á¢ÍÖÔ²ÇøÓò£¬µ«Ö¸¶¨ÓëÍÖÔ²ÏàÇеľØÐÎÊÇÓÉÒ»¸öRECT½á¹¹¶¨ÒåµÄ¡£
CreatePolygonRgn½¨Á¢Ò»¸ö¶à±ßÐÎÇøÓò¡£lpPointÖ¸ÏòһϵÁеÄPOINT½á¹¹£¬iCountÖ¸¶¨Á˵ãµÄÊýÁ¿£¬iPolyFillMode²ÎÊý¾ÍÊÇSetPolyFillModeº¯ÊýʹÓõIJÎÊý£ºALTERNATE»òWINDING£¬½á¹ûµÄ²»Í¬Ö®´¦Ï൱ÓÚ±í7¡£4ÖÐPolygonº¯ÊýµÄÁ½ÖÖ½á¹ûµÄÇø±ð¡£
Èç¹û´´½¨ÇøÓò³É¹¦µÄ»°£¬ÕâЩº¯Êý·µ»ØÒ»¸öÇøÓò¾ä±úhRgn£¬ÇøÓòºÍ»±Ê¡¢»Ë¢µÈÒ»Ñù£¬¶¼ÊÇGDIµÄ¶ÔÏó£¬Èç¹û²»ÔÙʹÓÃÒ»¸öÇøÓò£¬ÐèÒªÓÃDeleteObject½«Ëüɾ³ý¡£
2¡£¡¡ºÏ²¢ÇøÓò
½öʹÓÃÉÏÃæµÄº¯Êý¿ÉÄÜÓÃ;²»ÊǺܴ󣬵«Êǽ«²»Í¬ÐÎ×´µÄÇøÓò°´ÕÕ¸÷ÖÖ·½Ê½ºÏ²¢ÆðÀ´£¬Óô¦¾Í´óÁË£¬¿ÉÒÔÒò´Ë¶¨Òå³öºÜ¸´ÔÓµÄÇøÓò¡£ÒªºÏ²¢ÇøÓò¿ÉÒÔʹÓú¯Êý£º
invoke¡¡¡¡bineRgn£¬hDestRgn£¬hSrcRgn1£¬hSrcRgn2£¬dwbine
¸Ãº¯Êý½«hSrcRgn1ºÍhSrcRgn2Á½¸öÇøÓòºÏ²¢ÆðÀ´·ÅÈëhDestRgnÖ¸¶¨µÄÇøÓò¾ä±úÖУ¬µ«hDestRgn²¢²»ÊÇÐÂÉú³ÉµÄ£¬Ëü±ØÐëÊÇÒ»¸öÒѾ´æÔÚµÄÇøÓò¾ä±ú£¬µ±º¯ÊýÖ´Ðкó£¬hDestRgnÖÐÔÀ´µÄÇøÓò»á±»ÆÆ»µ²¢Ìæ»»³Éкϲ¢³ÉµÄÇøÓò£¬µ«¿ÉÒÔ¶ÔhDestRgnºÍhSrcRgn1ʹÓÃͬһ¸ö¾ä±ú£¬ÕâÑù¾ÍÏ൱ÓÚ°ÑhSrcRgn2ºÏ²¢µ½hSrcRgn1ÖÐÈ¥¡£
dwbineÖ¸¶¨Á˺ϲ¢µÄ·½Ê½£¬Ëü¿ÉÒÔÊÇÒÔϵÄÈ¡Öµ£º
¡ñ¡¡¡¡¡¡RGN_AND¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊÇÁ½¸öÇøÓòµÄ¹²Í¬²¿·Ö¡£
¡ñ¡¡¡¡¡¡RGN_COPY¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊÇhSrcRgn1ÖеÄÇøÓò¡£
¡ñ¡¡¡¡¡¡RGN_DIFF¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊÇhSrcRgn1ÇøÓò³ýÈ¥hSrcRgn2ÖеIJ¿·Ö¡£
¡ñ¡¡¡¡¡¡RGN_OR¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊÇÁ½¸öÇøÓòµÄµþ¼Ó¡£
¡ñ¡¡¡¡¡¡RGN_XOR¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊÇÁ½¸öÇøÓòµÄµþ¼Ó³ýÈ¥¹²Í¬²¿·Ö¡£
bineRgnº¯ÊýµÄ·µ»ØÖµ´ú±íÐÂÇøÓòµÄÐÎ×´´óÖÂÊÇʲôÑù×ӵģ¬Ëü¿ÉÄÜÊÇÒÔÏÂÖµ£º
¡ñ¡¡¡¡¡¡NULLREGION¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊÇ¿ÕÇøÓò¡£
¡ñ¡¡¡¡¡¡SIMPLEREGION¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊǸö¼òµ¥ÐÎ×´£¨¿ÉÒÔÓÃÉÏÃæµÄµ¥¸öº¯Êý´´½¨£©¡£
¡ñ¡¡¡¡¡¡PLEXREGION¡¡¡¡¡¡¡¡¡¡ÐÂÇøÓòÊǸö¸´ÔÓµÄÐÎ×´¡£
¡ñ¡¡¡¡¡¡ERROR¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡º¯ÊýÖ´Ðгö´í£¬Ã»ÓÐÇøÓò±»´´½¨¡£
3¡£¡¡ÇøÓòµÄÓÃ;
ÇøÓòÖ÷Òª¿ÉÒÔÓÃÔÚÁ½¸öµØ·½£º½¨Á¢ÌØÊâÐÎ×´µÄ´°¿ÚºÍ¶Ô»æ»ÇøÓò½øÐвüô¡£
ʹÓÃSetWindowRgnº¯Êý¿ÉÒÔʹ´°¿ÚµÄÐÎ×´ÓÉÇøÓòÖ¸¶¨£¬ÈçBmpClockʱÖÓ³ÌÐòÊÇÔ²Ðεģ¬µ±°ÑʱÖÓÒƶ¯µ½ÆäËû´°¿ÚÉÏÃæµÄʱºò£¬ËüµÄËĽDz¢²»¸²¸Çסϲ㴰¿Ú£¬Õâ¾ÍÊÇÒòΪ³ÌÐòÖÐÓÐÏÂÃæµÄ´úÂ룺
¡¡¡¡¡¡¡¡invoke¡¡¡¡CreateEllipticRgn£»0£»0£»CLOCK_SIZE£«1£»CLOCK_SIZE£«1
¡¡¡¡¡¡¡¡push¡¡¡¡¡¡¡¡eax
¡¡¡¡¡¡¡¡invoke¡¡¡¡SetWindowRgn£»hWinMain£»eax£»TRUE
¡¡¡¡¡¡¡¡pop¡¡eax
¡¡¡¡¡¡¡¡invoke¡¡¡¡DeleteObject£»eax
ÔÚÕ⼸¾ä´úÂëÖУ¬CreateEllipticRgnº¯Êý½¨Á¢ÁËÒ»¸öÔ²ÐεÄÇøÓò²¢ÔÚeaxÖзµ»ØÇøÓò¾ä±ú£¬SetWindowRgnº¯Êý¸ù¾ÝÕâ¸öÇøÓòÉèÖÃʱÖÓ´°¿ÚµÄÐÎ×´¡£Èç¹û½¨Á¢ÁËÒ»¸öºÜ¸´ÔÓµÄÇøÓò£¬ÄÇô´°¿ÚµÄÐÎ״ͬÑù»áºÜ¸´ÔÓ¡£SetWindowRgnµÄ×îºóÒ»¸ö²ÎÊýΪTRUE£¬±íʾÉèÖô°¿ÚÐÎ×´ºóWindowsÒª·¢ËÍÒ»¸öWM_PAINTÏûÏ¢½«´°¿ÚÖØ»¡£
ÓÉÓÚWindows¶ÔʹÓõÄÇøÓò±£´æÒ»¸ö¿½±´£¬ËùÒÔ³ÌÐòÔÚµ÷ÓÃSetWindowRgnº¯Êýºó¾Í¿ÉÒÔʹÓÃDeleteObject°ÑÇøÓòɾ³ýµô£¬²¢²»ÐèÒªÔÚÍ˳öʱ²Åȥɾ³ý¡£
ÁíÍ⣬ÇøÓò¿ÉÒÔÓÃÀ´¶Ô»æ»ÇøÓò½øÐвüô£¬ÈÎÒâʹÓÃÏÂÃæµÄÁ½ÌõÓï¾äÖ®Ò»£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡SelectObject£¬hDC£¬hRgn
¡¡¡¡¡¡¡¡invoke¡¡¡¡SelectClipRgn£¬hDC£¬hRgn
ÄÇôÒÔºóÔÚhDCÉÏʹÓûæͼº¯ÊýµÄ»°£¬Ö»ÓÐhRgnÖ¸¶¨µÄÇøÓòÖеĵã²Å»á±»»æ»£¬¶Ô²Ã¼ôÇøÓòÍâµÄ»æͼ½«±»ºöÂÔ¡£Í¬Ñù£¬Windows»á¶ÔÑ¡ÈëDCµÄÇøÓò½¨Á¢Ò»¸ö¿½±´£¬Èç¹ûÒÔºó²»ÐèÒªÕâ¸öÇøÓòÁË£¬ÄÇôÔÚº¯ÊýÖ´Ðк󣬿ÉÒÔÂíÉÏÓÃDeleteObjectº¯Êý°ÑËüɾ³ýµô¡£
7¡£5¡£2¡¡¡¡Ê¹Ó÷¾¶
1¡£¡¡´´½¨Â·¾¶
·¾¶²¢²»ÊÇGDI¶ÔÏó£¬Ëü²¢Ã»ÓÐÒ»¸ö¾ä±ú£¬Windows¶Ôÿ¸öDCÔÚÄÚ²¿±£´æÒ»¸ö·¾¶£¬Ã¿´ÎпªÊ¼½¨Á¢Ò»¸ö·¾¶£¬ÔÓеÄ·¾¶¾Í»á±»ÆÆ»µµô¡£Èç¹ûÒª½¨Á¢Ò»¸ö·¾¶£¬¿ÉÒÔʹÓÃBeginPathº¯Êý£º
invoke¡¡¡¡BeginPath£¬hDC
µ÷ÓÃÁËÕâ¸öº¯ÊýÒԺ󣬶ÔhDCʹÓûÏߺ¯ÊýËù»µÄÏßÌõ¶¼»á±»µ±×ö·¾¶¼Ç¼£¬Ê¹ÓûÏߺ¯Êý»³öÀ´µÄÏßÌõ¿ÉÄÜÊDz»Á¬ÐøµÄ£¬±ÈÈçµ÷Óöà´ÎµÄLineToº¯Êý£¬×îºóÒ»µãºÍ¿ªÊ¼Ò»µã²»Í¬£¬ÕâʱÐèҪʹÓÃCloseFigureº¯Êý½«Â·¾¶·â±ÕÆðÀ´£º
invoke¡¡¡¡CloseFigure£¬hDC
CloseFigureº¯Êý´Ó×îºóÒ»µãµ½µÚÒ»µã»Ò»ÌõÖ±Ïß°Ñ·¾¶·â±ÕÆðÀ´¡£WindowsÔÊÐí´´½¨¶à¸ö×Ó·¾¶£¬·â±ÕÇ°ÃæÒ»Ìõ·¾¶ÒԺ󣬿ÉÒÔ¼ÌÐø¡°È¦¡±³öºÍÇ°Ãæ·¾¶²»ÏàÁ¬µÄÁíÒ»Ìõ·¾¶¡£
×îºó£¬Ê¹ÓÃEndPathº¯Êý½áÊø´´½¨Â·¾¶£º
invoke¡¡¡¡EndPath£¬hDC
ͼ7¡£11ʾ·¶ÁËÒ»´Î´´½¨Â·¾¶µÄ¹ý³Ì£¬ÔÚµÚ1²½µ÷ÓÃBeginPathºÍµÚ11²½µ÷ÓÃEndPathÖ®¼ä£¬ÓÃLineToº¯ÊýºÍRectangle»³öÁË°üº¬Á½¸öÈý½ÇÐκÍÒ»¸ö¾ØÐεÄ·¾¶£¬ÆäÖÐÁ½¸öÈý½ÇÐÎÓÃCloseFigureÈ¥·â±Õ¡£
ͼ7¡£11¡¡¡¡Â·¾¶´´½¨¹ý³Ì
2¡£¡¡Ê¹Ó÷¾¶
´´½¨ÁË·¾¶ÒԺ󣬿ÉÒÔ½øÐÐÏÂÃæµÄ²Ù×÷¡£
Ê×ÏÈ£¬¿ÉÒÔ¶Ô·¾¶½øÐлÏß²Ù×÷£¬»òÕ߶Ô·¾¶Î§ÆðÀ´µÄÇøÓò½øÐÐÌî³ä²Ù×÷£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡StrokePath£¬hDC¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»£¨1£©
¡¡¡¡¡¡¡¡invoke¡¡¡¡FillPath£¬hDC¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»£¨2£©
¡¡¡¡¡¡¡¡invoke¡¡¡¡StrokeAndFillPath£¬hDC¡¡¡¡¡¡¡¡¡¡¡¡£»£¨3£©
µÚ£¨1£©¸öº¯ÊýÑØ×Å·¾¶Óõ±Ç°»±Ê»æ»ÏßÌõ£¬µÚ£¨2£©¸öº¯ÊýʹÓõ±Ç°»Ë¢Ìî³ä·¾¶Î§ÆðÀ´µÄÇøÓò£¬µÚ£¨3£©¸öº¯Êý¼ÈʹÓõ±Ç°»±Ê»æ»±ßÏßҲʹÓõ±Ç°»Ë¢Ìî³äÖмäÇøÓò¡£µ±Ö´ÐÐÁËÈκÎÒ»¸öº¯ÊýµÄʱºò£¬Â·¾¶¶¼»á±»ÆÆ»µµô¡£Êµ¼ÊÉÏ£¬ÕâЩº¯ÊýÍê³ÉµÄ¹¦ÄܾÍÏ൱ÓÚ7¡£2¡£3
½ÚÖеĻÏߺÍÌî³äº¯Êý£¬ÄÇôΪʲôҪÕâÑù´ó¶¯¸É¸êÄØ£¿Î©Ò»µÄºÃ´¦¾ÍÊÇÓÃÕâÖÖ·½·¨¿ÉÒÔ²Ù×÷ºÜ¸´ÔÓµÄÐÎ×´£¬ÒòΪ¶¨Òå·¾¶Ê±¿ÉÒÔʹÓÃÈκλÏߺ¯Êý£¬°üÀ¨»»¡Óë»±´Èû¶ûÇúÏߺ¯ÊýµÈ£¬¶øÓÃÆÕͨµÄÌî³äº¯ÊýÊÇÎÞ·¨Ìî³ä³öÒ»¸öÓɱ´Èû¶ûÇúÏßΧ³ÉµÄÇøÓòµÄ¡£
·¾¶µÄÁíÒ»¸öÓÃ;ÊǶ¨ÒåÒ»¸ö¸´ÔÓÐÎ×´µÄÇøÓò£¬¿ÉÒÔʹÓÃÏÂÃæµÄº¯Êý½«Â·¾¶×ª»¯³ÉÇøÓò£º
¡¡¡¡¡¡¡¡invoke¡¡¡¡PathToRegion£¬hDC
¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡hRgn£¬eax
ÀíÓÉÊÇͬÑùµÄ£¬ÒòΪÓÃÇøÓò´´½¨º¯Êý´´½¨³öÀ´µÄÖ»ÄÜÊÇÍÖÔ²¡¢¾ØÐΡ¢¶à±ßÐεÈÐÎ×´µÄ×éºÏ£¬ÓÃÏÈ´´½¨Â·¾¶ÔÙת»¯³ÉÇøÓòµÄ·½·¨¿ÉÒÔ¶¨ÒåÐÎ×´¸´ÔӵöàµÄÇøÓò¡£Í¬Ñù£¬Ö´ÐÐÁËPathToRegionº¯ÊýÒÔºó£¬ÔÓеÄ·¾¶¶¨Òå¾Í»á±»ÆÆ»µµô¡£
¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡
µÚ8Õ¡¡Í¨ÓöԻ°¿ò
8¡£1¡¡Í¨ÓöԻ°¿ò¼ò½é
¡¡¡¡¡¡¡¡
Windows²Ù×÷ϵͳΪһЩ³£Óù¦ÄÜÌṩÁËһЩͨÓöԻ°¿ò£¨mon¡¡Dialog¡¡Box£©£¬±ÈÈçÔÚ²»Í¬µÄÓ¦ÓóÌÐòÖнøÐдò¿ªÎļþ¡¢Ñ¡Ôñ×ÖÌ塢ѡÔñÑÕÉ«µÈ²Ù×÷ʱ£¬²»Í¬³ÌÐòÏÔʾµÄ¶Ô»°¿òµÄÄ£Ñù¶¼ÊÇÒ»ÑùµÄ¡£ÁíÍ⣬°ÑͬÑùµÄÓ¦ÓóÌÐò·Åµ½²»Í¬°æ±¾µÄWindowsÏÂÖ´ÐоͻᷢÏÖ£¬ÕâЩ¶Ô»°¿ò»áËæ×ŲÙ×÷ϵͳ°æ±¾µÄ²»Í¬¶ø²»Í¬£¬Èçͼ8¡£1Ëùʾ£¬Ñ¡ÔñͬÑùµÄ¡°´ò¿ª¡±Îļþ²Ëµ¥Ïîʱ£¬ÔÚWindows¡¡XPÏÂÏÔʾµÄ¶Ô»°¿òÊÇ×ó±ßµÄÑù×Ó£¬¶øÔÚWindows¡¡98ÏÂÏÔʾµÄÊÇÓұߵÄÑù×Ó£¬µ«³ÌÐòÖв¢Ã»ÓÐΪ²»Í¬°æ±¾µÄ²Ù×÷ϵͳÉè¼Æ²»Í¬µÄ¶Ô»°¿ò¡£Ôì³ÉÕâЩÏÖÏóµÄÔÒò¾ÍÊÇÕâЩ¶Ô»°¿òÊDzÙ×÷ϵͳÌṩµÄ£¬ÊµÏÖ¶Ô»°¿òµÄ´úÂë°üÀ¨ÔÚdlg32¡£dll¿âÎļþÖУ¬ÓÉÓÚ²»Í¬°æ±¾µÄdlg32¡£dllÔÚÉè¼ÆÉÏ¿ÉÄÜÓÐËù²»Í¬£¬ËùÒÔ²»Í¬°æ±¾WindowsϵĶԻ°¿ò»áÓÐËù²»Í¬¡£
ͼ8¡£1¡¡¡¡²»Í¬²Ù×÷ϵͳϵġ°´ò¿ª¡±Îļþ¶Ô»°¿ò
8¡£1¡¡¡¡Í¨ÓöԻ°¿ò¼ò½é
ͨÓöԻ°¿òº¯ÊýÓÉdlg32¡£dllÌṩ£¬ËùÒÔÔÚʹÓÃ֮ǰÐèÒªÔÚÔ´³ÌÐòÖаüº¬ÏàÓ¦µÄincludeºÍincludelibÓï¾ä£º
¡¡¡¡¡¡¡¡include¡¡¡¡¡¡¡¡¡¡dlg32¡£inc
¡¡¡¡¡¡¡¡includelib¡¡¡¡dlg32¡£lib
WindowsÌṩ¶àÖÖͨÓöԻ°¿ò£¬Ã¿ÖÖͨÓöԻ°¿ò¶¼Ê¹ÓÃÒ»¸öרÓõĺ¯ÊýÀ´´´½¨ºÍÏÔʾ£¬ÁíÍ⣬Ìṩһ¸öÊý¾Ý½á¹¹¹©³õʼ»¯¶Ô»°¿òʹÓ㬲¢ÔÚͬһ¸öÊý¾Ý½á¹¹Öзµ»ØÓû§ÔÚ¶Ô»°¿òÖÐÊäÈëµÄÊý¾Ý¡£Ê¹ÓÃÕ