News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ObjAsm32 Version 1.3b

Started by NaN, February 10, 2005, 12:19:57 AM

Previous topic - Next topic

NaN



We have reached what we feel is another mile stone in the OA32 progress.  There has been improvements and expansion of the project, as well as additional work has been invested in this release to reinforce the work already done; Namely more simple and direct tutorials.

Below is a list of some of the features:
  • Works with Hutch's MASM32 Package  :dance:
  • Supported by RadASM version 2.1.0.7 or greater  :dance: .
  • Model improvements and extensions.
  • Static object implementation.
  • New debugging features and a new debug console :cheekygreen: .
  • COM aggregation supported  :dance: .
  • COM OCX demo application  :dance: .
  • DirectX support and demo application.
  • Translation of Iczelion tutorials 3 - 11  :dance: .
  • More projects.
  • ...and much more in this new release!
We welcome your feedback.  If your new to this project, simply download it and check out the Demo's or the Nan_Tuts.  The Nan_Tuts were deliberately desigend to reflect each of Iczelion's famous tutorials.  Since most if not all of you are familiar with these tutorials, it was my hope that it would help sever as a basis to teach the Object Orientated approach to the same problem in each tutorial.  I didnt copy the origional tutorials, so I leave it to you review Iczelions' work from his many sites.  However, I did make a large effort to ensure my equivalent demos are well commented.

Please provide your feed back, good or bad.

You can get the download at the following site:ObjAsm32 Home Page

Please let us know if the bandwidth gets chewed up.  We will make additional provisions to offer the package in this case.

Best Regards and have fun!
:alright:
:NaN:

hutch--

NaN,

Looks like a great toy.  :U

Also welcome on board. Glad to see the PIT (WORK) has not ground you down.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

NaN

#2
Thanks Hutch,

We think it a great toy as well.  The common library of standard templates (SDI, MDI, Dialogs, Buttons, etc) is a real slick improvement over past versions.


As for Life and the 'PIT'.  Yeah, they are going full speed ahead, but I still try to sharpen my teeth on what seems like a past life.  Theres not alot of time for R&D these days, but copying tutorials from Iczelion is a much simpler and less time consuming task <lol> .  On that note, I really have to hand it to BiteRider on this project, he is the real brain child behind this OOP implementation.  I just try to keep him from derailing when hes going mach 2 over a new idea.  The man consumed most if not all the major principals of COM / OCX in a matter of a month or two!  I can say its taken me alot longer than this ;)

Oh, yeah, almost forgot.  For those curious about its strengths... check out the DebugCenterl project.  This is one of BiteRiders best work.  It was a colaborated effort, but he has a impressive way of making random ideas come to light, quickly.  The DC_Test sub directory is designed with 'errors' and things that 'needs' to be debugged as a demonstration.  You might like what you see.  You can even debug device contexts!

Anyways, Thanks for your thoughts.
Regards,
:NaN:

ThoughtCriminal

If you posted one of the converted Iczelion tuts it might generate more interest.

JMHO

NaN

Sure if thats what you'd like to see.  This is a simple cut & paste from the Tutorial 4 (Icz_Demo4):

; ==================================================================================================
; Title:   Icz_Demo4.inc
; Author:  J. Trudgen (NaN) ~ December 2004.
; Version: 1.0.0
; Purpose: To demonstrate Iczelions tutorial No.4 with OA32.
; ==================================================================================================

Object Icz_Demo4, 10001, SdiApp                 ;Inherits Single Document Interface App with (ID >= 10000)
  RedefineMethod    Init                        ;Init method refefinition to mirror Iczelion windows creation
  StaticMethod      OnPaint,    dword, dword    ;WM_PAINT message handler
  RedefineMethod    Startup                     ;Startup method redefinition to mirror Iczelion registration
                                                ;Note: OnDestroy and Default handling is inherited from
                                                ;      the SdiApp object. We will reuse this source as is.
  Event   OnPaint,    WM_PAINT                  ;Links OnPaint method with WM_PAINT
ObjectEnd                                       ;Ends object definition


.code
; ==================================================================================================
;    Icz_Demo4 implementation
; ==================================================================================================

; ——————————————————————————————————————————————————————————————————————————————————————————————————
; Method:    Icz_Demo4.Init
; Purpose:   Initalizes the SDI application object, when an instance is created.
;            This mirrors Iczwlions "WinMain" proceedure (mid section)
;            Note: The inherited "Run" method from SdiApp is equivalent to the last message loop
;                  section in Iczelions "WinMain". So we need not redefine this method, we will
;                  simply reuse the source as provided.
; Arguments: None.
; Return:    Nothing.

Method Icz_Demo4.Init, uses esi
    SetObject esi                                       ;esi = This Object Instance
    invoke CreateWindowEx, NULL, offset szIcz_Demo4, offset szAppTitle, WS_OVERLAPPEDWINDOW, \
              CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, \
              0, 0, hInstance, esi                      ;Pass the instance pointer esi (REQUIRED!)

    invoke ShowWindow, [esi].hWnd, SW_SHOWNORMAL        ;Show the window
    invoke UpdateWindow, [esi].hWnd                     ;Update if necesary
MethodEnd

; ——————————————————————————————————————————————————————————————————————————————————————————————————
; Method:    Icz_Demo4.OnPaint
; Purpose:   Event procedure for WM_PAINT message.
; Arguments: Arg1: First message parameter.
;            Arg2: Second message parameter.
; Return:    Zero if handled.

Method Icz_Demo4.OnPaint, uses esi, wParam:dword, lParam:dword
    local PS:PAINTSTRUCT, hDC:Handle, Rct:RECT

    SetObject esi
    mov hDC, $invoke(BeginPaint, [esi].hWnd, addr PS)

    invoke GetClientRect, [esi].hWnd, addr Rct
    invoke DrawText, hDC, addr szOurText, -1, addr Rct, DT_SINGLELINE or DT_CENTER or DT_VCENTER
    invoke EndPaint, [esi].hWnd, addr PS
    xor eax, eax
MethodEnd

; ——————————————————————————————————————————————————————————————————————————————————————————————————
; Method:    Icz_Demo4.Startup
; Purpose:   Registers the object class with the OS when the ObjectsInit macro is executed.
;            This mirrors Iczelions "WinMain" proceedure up to RegisterClassEx.
; Arguments: None.
; Return:    Nothing.

Method Icz_Demo4.Startup
    local WC:WNDCLASSEX

    mov WC.cbSize, sizeof WNDCLASSEX
    mov WC.style, CS_VREDRAW or CS_HREDRAW
    m2m WC.lpfnWndProc, $MethodAddr(Icz_Demo4.WndProc)  ;$MethodAddr is like offset but will
                                                        ;retrieve object method offsets
    mov WC.cbClsExtra, 0
    mov WC.cbWndExtra, 0
    m2m WC.hInstance, hInstance
    mov WC.hbrBackground, COLOR_WINDOW + 1
    mov WC.lpszMenuName, NULL
    mov WC.lpszClassName, offset szIcz_Demo4            ;Same as "Classname" in Iczelions tutorial
    mov WC.hIcon, $invoke(LoadIcon, 0, IDI_APPLICATION)
    mov WC.hIconSm, 0
    mov WC.hCursor, $invoke(LoadCursor, 0, IDC_ARROW)

    invoke RegisterClassEx, addr WC
MethodEnd


There is two main sections to any source.  The Object definition header (at the top within the Object / ObjectEnd block), and the Object Methods.  In this case, I outline a new object called 'Icz_Demo4' and it is to inherit the already prepared 'SdiApp' object (Single Document Interface).  Then I choose to redefine the 'Init' method that is provided by SdiApp to do more specific initializations.  This is where I create the window.  All objects that define a 'Startup' will have its code ran in when the exe is opened.  So here i define my window registration.  Since SdiApp comes with a Startup method, i am again redefining it to be more specific to the window i want to create.  Lastly, I added a Message Handling definition to watch for the WM_PAINT message and call the OnPaint Method.  So naturally, here is where I added the centered text in my window.

Not only methods, but variables are inherited from the SdiApp object being used as the program's base.  This helps standardize on implementations.  For example the 'hWnd' variable is the standard used by all window objects as SdiApp, MdiApp, and many other inherit from an even more basic object called 'WinPrimer'.  This object is actually too basic for any practical use, but since all more complex objects inherit from it, you can be sure they all get at least a 'hWnd' variable, etc. etc.  This is the basic advantages to a well designed object hieracarchy.

SdiApp and many others are predefined objects that have similar sources to this one and have been tested to a point where it has been converted to a static LIB.  All the origional sources are present in the package, and with a simple switch you can choose to compile them instead of using their libs (but for speed it always better to use libs).  If you want to see what is in SdiApp you can find all the predefined objects in the CODE\Objects directory in the package.  If you want me to post 'SdiApp' and talk about it, i can do this too?

I hope this helps.
Regards,
:NaN:

NaN

Dialogs are even simpler as there is less setup required if your using Dialog definitions in the RC file: ; ==================================================================================================
; Title:   Icz_Demo10-2.inc
; Author:  J. Trudgen (NaN) ~ December 2004.
; Version: 1.0.0
; Purpose: To demonstrate Iczelions tutorial No. 10-2 with OA32.
; ==================================================================================================


Object Icz_Demo10, 10001, DialogModal                   ;Inherits DialogModal with (ID >= 10000)
  RedefineMethod  OnCommand,      dword, dword          ;ReDefine WM_COMMAND message handler
  RedefineMethod  OnInitDialog,   dword, dword          ;ReDefine WM_INITDIALOG message handler
ObjectEnd                                               ;Ends object definition


.code
; ==================================================================================================
;    Icz_Demo10 implementation
; ==================================================================================================

; ——————————————————————————————————————————————————————————————————————————————————————————————————
; Method:    Icz_Demo10.OnCommand
; Purpose:   Event procedure for WM_COMMAND message.
; Arguments: Arg1: First message parameter.
;            Arg2: Second message parameter.
; Return:    Zero if handled.

Method Icz_Demo10.OnCommand, uses esi, wParam:dword, lParam:dword
    local ReturnVal:dword

    SetObject esi
    xor eax, eax
    mov ReturnVal, eax

    LoWord( wParam )
    .if !lParam
      Switch eax
      Case IDM_GETTEXT
        invoke GetDlgItemText, [esi].hWnd, IDC_EDIT, offset Buffer, 512
        invoke MessageBox, [esi].hWnd, offset Buffer, offset szAppTitle, MB_OK
      Case IDM_CLEAR
        invoke SetDlgItemText, [esi].hWnd, IDC_EDIT, NULL
      Case IDM_EXIT
        invoke EndDialog, [esi].hWnd, NULL
      Case IDCANCEL
        OCall esi.DestroyDialog, wParam
      Default
        inc ReturnVal
      endsw

    .else
      inc ReturnVal
      mov edx, eax
      .if $HiWord(wParam) == BN_CLICKED
        Switch edx
        Case IDC_BUTTON
          invoke SetDlgItemText, [esi].hWnd, IDC_EDIT, offset szTestString
          dec ReturnVal
        Case IDC_EXIT
          invoke SendMessage, [esi].hWnd, WM_COMMAND, IDM_EXIT, 0
          dec ReturnVal
        endsw
      .endif
    .endif

    mov eax, ReturnVal

MethodEnd

; ——————————————————————————————————————————————————————————————————————————————————————————————————
; Method:    Icz_Demo10.OnInitDialog
; Purpose:   Event procedure for WM_INITDIALOG message.
; Arguments: Arg1: First message parameter.
;            Arg2: Second message parameter.
; Return:    Zero if handled.

Method Icz_Demo10.OnInitDialog, , wParam:dword, lParam:dword
    SetObject ecx
    invoke SetFocus, $invoke(GetDlgItem, [ecx].hWnd, IDC_EDIT)
MethodEnd


This is where we feel our package really helps development in MASM.  Here all the framework is done for you.  Simply list the messages you want to catch and spell out the source you want to go with each event.  Here im asking for WM_INITDIALOG and WM_COMMAND.  The inherited object (DialogModal) has predefined source to handle everything else!

Regards,
:NaN:

NaN

Im kinda getting the feeling that im talking to myself here?  Anyone actualy check out our work?

Regards,
:NaN:

taff_e

Hi Nan

I'm looking at it :)

I'm currently trying to figure the best way of converting my current project (only 20% completed) over to an OOP approach but it will take some time

Taff

taff_e

I must be doing something wrong (or not RTFM)

I though I had a problem with a simple program I wrote then I tried it on demo05 and I got the following from radasm output window

Quote
Assembling: Demo05.asm
DEBUG MODE  : ACTIVE
\Masm32\ObjAsm32\Code\Macros\Debug.inc(43) : error A2006: undefined symbol : DebugPath
@CatStr(1): Macro Called From
  CStr(1): Macro Called From
   \Masm32\ObjAsm32\Code\Macros\Debug.inc(43): Include File
OOP LEVEL   : WINDOWS BASE
- ObjIDs.inc
- Primer.inc
- Steamable.inc
- WinPrimer.inc

Demo05.asm(104) : fatal error A1000: cannot open file : &ObjSrcPath&Primer.inc
IncludeObjectSrc(104): Macro Called From
  MakeObjects(1): Macro Called From
   OOP_Init(50): Macro Called From
    Demo05.asm(9): Main Line Code

Any ideas?

Cheers

Taff

NaN

My inital suspicions is that your not working with the latest package, or, you've mixed old source with the new package:

The Demo5, to my surprise, is not in this version of the package (I'll have to ask Biterider why its out...).  As well, I noticed the error you have lists an outdated macro "OOP_Init".  This has be superceeded by "SetupSys".

I've noticed that Biterider made this change at the last minute, as all my examples have been modified in with:

include \Masm32\ObjAsm32\Code\Macros\SetupSys.inc           ;Includes basic OOP support
SetupSys OOP_WINDOWS;, DEBUG(WND)                           ;Loads OOP files and OS related objects


from the previous:

include \Masm32\ObjAsm32\Code\Macros\OOP_Base.inc           ;Includes basic OOP support
OOP_Init WINDOWS_BASE; DEBUG                                ;Loads OOP files and OS related objects


Does this help any?
Regards,
:NaN:

taff_e

Hi Nan

I reinstalled and used one of the other examples to modify my program and it works again

Thanks very much  :U


NaN

Great,

However im curious what example your using as your template... to give me an idea of what people are using, and pehapse why?

If you need any other help, just ask.  Im thinking of developing a series of GDI handling objects.  Such that Pens, Brushes, etc can be created and automatically preserved from the dreaded GDI memory leak.   Whats your thoughts on the idea?

Regards,
:NaN:

taff_e

Hi Nan

I've been using Demo03 as an example template - I used it because it has a few controls on it and shows how to initialise them.  I've also used demo10  and the dbase example (to get the some other controls info especially the listview stuff)

As I mentioned earlier I've a project that's about 30% complete - it's basically a database of running information, times dates, courses etc in my own format - At the moment I allocate some memory for the records, based on the struct size and number of records and when needed increase this amount - I think that the datacollection, sorted data collection objects will be useful in this instance but I'm trying to learn how these objects work.

As for the GDI stuff anything that makes life easier is a plus (I've never devled into it much)

I think the biggest problem is the aren't many demo's -though I know your currently rectifying this by converting iczelions tutorials (which got me started in asm originally) - I think this will be a great help

Regards

Taff

BTW Keep up the great oop work :U