The MASM Forum Archive 2004 to 2012

Project Support Forums => IDE Development and Support => Easy Code => Topic started by: vmars316 on April 17, 2011, 12:52:54 AM

Title: what parameters did EasyCalc code for CreateWindowEx ?
Post by: vmars316 on April 17, 2011, 12:52:54 AM
Greets,
Sorry to be asking so many ?s
In the helloWindow proj, I added a Button, and specified BackColor, ForeColor, and OwnerDrawn .
Where can i find the CreateWindowEx code for this?
I would like to see what parameters EasyCalc coded for me.
Thanks...vmars316
Title: Re: what parameters did EasyCalc code for CreateWindowEx ?
Post by: Ramon Sala on April 17, 2011, 09:20:42 AM
Hi vmars316,

There are no buttons object in the EasyCalc project. The buttons you see are those belonging to a ToolBar (Invoke  CreateToolbarEx and all the TBBUTTON structures). You should know that if you want to program Windows applications.

Ramon
Title: Re: what parameters did "EasyCode" generate for CreateWindowEx ?
Post by: vmars316 on April 17, 2011, 03:38:58 PM
Ramon,
(Oops!  I mean EasyCode not EasyCalc)

Re: what code (parameters) did "EasyCode" generate for CreateWindowEx ?

I dont understand what you mean. see attatchments (OrangeButton.png , Button1_BackColor.png)
Somewhere in the files generated by EasyCode, for helloWindow project, 
can be code for CreateWindowEx (CreateWindowExA)
that creates the Button1 object dynamically, from the Button1.Properties.
I would like to see that code, to know what Source Code that EasyCode actually generated
Thanks...vmars
Title: Re: what parameters did EasyCalc code for CreateWindowEx ?
Post by: Ramon Sala on April 17, 2011, 07:24:38 PM
Hi,

Easy Code (visual projects) just does the job for you, but it uses standard calls to Windows API. It creates a button like this:

    Invoke CreateWindowEx, dwExStyle, TextAddr("BUTTON"), Addr szButtonText, dwStyle, rc.left, rc.top, rc.right, rc.bottom, hParent, lButtonID, 0

where dwExStyle and dwStyle depend on the styles you chose from the Properties window.

Then the button is subclassed:

    Invoke SetWindowLong, hButton, GWL_WNDPROC, Addr ButtonProc

and in the subclassed procedure EC does the job:

ButtonProc Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
  .If uMsg == WM_ERASEBKGND
      ;Paints the background
  .ElseIf uMsg == WM_PAINT
      ;Paints the text
  .EndIf
ButtonProc EndP

You should know that if you make Windows applications.

Regards.
Title: Re: what parameters did EasyCalc code for CreateWindowEx ?
Post by: vmars316 on April 17, 2011, 09:04:51 PM
Greets,
Ah, yes, this is the exact info i am looking for *:
   Invoke CreateWindowEx, dwExStyle, TextAddr("BUTTON"), Addr szButtonText, dwStyle, rc.left, rc.top, rc.right, rc.bottom, hParent, lButtonID, 0

    Invoke SetWindowLong, hButton, GWL_WNDPROC, Addr ButtonProc
   
   ButtonProc Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
  .If uMsg == WM_ERASEBKGND
      ;Paints the background
  .ElseIf uMsg == WM_PAINT
      ;Paints the text
  .EndIf
ButtonProc EndP

But I am hoping to find it in the code generated by easyCode,
for,say, helloWindow. So I can see how its done, what APIs are used,
and in what sequence.

I am a retired 'Business computer programmer' (senior citizen).
And used to program in COBOL.
I tried VisualBasic and Delphi for a while, but they are too verbose for me.
But currently, I code in HotBasic.
There are things in HotBasic that I cant do. For example, colored_Buttons.
And I am happy to see that colored_Button are easily done in EasyCode.

"You should know that if you make Windows applications.":
I am not sure what you mean by the above statement:   

Because of my businessProgramming background on IBM mainframes,
I have lots of holes in my programming education.
And am just now begining to learn about using APIs.
And I have long wanted to learn MASM.
I am thinking that with the combo of mAsm, EasyCode, and HotBasic,
That I can pretty much do what I want to do.

Like you, all the programs I write are Freeware.
*
Now back to: "Ah, yes, this is the exact info i am looking for *:"
Where can I find this API code in EasyCode output?

Thanks a gig...vmars
Title: Re: what parameters did EasyCalc code for CreateWindowEx ?
Post by: dedndave on April 17, 2011, 10:49:49 PM
what you are looking for is a way to view a source listing   :P
Title: Re: what parameters did EasyCalc code for CreateWindowEx ?
Post by: vmars316 on April 18, 2011, 04:19:56 AM
Quote from: dedndave on April 17, 2011, 10:49:49 PM
what you are looking for is a way to view a source listing   :P

Well, yes.
Here is my viewCode window:

.Const

.Data?

.Data

.Code

Window1Procedure Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
   .If uMsg == WM_CREATE

   .ElseIf uMsg == WM_COMMAND

   .ElseIf uMsg == WM_CLOSE
      Invoke IsModal, hWnd
      .If Eax
         Invoke EndModal, hWnd, IDCANCEL
         Return TRUE
      .EndIf
   .EndIf
   Xor Eax, Eax   ;Return FALSE
   Ret
Window1Procedure EndP

Window1Button1 Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
   Xor Eax, Eax   ;Return FALSE
   Ret
Window1Button1 EndP


But this is all I get, but no:

Invoke CreateWindowEx, dwExStyle, TextAddr("BUTTON"), Addr szButtonText, dwStyle, rc.left, rc.top, rc.right, rc.bottom, hParent, lButtonID, 0

    Invoke SetWindowLong, hButton, GWL_WNDPROC, Addr ButtonProc
   
   ButtonProc Proc hWnd:HWND, uMsg:ULONG, wParam:WPARAM, lParam:LPARAM
  .If uMsg == WM_ERASEBKGND
      ;Paints the background
  .ElseIf uMsg == WM_PAINT
      ;Paints the text
  .EndIf
ButtonProc EndP

So yes, I am asking where can I find the above stuff?  Is there a settings option for this?
Thanks...vmars
Title: Re: what parameters did EasyCalc code for CreateWindowEx ?
Post by: Ramon Sala on April 18, 2011, 06:08:00 AM
Hi vmars316,

What I mean is that you need to have a basic knowledge on how Windows works in order to be able to program applications for it. The Iczelion's tutorials is the best way to begin (http://win32assembly.online.fr or the examples subfolder of Masm32).

All code managing windows and child controls in Easy Code (just for visual projects) are in the visual libraries (Lib folder).

Regards,

Ramon