The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Phedge34 on April 08, 2005, 02:19:19 AM

Title: Problems with Toolbars and Status windows
Post by: Phedge34 on April 08, 2005, 02:19:19 AM
Here is what I am doing...

        invoke CreateWindowEx,NULL,TOOLBARCLASSNAME,NULL,WS_CHILD or\
                              CCS_ADJUSTABLE,0,0,0,0,hWnd,ID_TOOLBAR,\
                              hInstance,NULL
        mov hToolBar, eax

        invoke CreateWindowEx,NULL,STATUSCLASSNAME,NULL,WS_CHILD or\
                              CCS_ADJUSTABLE,0,0,0,0,hWnd,ID_STATBAR,\
                              hInstance,NULL
        mov hStatus, eax

This is the result...

Assembling: C:\masm32\Projects\Template\TEMPLATE.asm
C:\masm32\Projects\Template\TEMPLATE.asm(191) : error A2006: undefined symbol : TOOLBARCLASSNAME
C:\masm32\Projects\Template\TEMPLATE.asm(191) : error A2114: INVOKE argument type mismatch : argument : 2
C:\masm32\Projects\Template\TEMPLATE.asm(290) : error A2006: undefined symbol : STATUSCLASSNAME
C:\masm32\Projects\Template\TEMPLATE.asm(290) : error A2114: INVOKE argument type mismatch : argument : 2

Anyone know how to fix/get around this?
Title: Re: Problems with Toolbars and Status windows
Post by: mnemonic on April 08, 2005, 02:34:25 AM
I don't think that you provided the full source, but anyway...
This is what Win32.hlp says about CreateWindowEx:
HWND CreateWindowEx(

    DWORD dwExStyle, // extended window style
    LPCTSTR lpClassName, // pointer to registered class name
    LPCTSTR lpWindowName, // pointer to window name
    DWORD dwStyle, // window style
    int x, // horizontal position of window
    int y, // vertical position of window
    int nWidth, // window width
    int nHeight, // window height
    HWND hWndParent, // handle to parent or owner window
    HMENU hMenu, // handle to menu, or child-window identifier
    HINSTANCE hInstance, // handle to application instance
    LPVOID lpParam // pointer to window-creation data
   );


About lpClassName it says:
lpClassName

Points to a null-terminated string or is an integer atom.
If lpClassName is an atom, it must be a global atom created by a previous call to GlobalAddAtom.
The atom, a 16-bit value less than 0xC000, must be in the low-order word of lpClassName;
the high-order word must be zero.
If lpClassName is a string, it specifies the window class name.
The class name can be any name registered with the RegisterClass function or any of the
predefined control-class names.


I don't think you are providing CreateWindowEx a pointer to some string, do you?
Title: Re: Problems with Toolbars and Status windows
Post by: Darrel on April 08, 2005, 02:38:03 AM
In the data section

.data
TOOLBARCLASSNAME  BYTE  "MyWackyToolBar",0
STATUSCLASSNAME   BYTE "MyWackySataus",0

In your Invoke Statements replace:

TOOLBARCLASSNAME with ADDR TOOLBARCLASSNAME
STATUSCLASSNAME with ADDR STATUSCLASSNAME

This will solve that problem  :dance:
Title: Re: Problems with Toolbars and Status windows
Post by: Phedge34 on April 08, 2005, 02:52:36 AM
TOOLBARCLASSNAME and STATUSCLASSNAME are Windows classes.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/common/classes.asp

They are most likely supposed to be defined in the windows.inc file.  What I am basically looking for are the constant values for these two classes...I think.
Title: Re: Problems with Toolbars and Status windows
Post by: mnemonic on April 08, 2005, 03:07:34 AM
Hmmm... looks like you were dealing with CommonControls.
The only advice I can give you is to have a look at Iczelion's tutorials (http://win32assembly.online.fr/tutorials.html), especially this one (http://win32assembly.online.fr/tut18.html).
You should find a way from there on.
Title: Re: Problems with Toolbars and Status windows
Post by: Phedge34 on April 08, 2005, 03:10:30 AM
Yeah, I am actually working off of his tutorial.  I was hoping to use the new way of creating a toolbar as M$ says, "Note   This function[CreateStatusWindow] is obsolete. Use CreateWindow instead."
Title: Re: Problems with Toolbars and Status windows
Post by: mnemonic on April 08, 2005, 03:17:24 AM
Sorry, but I don't see the point.
He uses:
invoke CreateWindowEx,NULL,ADDR ProgressClass,NULL,\
            WS_CHILD+WS_VISIBLE,100,\
            200,300,20,hWnd,IDC_PROGRESS,\
            hInstance,NULL

with ProgressClass being:
ProgressClass  db "msctls_progress32",0       ; the class name of the progress bar
He uses CreateWindowEx the same way as you are trying but with the class name instead of the constant (which obviously doesn't work however).
Title: Re: Problems with Toolbars and Status windows
Post by: Phedge34 on April 08, 2005, 03:32:26 AM
Hmmm... I lied.  I thought I was working off his tutorial but I was confused. I was working off of some other lame ass tutorial I found at websters.cs.ucr.edu.  That table he has at the begining is exactly what I need.  Thanks, sorry for the trouble.