(译)win32asm实例-7

Cocos Creator safari浏览器横屏全屏如何隐藏地址栏? safar浏览器中只有一个Creator网页,横屏后会自动全屏,但是如果有多个网页,Creator网页横屏后safar浏览器无法全屏.关于此问题,解决文案如下,供大家参考 一、将项目打包,找到打包出的index.html文件,在html文件里,添加一个div标签和一个文本提示,代码如下: <body> <canvas id="GameCanvas" oncontext... 阅读详情
 
7.0 - Drawing the tiles画图块

The tile control is already made, now it's time for the drawing of the tiles. The tile image can be one of these images:

图块控件已经被创建了,现在是画图块的时候了。图块的图象可以是这些图象中的一个:

  • Numbered tiles (just a matrix of numbers)
  • The demo bitmap (a resource)
  • A bitmap the user chooses
  • 编号的图块(只是数字矩阵)
  • 演示位图(一个资源)
  • 用户选择的位图

For now we will use the numbered tiles, the bitmap stuff will be added later. Furthermore, there are 4 color schemes.

现在,我们将使用编号的图块,位图的内容将在后面添加。此外,还有4种颜色。

7.1 - How it works它是如何工作的

We'll use device contexts many times. A device context is a set of graphic objects that affect the output. These graphic objects can be pens, bitmaps, brushes, palette etc. The device contexts we use are:

我们将多次使用device context(设备环境)。一个device context是一些影响输出的图形物体的集合。这些物体可以是penbitmapbrushespalette等。我们使用的device context有:

  • Device contexts (DCs) of windows (The bitmap object in these DCs is what you actually see of the control)
  • Back buffer DC. All the drawing will first be done on a so called back buffer. This prevents flickering as drawing directly to a control will show the process of drawing as well.
  • Image DC. This DC contains the tile image currently used (numbered tiles/demo bitmap/user bitmap).
  • 窗口的device contextDC)(这些DC中的图象是你实际看见的控件)
  • Back buffer DC。所有的绘画工作在一个所谓的back buffer中事先完成。这克服了直接绘出控件的闪烁和显示绘出过程等困难。
  • 图象DC。这个DC包含了当前使用的图块的图象(编号的图块、演示图片、用户图片)

First the bitmap the user chooses, (the numbered tiles, which are drawn at runtime, the demo bitmap or a user bitmap), is put in the ImageDC. Then the 3D effect of the tiles (highlites and shadows) are drawn on the bitmap in the DC. Now remember this: The imageDC will not change from here, only if the user selects another tile type. The drawing is done tile by tile on the back buffer. For each tile, the tile is extracted from the ImageDC, then placed at the current position of that tile. An array will hold the tile positions.

首先,用户选择的图片(在运行时绘出的编号图块,演示图片,或用户图片)被放入图象DC。然后图块的3d效果在DC中绘在图片上。现在记住这个:在这,图象DC不会改变。只有当用户选择了另一个图块类型时才会。绘画工作是在back buffer中一图块一图块的完成的。对于每个图块,那个图块从图象DC中展开,然后放入那个图块的当前位置。一个数组将保存这些图块的位置。

7.2 - Creating the graphic objects创建图象物体

A new procedure is introduced, InitBitmaps:

引入一个新的过程,InitBitmap

InitBitmaps         PROTO   STDCALL :DWORD
[in your .data?]
BackBufferDC        dd  ?
hBackBuffer         dd  ?
ImageDC             dd  ?
hImage              dd  ?
hBackgroundColor    dd  ?
hTileColor          dd  ?
hFont               dd  ?
TextColor           dd  ?
[in your .data]
FontFace            db  "Arial",0
[in your .code]
;================================================================================
;                           Init Bitmaps
;================================================================================
InitBitmaps proc hWnd:DWORD
; Create DC's for backbuffer and current image
    invoke  CreateCompatibleDC, NULL
    mov     BackBufferDC, eax
    
    invoke  CreateCompatibleDC, NULL
    mov     ImageDC, eax

; Create bitmap for backbuffer:
    invoke  GetDC, hWnd
    push    eax
    invoke  CreateCompatibleBitmap, eax, 200+20,200+20
    mov     hBackBuffer, eax
    pop     eax
    invoke  ReleaseDC, hWnd, eax
    invoke  SelectObject, BackBufferDC, hBackBuffer
    
; Create Arial font for the numbers 
    invoke  CreateFont, -30, NULL, NULL, NULL, FW_EXTRABOLD, /
            FALSE, FALSE, FALSE, NULL, NULL, NULL, NULL, NULL, ADDR FontFace
    mov     hFont, eax

; Select font in Image DC
   invoke   SelectObject, ImageDC, hFont
   
   invoke   CreateSolidBrush, 0FF8000h
   mov      hBackgroundColor, eax
   invoke   CreateSolidBrush, 0FF8080h
   mov      hTileColor, eax
   
   mov      TextColor, 0800000h
ret
InitBitmaps endp

Let's examine the procedure step by step:

让我们一步步的看这个过程:

    invoke  CreateCompatibleDC, NULL
    mov     BackBufferDC, eax
    
    invoke  CreateCompatibleDC, NULL
    mov     ImageDC, eax

CreateCompatibleDC creates a new DC that is compatible with a given window. If NULL is given as parameter (window handle), it is compatible with the default window. One DC is created for the backbuffer, the handle is stored in BackBufferDC. The other is for the image DC, stored in ImageDC.

CreateCompatibleDC创建一个和给定的窗口兼容的新的DC。如果NULL作为参数(窗口句柄)给出,它是和缺省窗口兼容。一个为back buffer创建的DC的句柄保存在backbufferDC中。另一个是图象DC,存于ImageDC中。

    ; Create bitmap for backbuffer:
    invoke  GetDC, hWnd
    push    eax
    invoke  CreateCompatibleBitmap, eax, 200+20,200+20
    mov     hBackBuffer, eax
    pop     eax
    invoke  ReleaseDC, hWnd, eax
    invoke  SelectObject, BackBufferDC, hBackBuffer

CreateCompatibleBitmap creates a new bitmap object that is compatible with a given DC. First we get the DC of the main window with GetDC. The handle is pushed onto the stack to save it for ReleaseDC. CreateCompatibleBitmap is then called, with the main window DC as DC, and 220x220 as bitmap size. The extra 20 pixels are for the margins. The bitmap handle is saved in hBackBuffer, the window DC handle is popped of the stack again and released (ReleaseDC should always be used with GetDC). Finally, SelectObject selects a graphic object in a DC. Here, the bitmap just created is put in the backbuffer DC.

CreateCompatibleBitmap创建一个和给定的DC兼容的图片对象。首先我们用GetDC获得主窗口的DC。这个句柄为ReleaseDC压入栈中保存。然后用主窗口的DC220×220作为图片大小调用CreateCompatibleBitmap。额外的20象素用于边框。图片句柄存于hBackBuffer,窗口DC句柄再被弹出栈然后释放(ReleaseDC总是和GetDC一起使用)最后,SelectObjectDC中选择一个图片对象。这儿,刚创建的bitmap被放入backbufferDC中。

; Create Arial font for the numbers 
    invoke  CreateFont, -30, NULL, NULL, NULL, FW_EXTRABOLD, /
            FALSE, FALSE, FALSE, NULL, NULL, NULL, NULL, NULL, ADDR FontFace
    mov     hFont, eax

; Select font in Image DC
   invoke   SelectObject, ImageDC, hFont

To draw the numbers on the tiles, we need a font. CreateFont creates such a font. Look it up in your reference, FontFace is the name of the font, "Arial". -30 is a size for the font. The handle for the font is saved in hFont and then the font is selected in the ImageDC so we can write with the font on the image DC.

要在图块上画数字,我们要字体。CreateFont创建这样一个字体。在你的参考中查找它。FontFace是字体名,“Arial”,-30是字体的大小。字体的句柄存于hFont中然后字体被ImageDC选择因而我们可以在imageDC中用这个字体写字了。

   invoke   CreateSolidBrush, 00FFFFFFh
   mov      hBackgroundColor, eax
   invoke   CreateSolidBrush, 00FF0000h
   mov      hTileColor, eax
   
   mov      TextColor, 000000h

Finally, a few brush handles are made, they are not selected in any DC right now, but they will be later. CreateSolidBrush creates a brush with a certain color, you can use the handle to draw things (lines etc) with the brush. TextColor is not a brush, it's just a color value (we don't need a brush for the text color, only the color value).

最后,一个画刷的句柄被创建,它们现在没有被任何DC选择,但在以后会。CreateSolidBrush创建一个有一定颜色的画刷,你可以用这个句柄来用刷子画东西(比如直线)。TextColor不是刷子,它只是颜色值(我们不因文本颜色需要刷子,只是颜色值)

Note: the image bitmap is not created yet, the DC is already available, but as the user can choose the type of bitmap, this bitmap is made when the user selects a type, then it is selected in the DC.

注意:图象图片仍未被创建,DC已经存在了。但用户可以选择图片类型。图片在用户选择类型时创建,然后在DC中被选择。

A function to free all these handles is necessary too:

一个用于释放所有这些句柄的函数也是必要的:

DeleteBitmaps   PROTO STDCALL
;================================================================================
;                           Delete Bitmaps
;================================================================================
DeleteBitmaps proc
    invoke  DeleteDC, BackBufferDC
    invoke  DeleteDC, ImageDC
    invoke  DeleteObject, hImage
    invoke  DeleteObject, hBackBuffer
    invoke  DeleteObject, hFont
    invoke  DeleteObject, hBackgroundColor
    invoke  DeleteObject, hTileColor
ret
DeleteBitmaps endp

 

Then both functions should be called:

然后要调用两个函数:

...
.IF     eax==WM_CREATE
        invoke  InitControls, hWnd
        invoke  InitBitmaps, hWnd ;<<< insert here
.ELSEIF eax==WM_DESTROY
        invoke  DeleteBitmaps     ;<<< other one here
        invoke  PostQuitMessage, NULL
...

On creation of the main window, the bitmaps and DCs are initialized, before destroying, the bitmaps and DCs are deleted again.

在主窗口的创建过程中,图片和DC被初始化。在窗口摧毁前,图片和DC被再次删除。

7.3 - Tile mode图块模式

Create a new procedure, SetBitmap:

创建一个新的过程,SetBitmap

[in mosaic.inc]
IMAGETYPE_STANDARD  equ     0
IMAGETYPE_NUMBERS   equ     1
IMAGETYPE_BITMAP    equ     2

[in .data?]
CurImageType        dd      ?       ;Current image type

[in .code]
SetBitmap   PROTO   STDCALL :DWORD, :DWORD
;================================================================================
;                           Set Bitmap
;================================================================================
SetBitmap   proc hWnd:DWORD, ImageType:DWORD
    mov     eax, ImageType
    .IF eax==IMAGETYPE_NUMBERS
        ;--- delete old image ---
        invoke  DeleteObject, hImage
        ;--- Get DC ---
        invoke  GetDC, hWnd
        push    eax
        ;--- Create new bitmap for the numbers bitmap ---
        invoke  CreateCompatibleBitmap, eax, 200, 200
        mov     hImage, eax
        pop     eax
        ;--- Release DC ---
        invoke  ReleaseDC, hWnd, eax
        ;--- Select new bitmap in DC ---
        invoke  SelectObject, ImageDC, hImage
        ;--- Draw numbers on the bitmap ---
        invoke  DrawNumbers
        ;--- Create the 3D effect on the bitmap ---
        invoke  CreateTiles
    .ENDIF
    ;--- Set the new image type ---
    mov     eax, ImageType
    mov     CurImageType, eax
ret
SetBitmap   endp

The SetBitmap procedure selects the type of image to use for the tiles. The procedure takes 2 parameters: hWnd, the handle of the main window, and ImageType, which can be one of these constants: IMAGETYPE_STANDARD, IMAGETYPE_NUMBERS, IMAGETYPE_BITMAP. These constants are defined in the include file. Right now, the procedure only reacts to IMAGETYPE_NUMBERS, we will implement the other two later. When the numbers image type is chosen, the old image (hImage) is deleted, and a new one is created with CreateCompatibleBitmap. Then two functions are called, DrawNumbers and CreateTiles, which are defined in the code below. DrawNumbers just draws an array of numbers on the new bitmap. CreateTiles draws the 3D effect on the bitmap. The CreateTiles procedure will be used for the other two image types too.

SetBitmap过程选择了用于图块的图象类型。过程带2个参数,hWnd主窗口句柄和图片类型。图片类型可以为这些常数中的一个:IMAGETYPE_STANDARD, IMAGETYPE_NUMBERS, IMAGETYPE_BITMAP。这些常数在包含文件中定义了。当前,过程仅对IMAGETYPE_NUMBERS作出反应,我们将在后面实现另外的两个。当编号图片类型被选择,旧的图象(hImage)被删除,而新的由CreateCompatibleBitmap创建。然后两个函数被调用,DrawNumbers CreateTiles,它们在下面的代码中定义。Draw Numbers只是在新的图片上画上数字。CreateTiles在图片上画上3D效果。CreateTile过程也将在其他的两种图象类型中使用。

GetCoordinates  PROTO   STDCALL :DWORD
DrawNumbers     PROTO   STDCALL
.data
NumberFormat    db      "%lu",0
Rect200         RECT    <0,0,200,200>
.data?
Buffer          db      200 dup (?)
.code
;================================================================================
;                           Draw Numbers
;================================================================================
DrawNumbers proc uses ebx edi
LOCAL   TempRect:RECT
    ; --- Set the textcolor of ImageDC to TextColor ---
    invoke  SetTextColor, ImageDC, TextColor
    ; --- Fill the imageDC with the tile color brush ---
    invoke  FillRect, ImageDC, ADDR Rect200, hTileColor
    ; --- Set the background mode to transparent (for the text) ---
    invoke  SetBkMode, ImageDC, TRANSPARENT
    
    ; --- Loop through all the numbers and draw them one by one ---
    xor     ebx, ebx
    .WHILE  ebx<16
        mov     eax, ebx
        inc     eax
        invoke  GetCoordinates, eax
        mov     dx, ax      ; dx  = row
        shr     eax, 16     ; ax  = column
        and     edx, 0ffffh ; make sure that edx = dx
        imul    edx, edx, 50;} Multipy edx as well as eax with 50
        imul    eax, 50     ;} 
        mov     TempRect.left, eax
        mov     TempRect.top, edx
        add     eax, 50
        add     edx, 50
        mov     TempRect.right, eax
        mov     TempRect.bottom, edx
        mov     eax, ebx
        inc     eax
        invoke  wsprintf, ADDR Buffer, ADDR NumberFormat, eax
        invoke  DrawText, ImageDC, ADDR Buffer, -1, ADDR TempRect,/
                DT_CENTER or DT_SINGLELINE or DT_VCENTER
    inc ebx
    .ENDW
ret
DrawNumbers endp

;================================================================================
;                           GetCoordinates
;================================================================================
GetCoordinates proc dwTile:DWORD
    mov     eax, dwTile
    dec     eax
    cdq
    mov     ecx, 4
    div     ecx
    ;eax=quotient = row
    ;edx=remainder = column
    shl     edx, 16
    add     eax, edx
ret
GetCoordinates endp

Two new procedures here, GetCoordinates is a little procedure that will be used several times in the program. It uses a 0-based index of the tiles (tile 0, tile 1, tile 2) etc. and returns the row of the tile (0,1,2,3) in the low word of eax, the column of the tile (0,1,2,3) in the high word of eax. The calculation is quite simple. Divide the tile index by 4, the remainder will be the column, the quotient the row of the tile. The shl instruction shifts the colomn in the high word (shift 16 bits left), and add adds the row.

这儿有两个过程,GetCoordinates是一个将在程序中多次使用的小过程。它使用0开始的图块索引(图块0,图块1,图块2)等,并在eax的低字中返回图块所在的排(0,1,2,3),在eax的高字中返回图片所在的纵行(0,1,2,3)。计算很简单,把图块的索引除4,余数为纵行数,商为图块所在的排数。Shl指令移动高字中的行数(左移16位),而add加上排数。

The DrawNumbers procedure works like this:

DrawNumbers过程的工作原理如下:

Set textcolor to the value of the TextColor variable
Fill the complete bitmap with the tilecolor brush (rect200 is a RECT structure that defines the area of 200x200 pixels starting at (0,0))
Set the background mode to TRANSPARENT to prevent an ugly background around the text.

设置文本颜色为TextColor变量的值。用图块颜色的刷子填充完整的图片(rect200是一个定义了从(00)开始的200×200象素区域的结构)设置背景模式为TRANSPARENT,以防止难看字背景的空色。

The tile loop:

Tile循环

Loop from 0 to 15 {
    - GetCoordinates(currentloopvalue)
    - Extract row and column from return value
      multiply the row and the column with 50
      (this gives the image coordinates of the tile)
    - Fill a RECT structure (TempRect) with the coordinates of
      the tile.
    - Use wsprintf to convert the tile number into text.
      (NumberFormat is the format the number should be outputted
      in, buffer is a temporary buffer)
    - Use DrawText to draw the number at the right coordinates
}

015开始循环{

-获得坐标(当前的循环值)
-从返回值中解开行和列的值。用行数和列数乘以50(这给出了图块的图象坐标)
-用图块坐标填写RECT结构(临时结构)
-使用wsPrint把图块数翻译为文本。(NumberFormat是数字应被输出的给世,buffer是一个临时缓存)
-使用DrawText在恰当处绘出数字。

CreateTiles draws the button-style 3D effect on the tiles by drawing black & white lines at the right places:

CreateTiles通过在恰当地方会上黑和白的线条在图块上绘出3D效果。

CreateTiles     PROTO   STDCALL
;================================================================================
;                           Create Tiles
;================================================================================
CreateTiles proc uses ebx esi edi
    invoke  GetStockObject, BLACK_PEN
    invoke  SelectObject, ImageDC, eax
; Dark lines, vertical. x = 50k - 1 (k=1,2,3,4)
; ebx = k
; esi = x
    xor     ebx, ebx    
    inc     ebx 
    ; ebx is 1 now
    
    .WHILE  ebx<5   ; (ebx= 1,2,3,4)
        mov     eax, 50
        mul     ebx
        mov     esi, eax
        dec     esi
        invoke  MoveToEx, ImageDC, esi, 0, NULL
        invoke  LineTo, ImageDC, esi, 199
    inc ebx
    .ENDW

; Dark lines, horizontal. y = 50k - 1 (k=1,2,3,4)
; ebx = k
; esi = y
    xor     ebx, ebx    
    inc     ebx 
    ; ebx is 1 now
    .WHILE  ebx<5   ; (ebx= 1,2,3,4)
        mov     eax, 50
        mul     ebx
        mov     esi, eax
        dec     esi
        invoke  MoveToEx, ImageDC, 0, esi, NULL
        invoke  LineTo, ImageDC, 199, esi
    inc ebx
    .ENDW
    invoke  GetStockObject, WHITE_PEN
    invoke  SelectObject, ImageDC, eax
; Light lines, vertical. x = 50k  (k=0,1,2,3)
; ebx = k
; esi = x
    xor     ebx, ebx    

    .WHILE  ebx<4   ; (ebx= 0,1,2,3)
        mov     eax, 50
        mul     ebx
        mov     esi, eax
        invoke  MoveToEx, ImageDC, esi, 0, NULL
        invoke  LineTo, ImageDC, esi, 199
    inc ebx
    .ENDW

; Light lines, horizontal. y = 50k (k=0,1,2,3)
; ebx = k
; esi = y
    xor     ebx, ebx    

    ; ebx is 1 now
    
    .WHILE  ebx<4   ; (ebx= 0,1,2,3)
        mov     eax, 50
        mul     ebx
        mov     esi, eax
        invoke  MoveToEx, ImageDC, 0, esi, NULL
        invoke  LineTo, ImageDC, 199, esi
    inc ebx
    .ENDW
    
ret
CreateTiles endp

This procedure is quite easy to understand. It draws 4 sets of lines. Each line is drawn by first getting a brush with GetStockObject (retrieves a standard brush color from windows). This brush is selected in the imagedc. Then the current point is moved to the startpoint of the line with MoveToEx, and the line is drawn with LineTo.

这个过程很容易理解。它画4条线。每条线先由GetStockObject获得刷子(从窗口取得标准刷颜色)。这个刷子在imageDC中被选择然后当前位置被MoveToEX移到线的起点,而线由LineTo绘出。

7.4 – Drawing绘画

The procudure below will be used in the future too, but the code of it is temporary right now, it just draws the image DC on the static control to show if your code worked. Furthermore, some additional procedures are introduced to initialize everything correctly.

下面的过程也将在以后使用。但它的代码现在暂时是正确的。它只是在静态控件上画imageDC来显示你的代码是否在工作。此外,附加的过程被用来正确的初始化每一件东西:

DrawProc    PROTO   STDCALL :DWORD, :DWORD
InitGame    PROTO   STDCALL :DWORD


[in .code]

;================================================================================
;                           Draw Numbers
;================================================================================
DrawProc proc uses ebx edi esi hWnd:DWORD, hDC:DWORD
    invoke  BitBlt, hDC, 9, 9, 220, 220, ImageDC, 0, 0, SRCCOPY
ret
DrawProc endp
;================================================================================
;                           InitGame
;================================================================================
InitGame    proc    hWnd:DWORD
    invoke  SetBitmap, hWnd, IMAGETYPE_NUMBERS
ret
InitGame    endp


[In the WM_CREATE handler of WndProc, below 'invoke InitBitmaps, hWnd']
    invoke      InitGame, hWnd
[In the messagehandler in WndProc, between the other ELSEIFs]
    .ELSEIF eax==WM_DRAWITEM
        mov     eax, wParam
        .IF     eax==CID_STATIC
            push    ebx
            mov     ebx, lParam
            assume  ebx:ptr DRAWITEMSTRUCT
            invoke  DrawProc, hWnd, [ebx].hdc
            assume  ebx:nothing
            pop     ebx
            xor     eax, eax
            inc     eax
        .ELSE
            xor     eax, eax
        .ENDIF

The DrawProc and InitGame are fairly easy to understand. BitBlt copies a part of a bitmap from one DC to another. Here the complete bitmap in ImageDC is copied to the DC of the static control window.

DrawProcInitGame相当容易理解。BitBlt从一个DC拷贝一部分图片到另一个中。这儿,ImageDC中的完整的图片被拷贝到静态控件窗口的DC中。

The WM_DRAWITEM message requires some more explanation:
WM_DRAWITEM is sent to the main window when one of the owner-drawn controls needs to be drawn. An owner-drawn control is a control that is drawn by the program instead of windows. When this message is sent, wParam contains the ID of the control that needs to be drawn. Here the .IF eax==CID_STATIC finds out if it is the static control (the tiles window) that needs to be drawn. If not (.ELSE), 0 is returned from WndProc (xor eax, eax). 0 tells windows that the message is not handled by the program. lParam is a pointer to a DRAWITEMSTRUCT.

WM_DRAWITEM消息需要更多一些的解释:
当一个ownerdrawn控件需要绘出时,WM_DRAWITEM被发往主窗口。一个ownerdrawn控件是一个由程序而不是由Windows来绘出的控件。消息被发送时,wParam包含了需要绘出的控件的ID。这儿,.IF eax== CID_STATIC找出它是否是需要绘出的静态控件(图块窗口)。如果不是(.ELSE,WndProc返回0xor eax, eax)。0告诉Windows这个消息没有被程序处理。Iparam是一个指向DRAWITEMSTRUCT的指针。

 mov     ebx, lParam
 assume  ebx:ptr DRAWITEMSTRUCT
 invoke  DrawProc, hWnd, [ebx].hdc
 assume  ebx:nothing

First, lParam is put in ebx. Now ebx is a pointer to the DRAWITEMSTRUCT structure. The assume statement gives masm more information about the register. assume ebx:ptr DRAWITEMSTRUCT tells masm that ebx is a pointer to a DRAWITEMSTRUCT structure. Now you can use the structure members directly on ebx. hdc is one of these members, it contains the handle to the device context of the window. The control will show whatever there is on that DC. This DC is passed to DrawProc. Don't forget to tell masm to assume nothing for ebx (assume ebx:nothing), otherwise masm thinks ebx is a pointer to DRAWITEMSTRUCT throughout the whole program. Very important is that you should save ebx in your procedures (that's why the push ebx/pop ebx instructions are included). Windows assumes the values of the ebx, esi and edi registers do not change when your window procedure is called by windows (this applies to all callback functions in windows, always save ebx, esi & edi).

首先,Iparam被放入ebx。现在ebx是一个指向DRAWITEMSTRUCT结构的指针。Assume语句告诉masm关于寄存器的更多信息。Assume ebx:ptr DRAWITEMSTRUCT告诉masm ebx是一个指向DRAWITEMSTRUCT结构的指针。现在你可以使用ebx中的结构成员了。控件将告诉你在那个DC中有什么。这个DC被传递给DrawProc。不要忘记告诉masm assume nothing fo ebx(assume ebx:nothing),否则masm在整个程序都会认为ebx是指向DRAWITEMSTRUCT的指针。非常重要的是你应该在你的过程中保存ebx(这是包含push ebx/pop ebx指令的原因)。Windows假定在你的窗口过程被windows调用时,ebxesiedi寄存器的值不会改变(这对Windows中的所有回调函数都是这样,总是保存ebxesiedi

7.5 – Done完事

The current project files are here: mosaic4.zip

当前的工程文件在这儿:mosaic4.zip

If you assemble the program and run it, you should see this:

如果你汇编程序并运行它,你将看到:

As you can see, the tiles are drawn correctly.

正如你可以看到哦,图块被正确的绘出。

用WPF做一个简易浏览器 微软的WPF(Windows Presentation Foundation)是目前Windows平台上最好用的图形界面框架了。如果想在Windows平台上编写图形界面程序,而且没有跨平台且性能需求比较高,而且对C#语言比较熟悉,那么WPF就是最适合你的了。WPF虽然出来也有大概十来年了,但是它的很多设计思想还是非常先进的,配合C#这门语言的话更加顺手。WPF的界面设计和程序功能完全解耦,也就是说设 阅读详情

相关推荐

若依ruoyi框架实现单点登录或者接入统一认证

log.info("单点登录用户[{}]不存在, 需要创建.", loginName);log.info("单点登录用户[{}]已存在.", loginName);jsonObjectData.put("nickName","单点1");if (code.equals("0")) {//验证成功需要自动登录。jsonObject.put("msg","验证成功");ajax.put("msg", "登录成功");

GitHub质检员 2万+

Win32Asm教程

  导言先来对这个教程做个小小的介绍。Win32Asm不是一个非常流行的编程语言,而且只有为数不多(但很好)的教程。大多数教程都集中在编程的win32部分(例如,WinAPI,标准Windows编程技术的使用等),而不是汇编语言本身,例如伪代码(opcodes),寄存器(registers)的使用等。虽然你能在其他教程中找到这些内容,但那些教程通常是解释Dos编程的。它当然可以帮你学习汇编语言,...

weixin_34054931的博客 297

什么是 SAPGUI 里的 Logon Group/Server

这意味着,不同的用户连接可以被分配到不同的应用服务器,以实现均衡的资源利用和降低某一服务器的负载压力。在这种配置下,欧洲的用户登录时选择“EUROPE_GROUP”,系统将自动选择一个位于欧洲的数据中心的服务器进行连接,这样不仅减少了网络延迟,还实现了服务器间的负载均衡。用户在 SAPGUI 中登录时,只需选择相应的 Logon Group(例如“FIN_GROUP”),系统就会自动将他们的连接请求分配到当前负载最小的应用服务器上,这种动态分配大大提升了系统的响应速度和稳定性。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1023

html隐藏浏览器输入网址,ie地址栏 IE浏览器地址栏无法输入网址

电脑里的浏览器地址栏在什么位置?地址栏中输入“我的电脑”,回车后后可直接进入“我的电脑”地址栏中输入“回收站”打开回收站,删除或恢复其中的文件。怎么让IE浏览器里显示地址栏打开IE浏览器,点击”工具“-Internet选项。打开后,点击”内容“自动完成设置;在弹出的页面勾驯地址栏“确定即可。浏览器的地址栏就是一个浏览器输入网址的地方,在浏览器地址栏输入要打开的网址杰即可打开对应的网站。 1,首先,...

weixin_39599654的博客 702

桌面计算机地址栏在哪,电脑窗口地址栏清理

1、任意网页窗口-----"工具"----"Intrenet选项",(或者右键点击桌面的IE浏览器,选择属性)在弹出的对话框中的“常规”窗口,点击"清除历史记录"按钮。这时再查看IE的地址栏,就会发现地址栏中以“ http ://”打头的网址都被删除了。2、上面的方法只可以删除掉那些以“ http ://”开头的网址,但剩下的中文实名却没有被删除掉,而且显得更加醒目,如果想要删除掉这些中文实名的话...

weixin_30125993的博客 2122

Qt获取IE地址栏内容

Qt获取IE地址栏内容:

我一路走来--- 7787

计算机地址栏搜索记录怎么删除,怎么删除网址?如何删除浏览器地址栏的网址历史记录和搜索记录...

怎么删除网址?如何删除浏览器地址栏的网址历史记录和搜索记录腾讯视频/爱奇艺/优酷/外卖 充值4折起近期较多网民在询问怎么删除网址记录?怎么把网址删除,仔细查看提问,发现这些网民要删除的是浏览器地址栏的历史记录和搜索记录。某些浏览器历史记录会泄露用户隐私信息,及时删除是保护隐私的好方法。某些情况下,这些地址栏里的历史记录可能会令人比较尴尬,还有搜索引擎的历史记录。步骤/方法1、使用浏览器内置的工具删...

weixin_34117129的博客 4656

chrome 不显示地址栏_Chrome禁止混合内容的解决办法

Chrome 更新到 84 之后,混合内容会被默认阻止,本文来记录一下解决办法。背景上周,我的 Chrome 浏览器升级到了 86,当时并没有感觉到什么异常,直到发现自己的一个网站打开不显示图片了。我使用手机 Chrome 浏览器访问网站,图片显示正常,排除了图片存储商的问题,那很有可能就是浏览器升级导致的。排查查看控制台信息打开控制台,看到了如下的提示信息:这里要简单介绍一下,我使用的图片存储是...

weixin_39594312的博客 391

地址栏上的LOGO(转贴)

你是不是记得有时在浏览网易网站的首页时,在地址WWW.163.COM前会显示一个“易”字样的小图标。而默认情况下,这个图标是一个IE浏览器的指定图片。 其实这也不是什么高深技术,只不过在网站目录下添加了一个特定文件而已。 这时,我们需要预先制作一个图标文件,大小为16*16像素。文件扩展名为ico,然后上传到相应目录中。在HTML源文件“<head></head>”之间添加如下代码: <Link 

大雁北飞 2048

chrome 隐藏地址栏_谷歌又开始作妖:Chrome将隐藏地址栏/网址详细内容

谷歌浏览器此前默认隐藏地址栏网址前缀引起较多争议,尽管后来谷歌作出让步但最终默认情况下还是隐藏前缀。这些前缀主要包括HTTP、HTTPS和WWW , 但谷歌浏览器还会采取更激进的措施让用户浏览网页时忽略地址栏。谷歌浏览器金丝雀版最新测试的内容是隐藏网址详细路径内容, 也就是主域名斜杠/后的内容默认也会被自动隐藏。未来当用户使用谷歌浏览器加载网页时可能只会显示主域名,诸如网页路径层级以及...

weixin_39876002的博客 2520

chrome 不显示地址栏_Firefox 和 Chrome 为何要革 EV 证书的命

在最新版本的 Firefox 和 Chrome 中,访问使用 EV 证书的 https 站点时,地址栏不显示绿色的锁头图标和公司信息,取而代之的是和 DV 证书站点相同的灰色锁头图标。早在今年8月份,Firefox 就宣布在10月发布 70.0 版本时将取消 EV 证书的特殊显示待遇。理由大致是:额外的公司信息让用户迷惑,占用屏幕空间;强调 EV 证书影响用户认知,耽误推进让用户无感知的默认 ht...

weixin_39954908的博客 328

Tomcat发布项目时,浏览器地址栏图标的问题

原文作者:hebo_thu 最近在做一个java网络应用程序,服务器是tomcat。在默认情况下,当用户访问该网络应用时,地址栏图标显示为tomcat猫。我希望把它换成自己的图标,于是研究了一下。在研究过程中,我发现网上的资料大都语焉不详,于是把自己的研究结果分享出来。本文的测试环境为: tomcat 6.0.20 IE6 SP3 Firefox 3.6.13 搜狗高速浏览器 2

斌斌(Java) 2万+

Chrome 地址栏隐藏了“www”和“https://”解决办法

最近, Google Chrome 76 稳定版已经发布,如果已经安装,不难发现在地址栏中少了一些内容,“www”子域和“https://”被隐藏起来了。根据谷歌官方报道,早在 2018 年 9 月发布 Chrome 69 时,谷歌就从地址栏中的 URL 中隐藏“www”和“https://”,并且认为这两者是无关紧要的子域。例如,当用户访问www.google.com时,www 将被隐藏并显...

qq_32165517的博客 5951

电脑桌面上计算机有地址栏吗,电脑窗口地址栏清理

1、任意网页窗口-----"工具"----"Intrenet选项",(或者右键点击桌面的IE浏览器,选择属性)在弹出的对话框中的“常规”窗口,点击"清除历史记录"按钮。这时再查看IE的地址栏,就会发现地址栏中以“ http ://”打头的网址都被删除了。2、上面的方法只可以删除掉那些以“ http ://”开头的网址,但剩下的中文实名却没有被删除掉,而且显得更加醒目,如果想要删除掉这些中文实名的话...

weixin_39574928的博客 385

浏览器隐藏地址栏_微软新版edge浏览器使用技巧分享

微软新版edge浏览器使用技巧分享 基于Chromium的新版Edge浏览器已经开放测试,但由于是测试期,可供用户选择的功能还比较少。不过有一部分功能已经内置到浏览器中,只是尚未开放而已。这就像汽车里的刷EPU一样,没事自己玩一玩,也是蛮爽的。1。开启阅读视图阅读视图并不新鲜,Chrome和老版Edge都有,通过减少页面杂乱信息来让内容更易读。其实新版Edge也是包括阅读模式的,只是需...

weixin_39629269的博客 7441

地址栏图标更换即shortcut icon问题

为了是地址栏可以显示自己的网站图标,可以在网页添加如下代码: 注:1、后边这两句也可以不添加,图片的路径可以使相对的也可以是绝对的          2、在IE6下,图标是不会显示的,这个可以理解(百度的图标在IE6下也不显示,呵呵)。

学习,交流,积累 5262

Tomcat浏览器地址栏图标

tomcat 6.0.20IE6 SP3Firefox 3.6.13搜狗高速浏览器 2.2.0360安全浏览器 3.6.1傲游浏览器 2.5.17首先说明一下,我这个程序的用户一般使用的是基于IE6内核的外壳浏览器,比如搜狗高速浏览器、360安全浏览器和傲游浏览器等,也有少数的用户使用Firefox,所以我测试的浏览器主要就是这几款浏览器。至于其它的数得上号的浏览器,我猜本文...

weixin_34337381的博客 164

基于LSTM和SVM实现设备故障诊断matlab源码+数据集+项目说明.zip

基于LSTM和SVM实现设备故障诊断matlab源码+数据集+项目说明.zip

上一篇: (译)win32asm实例-6
下一篇: DirectX8编程指南-1
taowen2002
博客等级 码龄25年 8粉丝 61原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值