User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 402,503 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,741 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Feb 10th, 2005
Views: 2,019
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.
asm Syntax | 5 stars
  1. ; *** CREATE_WND ***
  2.  
  3. ; ENTRY: EBX = Pointer to structure CreateWindowEx structure
  4.  
  5. ; LEAVE: EAX = Handle to window, or null if failed
  6. ; CY = 0 Successful, 1 otherwise.
  7.  
  8. ; ============================================================================================
  9.  
  10. Create_Wnd mov ecx, 48
  11. sub esp, ecx ; Create stack frame for CreateWindowEx
  12. mov edx, esp ; Need this pointer in EDI
  13. push esi
  14. push edi ; Save registers
  15. mov edi, edx
  16. mov esi, ebx ; Setup for movsd
  17. shr ecx, 2 ; Number of dwords to move
  18. cld
  19. rep movsd ; Copy parameters into stack area
  20. pop edi
  21. pop esi ; Restore index registers and create
  22. call _CreateWindowExA@48 ; window
  23. and eax, eax
  24. jnz .Done + 1 ; If non zero, then was successful
  25.  
  26. ; Error handling code will eventually go here
  27.  
  28. .Done stc ; Set error flag
  29. ret
  30.  
  31.  
Comments (Newest First)
vegaseat | Kickbutt Moderator | Feb 12th, 2005
The thread is not limited to console only. Please go ahead and give us a good one! Thanks.
Tight_Coder_Ex | Junior Poster | Feb 11th, 2005
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.
vegaseat | Kickbutt Moderator | Feb 11th, 2005
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.
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 5:39 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC