what parameters did EasyCalc code for CreateWindowEx ?

Started by vmars316, April 17, 2011, 12:52:54 AM

Previous topic - Next topic

vmars316

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
.
All things in moderation, except for love and forgiveness...vmars316
.
www.QuickerThanASpark.com

Ramon Sala

#1
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
Greetings from Catalonia

vmars316

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
.
All things in moderation, except for love and forgiveness...vmars316
.
www.QuickerThanASpark.com

Ramon Sala

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.
Greetings from Catalonia

vmars316

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
.
All things in moderation, except for love and forgiveness...vmars316
.
www.QuickerThanASpark.com

dedndave

what you are looking for is a way to view a source listing   :P

vmars316

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
.
All things in moderation, except for love and forgiveness...vmars316
.
www.QuickerThanASpark.com

Ramon Sala

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
Greetings from Catalonia