Author Topic: List View?  (Read 3291 times)

drprogrammer

  • Guest
List View?
« on: September 06, 2012, 09:33:30 AM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 6679
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: List View?
« Reply #1 on: September 06, 2012, 10:00:15 AM »
Hi drprogrammer,

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

[typo]  :biggrin:
« Last Edit: September 06, 2012, 02:36:19 PM by hutch-- »
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: List View?
« Reply #2 on: September 06, 2012, 10:35:59 AM »
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

  • Guest
Re: List View?
« Reply #3 on: September 06, 2012, 11:00:42 AM »
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

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: List View?
« Reply #4 on: September 06, 2012, 06:34:00 PM »
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

  • Member
  • ***
  • Posts: 377
  • Procrastinor Extraordinaire
Re: List View?
« Reply #5 on: September 07, 2012, 12:29:03 AM »
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