News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

List View?

Started by drprogrammer, September 06, 2012, 09:33:30 AM

Previous topic - Next topic

drprogrammer

Hi,

Im begginer in masm programming, I already programmed in Delphi and Visual Basic,
Please answer easy, becouse Im very noob...
I trying to do a program to connect in a data bank in access, becouse assembler is very fast and smaller, and don't need to to copy to destination computer dll's files
I following some tutorials and examples,
and...
I trying to do a listview, at this time, I just want to put the listview in corret positon, after I will work with data of data bank
but my program not show the list view, I tryied one hundred of manners, but not work, the program's run, but the list view doesn't show.

res.h
#define LVS_REPORT              0x0001
#define LVS_SINGLESEL           0x0004
.....
Program.inc
.const
ListView_ID      equ 1005
.data
ListViewClassName db "SysListView32", 0
.data ?
hwnd_ListView   HWND      ?
.........
Program.asm
......
invoke InitCommonControls
......
invoke CreateWindowEx, NULL, ADDR ListViewClassName, NULL, \
             LVS_REPORT OR LVS_SINGLESEL or WS_VISIBLE or \
             WS_BORDER OR WS_TABSTOP, \
              0, 0, 700, 500, hWnd, ListView_ID, hInstance, NULL
mov hwnd_ListView, eax

Please, why the program not show the list view?

hutch--

#1
Hi drprogrammer,

Welcome on board. I moved your topic to the Campus so that your posting would be seen by more people.

[typo]  :biggrin:

qWord

Hi,
based on your code fragments, I assume that the problem is the missing style WS_CHILD.

BTW: an EQU (= similar to c/c++'s #define) exist only while assembling - there is no need to place this directive in a segment (.const in your case)
MREAL macros - when you need floating point arithmetic while assembling!

drprogrammer

Yes, you are right, was missing WS_CHILD, now showing the listview!!!!!
Thanks
some tutorials and examples that i was used show .const with EQU
if I not use this EQU what should use?

dedndave

i usually put most of my EQUates before i open any section

placing EQU inside a section doesn't hurt anything
but, it does not generate any code or data
if the .CONST section is otherwise empty, likely it does not get created   :P

.CONST doesn't make as much sense in assembler as it does in compiled code
i usually put constant data in the .DATA section
then, it is my responsibilty to ensure that it does not get overwritten
creating a .CONST section otherwise serves to increase EXE size

Tedd

Placing EQUates in a const section does nothing as far as the section is concerned - if it's otherwise empty, it may as well not be there. EQU itself doesn't produce any data, it just provides a more readable name for values you might use.

Placing initialised data in a const section will reduce the size of your exe, compared with placing them in their own data section. A read-only data section (what .const equates to) is already added to your exe for storing the import strings (dll and function names), so your own const data is just added into this section. If you put your data in a writable data section (.data) then a whole new section is added to the exe just for this (and the other read-only section is also still there.)

So, unless you specifically intend to modify your initialised data, it's preferable to place it in a const section. It's smaller overall, and your data is protected against writing by the OS (an exception is thrown if attempted.)
Potato2