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
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
HWND worked for me but it's just a DWORD (DD).
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?
Yes it did. I can post my code when I get home if you're interested.
Hi Stevenp
Yes please!
That will give me something to compare my code to and see if I can find the difference.
Hi BPak,
Attached is the code for chapter 3 working properly. I hope it can help you.
Ramon
[attachment deleted by admin]
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.
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
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.
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
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.
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
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
I think the right way is:
HWND Equ DD
Ramon
Hi all!
What is happening here is that GoAsm is regarding not only hButton, pegBorder but also HWND and RAMON (when they were there) simply as labels in the data section.
There is no data declaration actually made when you provide a label.
A label is used only to identify a particular area of code or data, and it will reside at a certain address when the source code is compiled.
You can see that this is true if you look at the symbols in the object file or the resulting exe, with a file viewer like Wayne Radburn's excellent PEView available from here (http://www.magma.ca/~wjr), or in a debugger.
This behaviour is a result of:-
1. GoAsm not requiring a colon to follow a data label.
2. GoAsm allowing several data labels to follow each other eg.
Label1
Label2
Label3
3. GoAsm allowing such labels to be on the same line eg.
Label1 Label2 Label3
4. GoAsm not type checking (thereby keeping "baggage" to the minimum).
So really this is a result of GoAsm's inherent design.
I explain in the GoAsm help file why I didn't add type checking and I've been thanked for this decision many times by GoAsm users.
So feel free to use HWND or RAMON as you want.
How about:-
CALL RAMON
INVOKE HWND