⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resedit.asm

📁 这是用win32汇编编写的资源编辑器
💻 ASM
📖 第 1 页 / 共 5 页
字号:
         mov     wc.style, CS_GLOBALCLASS
         mov     wc.lpfnWndProc, offset SizeProc
         mov     wc.lpszClassName, offset SizeClassV
         mov     wc.hIcon, 0
         mov     wc.hIconSm, 0
      INVOKE     CreateSolidBrush, 0000ff00h
         mov     hBRG, eax
         mov     wc.hbrBackground, eax
      INVOKE     LoadCursor, hInst, 898
         mov     wc.hCursor, eax
         mov     h898, eax
      INVOKE     RegisterClassEx, addr wc

         mov     wc.lpfnWndProc, offset SizeProc
         mov     wc.lpszClassName, offset SizeClassH
      INVOKE     LoadCursor, hInst, 899
         mov     wc.hCursor, eax
         mov     h899, eax
      INVOKE     RegisterClassEx, addr wc

;---------- [Register our selection class] ----------
      INVOKE     CreateSolidBrush, 000000ffh
         mov     hBRR, eax
         mov     wc.hbrBackground, eax
         mov     wc.lpfnWndProc, offset MultiProc
         mov     wc.lpszClassName, offset MultiClass
      INVOKE     LoadCursor, 0, IDC_ARROW
         mov     wc.hCursor, eax
      INVOKE     RegisterClassEx, addr wc

      .if hAsmEdit
         INVOKE     GetWindowRect, hAsmEdit, addr rect
          MOVmd     Wth, rect.right
            mov     eax, rect.left
            sub     Wth, eax
          MOVmd     Hgt, rect.bottom
            mov     eax, rect.top
            sub     Hgt, eax
            mov     ebx, rect.left
            mov     eax, rect.top
      .endif

      .if hAsmEdit && Wth > 721 && Hgt > 542 ;529
            jmp     NoCenter
      .endif

.if hAsmEdit     ; hAsmEdit = from AsmEdit
      jmp     NoCenter
.endif

;---------- [Center the window] ----------
         mov     Wth, 721
         mov     Hgt, 542 ;529
      INVOKE     GetSystemMetrics, SM_CXSCREEN
         sub     eax, 721
         shr     eax, 1
        push     eax
      INVOKE     GetSystemMetrics, SM_CYSCREEN
         sub     eax, 529
         shr     eax, 1
         pop     ebx

NoCenter:
      .if hAsmEdit
            xor     eax, eax
            xor     ebx, ebx
      .endif
         mov     ResB, 6
         mov     ResT, 22

;         mov     ecx, WS_EX_TOOLWINDOW or WS_EX_CLIENTEDGE
;         mov     edx, WS_OVERLAPPEDWINDOW or WS_CLIPSIBLINGS
;      .if !hAsmEdit
;             or     ecx, WS_EX_APPWINDOW
;             or     edx, WS_CLIPCHILDREN
;      .endif


         mov     ecx, 0
         mov     edx, WS_CLIPSIBLINGS
      .if !hAsmEdit
             or     ecx, WS_EX_TOOLWINDOW or WS_EX_APPWINDOW or WS_EX_CLIENTEDGE
             or     edx, WS_OVERLAPPEDWINDOW or WS_CLIPCHILDREN
      .elseif hAsmEdit
            and     ResB, 0
            and     ResT, 0
             or     edx, WS_CHILD ;WS_POPUP
      .endif

      INVOKE     CreateWindowEx, ecx, addr ClassName, addr AppName, edx,\
                 ebx, eax, Wth, Hgt, hAsmEdit, NULL, hInst, NULL
         mov     hWnd, eax
      .if hAsmEdit                      ; Calling programs parent
            mov     ecx, hRetParent
            mov     [ecx], eax
         INVOKE     SetParent, hWnd, hAsmEdit
      .endif
      INVOKE     ShowWindow, hWnd, SW_SHOWNORMAL
      INVOKE     UpdateWindow, hWnd

;02-09
;      INVOKE     SetWindowPos, hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_SHOWWINDOW

      .while TRUE
         INVOKE     GetMessage, addr msg, 0, 0, 0
         .break .if (!eax)

         INVOKE     IsDialogMessage, hTabSeL2, addr msg
            cmp     eax, 0
            jne     Pass

         INVOKE     TranslateMessage, addr msg
         .if hAsmREdit
               mov     ecx, hAsmREdit
               mov     eax, [ecx]
               mov     hAsmEdit, eax
         .endif
         INVOKE     GetFocus  ; Does not work with XP ?????????
         .if hAsmEdit && eax == hAsmEdit || hAsmEdit
            .if msg.wParam == (VK_CONTROL or VK_F4) && msg.lParam == 203f0001h
;                  mov     edx, 6008
;                  jmp     PostIt
            .endif
               mov     eax, msg.lParam
               shr     eax, 16
               and     eax, 000000ffh
               mov     ecx, msg.lParam
               and     ecx, 0f0000000h
            .if eax == 3fh && ecx == 0c0000000h || eax == 40h && ecx == 0c0000000h ||\
                eax == 41h && ecx == 0c0000000h
                 push     msg.wParam
               INVOKE     PeekMessage, addr msg, hWnd, VK_F5, VK_F7, PM_REMOVE
                  pop     ecx
               .if ecx == VK_F5
                  .if ParCode == 44
                        mov     edx, 6033
                  .else
                        mov     edx, 6024
                  .endif
               .elseif ecx == VK_F6
                  .if ParCode == 44
                        mov     edx, 6034
                  .else
                        mov     edx, 6025
                  .endif
               .else
                  .if ParCode == 44
                        mov     edx, 6035
                  .else
                        mov     edx, 6026
                  .endif
               .endif

PostIt:
;DSPValue hWnd, edx, 1, 't'
               INVOKE     PostMessage, hParentA, WM_COMMAND, edx, 0
                  jmp     Pass
            .endif
         .endif

         INVOKE     DispatchMessage, addr msg
Pass:
      .endw

         mov     eax, msg.wParam
         ret

WinMain ENDP

;=====================================================
; WndProc PROCEDURE
;=====================================================
WndProc PROC uses ebx edi esi hwnd:DWORD, wmsg, wparam, lparam
LOCAL    Erect:RECT
LOCAL    cm:COLORMAP
LOCAL    Wth:DWORD, Hgt, hReg
LOCAL    szBuff[256]:BYTE

      .if wmsg == WM_CREATE

         mov     osv.dwOSVersionInfoSize, sizeof OSVERSIONINFO
      INVOKE     GetVersionEx, addr osv
       MOVmd     osvMaj, osv.dwMajorVersion
       MOVmd     osvMin, osv.dwMinorVersion

;dwMajorVersion, dwMinorVersion
;                Major Minor
;Windows 95      4     0
;Windows 98      4     10
;Windows Me      4     90
;Windows NT 3.51 3     51
;Windows NT 4.0  4     0
;Windows 2000    5     0
;Windows XP      5     1

;---------- [Create the status bar window] ----------
         INVOKE     CreateWindowEx, 0, addr StatClass, 0,\
                    WS_CHILD or WS_BORDER or WS_VISIBLE or SBS_SIZEGRIP,\
                    0, 0, 0, 0, hwnd, 0, hInst, 0  
            mov     hWndStat, eax

         INVOKE     LoadMenu, hInst, addr PopupMenu   
         INVOKE     GetSubMenu, eax, 0
            mov     hSMenu, eax

         INVOKE     LoadMenu, hInst, addr ResourceMenu   
         INVOKE     GetSubMenu, eax, 0
            mov     hRMenu, eax

         INVOKE     LoadMenu, hInst, addr FileMenu  
         INVOKE     GetSubMenu, eax, 0
            mov     hFMenu, eax

         INVOKE     LoadMenu, hInst, 601  
         INVOKE     GetSubMenu, eax, 0
            mov     hSubMenu, eax

         INVOKE     GetStockObject, BLACK_BRUSH
            mov     hBlackBR, eax

         INVOKE     lstrcpy, addr lf.lfFaceName, addr FontName
            mov     lf.lfHeight, -12
            mov     lf.lfWeight, 500
         INVOKE     CreateFontIndirect, addr lf
            mov     hFont, eax    ; Edit font

            mov     lf.lfHeight, -9
            mov     lf.lfWeight, 400
         INVOKE     CreateFontIndirect, addr lf
            mov     hFontT, eax    ; Text font

         INVOKE     lstrcpy, addr lf.lfFaceName, addr FontMS
            mov     lf.lfHeight, -12
            mov     lf.lfWeight, 500
         INVOKE     CreateFontIndirect, addr lf
            mov     hFontL, eax   ; ListBox font

            mov     lf.lfHeight, -9
            mov     lf.lfWeight, 400
         INVOKE     CreateFontIndirect, addr lf
            mov     hFontE, eax    ; Edit font

         INVOKE     CreateFontIndirect, addr lf
            mov     hFontIP, eax  ; IPAdress font

         INVOKE     lstrcpy, addr lf.lfFaceName, addr FontMS
            mov     lf.lfHeight, -8
            mov     lf.lfWeight, 400
         INVOKE     CreateFontIndirect, addr lf
            mov     hFontS, eax   ; SizeBox font

            mov     lf.lfHeight, 8
            mov     lf.lfWeight, 400
         INVOKE     CreateFontIndirect, addr lf
            mov     hFontDlg, eax   ; Dialog font

         INVOKE     lstrcpy, addr lf.lfFaceName, addr FontSYS
            mov     lf.lfHeight, 0
            mov     lf.lfWeight, 0
         INVOKE     CreateFontIndirect, addr lf
            mov     hFontSYS, eax   ; System font
         INVOKE     lstrcpy, addr Dlg.lpFont, addr FontMSD

         INVOKE     LoadImage, hInst, 901, IMAGE_BITMAP, 12, 12, LR_DEFAULTCOLOR
            mov     hPat2, eax
         INVOKE     LoadImage, hInst, 902, IMAGE_BITMAP, 12, 12, LR_DEFAULTCOLOR
            mov     hPat3, eax
         INVOKE     LoadImage, hInst, 903, IMAGE_BITMAP, 12, 12, LR_DEFAULTCOLOR
            mov     hPat4, eax
         INVOKE     LoadImage, hInst, 904, IMAGE_BITMAP, 12, 12, LR_DEFAULTCOLOR
            mov     hPat6, eax

         INVOKE     LoadImage, hInst, 8809, IMAGE_BITMAP, 32, 32, LR_DEFAULTCOLOR   
            mov     hBmpR, eax
         INVOKE     LoadImage, hInst, 8810, IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR     
            mov     hIcoR, eax

         INVOKE     CreateDialogParam, hInst, 4000, hwnd, offset TabCtlDlg, hwnd
            mov     hWndTab, eax

;---------- [Allocate memory from the default heap] ----------
         INVOKE     HeapAlloc, hDefHeap, 0, 500000 ;200000 ;100000
            mov     Defines, eax
         INVOKE     HeapAlloc, hDefHeap, 0, 500000 ;200000 ;100000
            mov     DefinesDlg, eax
         INVOKE     HeapAlloc, hDefHeap, 0, 500000 ;200000 ;100000
            mov     Equates, eax
         INVOKE     HeapAlloc, hDefHeap, 0, 2000
            mov     Accelerator, eax
         INVOKE     HeapAlloc, hDefHeap, 0, 2000
            mov     UnDoArray, eax
         INVOKE     HeapAlloc, hDefHeap, 0, 2000
            mov     hString, eax
         INVOKE     HeapAlloc, hDefHeap, 0, 2000
            mov     hError, eax
         INVOKE     HeapAlloc, hDefHeap, 0, 51200
            mov     hBuff, eax
         INVOKE     RtlZeroMemory, Defines, 1024
         INVOKE     RtlZeroMemory, Equates, 1024
         INVOKE     RtlZeroMemory, Accelerator, 1024

         INVOKE     lstrcpy, addr szBuff, CommandLine
         .if byte ptr szBuff == '"'
            INVOKE     lstrcpy, addr szBuff, addr szBuff+1
            INVOKE     lstrlen, addr szBuff
            .while (eax)
               .if byte ptr szBuff[eax] == '\'
                  .break
               .endif
                  dec     eax
            .endw
               inc     eax
            INVOKE     lstrcpyn, addr PathName, addr szBuff, eax
            INVOKE     lstrcpy, addr RootPath, addr PathName

         .else
            INVOKE     GetCurrentDirectory, lengthof PathName, addr PathName
            INVOKE     GetCurrentDirectory, lengthof RootPath, addr RootPath

         .endif

         INVOKE     lstrcpy, addr szBuff, addr RootPath
         INVOKE     lstrcat, addr szBuff, addr szBackS
         INVOKE     lstrcat, addr szBuff, addr szGlobe
         INVOKE     LoadImage, 0, addr szBuff, IMAGE_ICON, 0, 0,
                    LR_LOADFROMFILE or LR_LOADMAP3DCOLORS
            mov     hIcon, eax

         INVOKE     RegCreateKeyEx, HKEY_CURRENT_USER, addr szRedit, 0, addr szREGSZ, 0,\
                    KEY_WRITE or KEY_READ, 0, addr hReg, addr lpdwDisp

            mov     lpcbData, 255
         INVOKE     RegQueryValueEx, hReg, addr szResL, 0, addr lpType, addr szResPath, addr lpcbData
         .if !szResPath
            INVOKE     lstrcpy, addr szResPath, addr PathName
            INVOKE     lstrlen, addr szResPath
               mov     lpcbData, eax
            INVOKE     RegSetValueEx, hReg, addr szResL, 0, REG_SZ, addr szResPath, lpcbData
         .endif
         INVOKE     RegCloseKey, hReg

         INVOKE     FillBuffer, addr szFill, sizeof szFill, ' ', 1
            mov     vSpace, 2
            mov     hSpace, 2

      .elseif wmsg == WM_SIZE

;---------- [Size the Statusbar Control] ----------
            mov     eax, lparam       ; Get width
            and     eax, 0ffffh       ; Lowword
            shr     eax, 2            ; /4
            mov     ecx, eax          ; Save factor
            mov     sbParts, eax      ; Make part 1 1/4 the width
            add     eax, ecx
            mov     [sbParts+4], eax  ; and also part2, .. etc
            add     eax, ecx
            mov     [sbParts+8], eax
            mov     [sbParts+12], -1  ; The last part extends to the end
         INVOKE     SendMessage, hWndStat, SB_SETPARTS, 4, addr sbParts
         INVOKE     MoveWindow, hWndStat, 0, 0, 0, 0, TRUE

         INVOKE     GetWindowRect, hWndTab, addr rect
            mov     eax, rect.left
            sub     rect.right, eax
           push     rect.right
            mov     eax, lparam
            mov     edx, eax
            shr     edx, 16
            and     eax, 0ffffh
            sub     eax, rect.right
            mov     Wth, eax

         .if hAsmEdit
            INVOKE     GetWindowRect, hAsmEdit, addr Prect
               mov     eax, Prect.left
               add     eax, 3
               sub     Prect.right, eax
               mov     eax, Prect.right
               sub     eax, rect.right
               sub     eax, ResB ;6

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -