954,490 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Window Creation

0
By Tight_Coder_Ex on Feb 11th, 2005 8:19 am

I've often wondered why M$ didn't make creating a window a simple as registering a class in that only one 32 bit value need be passed to calling routine. Although this is not ground breaking code design it does facilitate calling code only set EBX to point to all values required by CreateWindowEx.

; 				    *** CREATE_WND ***

;	ENTRY:	EBX = Pointer to structure CreateWindowEx structure

;	LEAVE:	EAX = Handle to window, or null if failed
;		 CY = 0 Successful, 1 otherwise.

; ============================================================================================

  Create_Wnd	mov	ecx, 48
		sub	esp, ecx		; Create stack frame for CreateWindowEx
		mov	edx, esp		; Need this pointer in EDI
		push	esi
		push	edi			; Save registers
		mov	edi, edx
		mov	esi, ebx		; Setup for movsd
		shr	ecx, 2			; Number of dwords to move
		cld
		rep	movsd			; Copy parameters into stack area
		pop	edi
		pop	esi			; Restore index registers and create
		call	_CreateWindowExA@48	; window
		and	eax, eax
		jnz	.Done + 1		; If non zero, then was successful

	; Error handling code will eventually go here

  .Done		stc				; Set error flag
		ret

Nice idea!
We have a little thread going on DaniWeb under: http://www.daniweb.com/techtalkforums/thread18331.html
Would be nice to get the asm Hello World! from you.

vegaseat
DaniWeb's Hypocrite
Moderator
5,986 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

I've never done anything in assembly for console, although the concept is very simple. This series I'm doing now will only have another couple of posts and it will be complete as far as displaying a window on the monitor. What I can do and what I think might be fairly informative is displaying "Hello World" in the default GUI font only while the left mouse button is being pressed at the cursor position at that time. This will be a little more consitent with my objective of this series of snippets. At that time I will post the entire source in thread18331. The complete source encorporates all the snippets I'm posting here.

Tight_Coder_Ex
Posting Whiz in Training
215 posts since Feb 2005
Reputation Points: 47
Solved Threads: 17
 

The thread is not limited to console only. Please go ahead and give us a good one! Thanks.

vegaseat
DaniWeb's Hypocrite
Moderator
5,986 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You