If, like me, you don't like to recreate the same thong, you will like this addin.
It creates all the code for registering the class and creating the window.
Many options are preselected, like this you just have to click "Create".
Becareful, work on a white source page.
The code is for Assembler and C.
Have fun
--------------------------------------------------------
ASSEMBLER
.Data?
ALIGN 4
hInstance HINSTANCE ?
.DATA
ALIGN 4
szClassName BYTE "MySchool",0
ALIGN 4
szWindowTitle BYTE "What a Wonderful Window",0
ALIGN 4
szErrorMsgText BYTE "Cannot create the window",0
ALIGN 4
szErrorMsgTitle BYTE "Something is wrong",0
.CODE
ALIGN 16
LOCAL _Wc:WNDCLASS
LOCAL _RcWorkArea:RECT
LOCAL _hWnd:HWND
; ---------------------------------
; --- Register the window class ---
; ---------------------------------
LEA RDX,_Wc
MOV RAX,OFFSET MainWndProc
MOV RCX,hInstance
MOV [RDX].WNDCLASSEX.lpfnWndProc,RAX
MOV [RDX].WNDCLASSEX.hInstance,RCX
MOVD XMM7,RDX ; PUSH RDX
MOV RDX,IDR_ICO_MAIN
CALL LoadIcon
MOVD RDX,XMM7 ; POP RDX
MOV [RDX].WNDCLASSEX.hIcon,RAX
XOR RCX,RCX
MOV RDX,IDC_ARROW
CALL LoadCursor
MOVD RDX,XMM7 ; POP RDX
MOV [RDX].WNDCLASSEX.hCursor,RAX
MOV [RDX].WNDCLASSEX.hbrBackground,COLOR_WINDOW + 1
MOV [RDX].WNDCLASSEX.lpszMenuName,ID_OF_MY_MENU
MOV [RDX].WNDCLASSEX.style,CS_HREDRAW OR CS_VREDRAW OR CS_DBLCLKS OR CS_DROPSHADOW OR CS_BYTEALIGNCLIENT OR CS_BYTEALIGNWINDOW
MOV RAX,OFFSET szClassName
MOV [RDX].WNDCLASSEX.lpszClassName,RAX
MOV RCX,RDX
CALL RegisterClass
; ---------------------------
; --- Get the screen size ---
; ---------------------------
MOV RCX,SPI_GETWORKAREA
XOR EDX,EDX
LEA R8,_RcWorkArea
XOR R9D,R9D
CALL SystemParametersInfo
XOR RAX,RAX
MOV RCX,hInstance
MOV [RSP + 58h],RAX ; lParam
MOV [RSP + 50h],RCX ; hInstance
MOV [RSP + 48h],RAX ; hMenu
MOV [RSP + 40h],RAX ; hParent
MOV DWORD PTR [RSP + 38h],400 ; Height
MOV DWORD PTR [RSP + 30h],600 ; Width
MOV ECX,_RcWorkArea.right
MOV EDX,_RcWorkArea.bottom
SUB ECX,_RcWorkArea.left
SUB EDX,_RcWorkArea.top
SUB EDX,400 ; Height
SUB ECX,600 ; Width
SHR EDX,1
SHR ECX,1
MOV DWORD PTR [RSP + 28h],EDX ; Y
MOV DWORD PTR [RSP + 20h],ECX ; X
MOV R9D,WS_BORDER OR WS_CAPTION OR WS_MAXIMIZEBOX OR WS_MINIMIZEBOX OR WS_SYSMENU OR WS_VISIBLE OR WS_OVERLAPPED
MOV R8,OFFSET szWindowTitle
MOV RDX,OFFSET szClassName
XOR ECX,ECX
CALL CreateWindowExA
MOV _hWnd,RAX
TEST RAX,RAX
JNZ @Ok
MOV ECX,MB_ICONERROR
CALL MessageBeep
XOR RCX,RCX
MOV RDX,OFFSET szErrorMsgText
MOV R8,OFFSET szErrorMsgTitle
MOV R9D,MB_OK OR MB_ICONERROR OR MB_APPLMODAL OR MB_TOPMOST
CALL MessageBoxA
mov RAX,-1
JMP @Exit
@Ok :
@Exit :
RET
C
WNDCLASS _Wc, *_lpWc ;
_lpWc = (LPWNDCLASS) memset(&_Wc,0,sizeof(WNDCLASS)) ;
_lpWc->lpfnWndProc = MainWndProc ;
_lpWc->hInstance = hInstance ;
_lpWc->hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDR_ICO_MAIN)) ;
_lpWc->hCursor = LoadCursor(NULL,IDC_ARROW) ;
_lpWc->hbrBackground = (HBRUSH) (COLOR_WINDOW + 1) ;
_lpWc->lpszMenuName = NULL ;
_lpWc->style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS|CS_DROPSHADOW|CS_BYTEALIGNCLIENT|CS_BYTEALIGNWINDOW ;
_lpWc->lpszClassName = L"MySchool" ;
RegisterClass(_lpWc) ;
HWND _hWnd ;
RECT _RcWorkArea ;
SystemParametersInfo(SPI_GETWORKAREA,0,&_RcWorkArea,0) ;
_hWnd = CreateWindowEx(0,L"MySchool",L"What a Wonderful Window",
WS_BORDER|WS_CAPTION|WS_MAXIMIZEBOX|WS_MINIMIZEBOX|WS_SYSMENU|WS_VISIBLE|WS_OVERLAPPED,
((_RcWorkArea.right - _RcWorkArea.left) - 600) / 2,((_RcWorkArea.bottom - _RcWorkArea.top) - 400) / 2,600,400,NULL,NULL,hInstance,NULL) ;
if(!_hWnd)
{
MessageBeep(MB_ICONERROR) ;
MessageBox(NULL,L"Cannot create the window",L"Something is wrong",MB_OK|MB_ICONERROR|MB_APPLMODAL|MB_TOPMOST) ;
return (-1) ;
}