Tutorial - conditions - Homework

Started by BPak, April 17, 2008, 03:30:24 AM

Previous topic - Next topic

BPak

Hi

I have finished working through the Tutorials by Bill Aitken and in the Homework it is requested to make a module with extra subroutines.

I had a problem in the declares I wished to use

.Data
hButton DD 0 ; HWND, doesnt work!
pBox RECT
pegBorder DD 0


Is there a reason I cannot use the HWND type in a module??

BPak

Ramon Sala

Hi,

The only types accepted by GoAsm are B,W,D,Q and T (DB, DW, DD, DQ and DT). The HWND type is defined in MASM but not in GoAsm. However, I have noticed that HWND is used in the Bill Aitken's tutorial (chapter 3) and it works. In fact, it works with HWND or any other name, so I'll talk to Jeremy Gordon.

Ramon
Greetings from Catalonia

stevenp

HWND worked for me but it's just a DWORD (DD).

BPak

I did Lesson 3 also and it compiled ok and the prog ran but the Button was NOT pegged to the bottom right corner.

I must have missed something. But cant see what I missed.... mumble.... mumble...

Did your prog display the button pegged to the bottom right corner?

stevenp

Yes it did.  I can post my code when I get home if you're interested.

BPak

Hi Stevenp

Yes please!

That will give me something to compare my code to and see if I can find the difference.

Ramon Sala

Hi BPak,

Attached is the code for chapter 3 working properly. I hope it can help you.

Ramon


[attachment deleted by admin]
Greetings from Catalonia

stevenp

Ramon, you beat me to it. :)

Anyways, I had finished the tutorials and had done the final homework assignement, so if you need me to post that I can as well.  That will show all nine buttons aligned and each routine seperated into frames.

Ramon Sala

Hi Steven,

Yes please, post your work and congratualtions for doing the final homework. I just tried to give a hand to BPak, but as you can see the stuff I posted is not completed.

Thank you,

Ramon
Greetings from Catalonia

BPak

Hi Ramon,

Thank you for the code.

I unzipped it and put Chapter 3 folder in the area where I have the files I develop.

I compiled it and ran it- Success!

The button was pegged to bottom right corner.

But the trouble I had before was when I took the variables OUT of the Local and put them back in DATA  like this.


.Data

MESSAGES DD WM_CREATE, OnCreate
DD WM_CLOSE, OnClose
DD WM_SIZE, OnResize
hButton HWND
pBox RECT
pegBorder DD 4


So I commented out the code in the pegObject for the LOCAL Vars and put it in the DATA section.

I recompiled YOUR code again with these changes and it worked fine. The button was pegged at the bottom right of the window.

The fact is we have identical code but yours works and mine doesnt. ??

So I opened ALL the files in the two projects in NOTEPAD.exe to examine and compare them.

Everything was exactly the same except that you used the latest Version .10 and I had used .09 version of the EasyCode.go

One file had something different and that was the pegButton.ews file

chapter 3
your code - pegButton.ews

0
winMain,0,0,6075,5070,1,2,56,338,338,0,0

==========================================

my code

0
winMain,0,0,6075,5070,1,2,49,2324,2324,0,0


Thanks for your help with sorting this problem. But it works fine in the Local area so I guess there is no need to go into  it any further.

Ramon Sala

Hi BPak,

The .ews file just saves the workspace for the project, so it shouldn't have any effect. However, thanks for the report. I'll try to do some test.

Ramon
Greetings from Catalonia

Ramon Sala

BPak,

I installed EasyCode GoAsm version .0009 and tested my own chapter 3 code, just tooking out the variables of the Local and put them in the .Data section like this:

hButton  HWND
pBox RECT
pegBorder DD 4


Everything worked fine, so I don't understand why it does not work for you as versions .0009 and .0010 produce the same results. However, there is something that I do not like at all: the HWND type. The GoAsm compiler does not have such a type, so it should fire the corresponding error. I think that is a little bug and I already have told to Jeremy Gordon (the hButton variable should be defined as DD).

So in order to test the behavior of the program, I changed the hButton variable order like this:

pBox RECT
hButton  HWND
pegBorder DD 4


and the button disappeared. It was not pegged at the bottom right of the window. As a test, I replaced HWND with RAMON and the code compiled fine with no errors, which is completely absurd because, as far as I know, my name is not an assembly variable type!

Finally, I defined hButton as it should, that is, a DD.

hButton  DD  ?
pBox RECT
pegBorder DD 4


and it worked fine! Now there is no problem in changing the variables order. I'm affraid the HWND type is producing strange results as it actually does not exist in GoAsm and should not be accepted by the compiler.

While I'm wating for Jeremy to answer, I'll talk to Bill in order to change the unexisting HWND type to DD in the tutorial.

Thanks.
Greetings from Catalonia

Ramon Sala

#12
After talking to Bill Aitken, the hButton variable type has been changed to DD in the tutorial (chapter 3). The only valid types for GoAsm are Byte, Word, DWord, QWord and TWord, that is,  B, W, D, Q, and T (or DB, DW, DD, DQ and DT when being defined).

Ramon
Greetings from Catalonia

BPak

Thanks Ramon for sorting out this bug.

I think I read in GO Help File that there is no Param or TYPE checking etc. So maybe that is why it gets past the compiler errors? If it dont work then you know it is incorrect!

That is how I read it in the manual anyway!

Would be interesting though to know how to DEFINE HWND oneself in a program?

BPak


Ramon Sala

I think the right way is:

HWND   Equ   DD


Ramon
Greetings from Catalonia