News:

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

Memory dialogs revisited.

Started by hutch--, March 15, 2011, 01:09:53 PM

Previous topic - Next topic

dedndave

   mov icce.dwSize, SIZEOF INITCOMMONCONTROLSEX
   xor eax, eax
   or eax, ICC_ANIMATE_CLASS
   or eax, ICC_BAR_CLASSES
   or eax, ICC_COOL_CLASSES
   or eax, ICC_DATE_CLASSES
   or eax, ICC_HOTKEY_CLASS
   or eax, ICC_INTERNET_CLASSES
   or eax, ICC_LISTVIEW_CLASSES
   or eax, ICC_PAGESCROLLER_CLASS
   or eax, ICC_PROGRESS_CLASS
   or eax, ICC_TAB_CLASSES
   or eax, ICC_TREEVIEW_CLASSES
   or eax, ICC_UPDOWN_CLASS
   or eax, ICC_USEREX_CLASSES
   or eax, ICC_WIN95_CLASSES
   mov icce.dwICC, eax
   invoke InitCommonControlsEx,ADDR icce


yikes !

how about.....
ICC_FLAGS = ICC_WIN95_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_ANIMATE_CLASS
ICC_FLAGS = ICC_FLAGS or ICC_BAR_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_COOL_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_DATE_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_HOTKEY_CLASS
ICC_FLAGS = ICC_FLAGS or ICC_INTERNET_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_LISTVIEW_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_PAGESCROLLER_CLASS
ICC_FLAGS = ICC_FLAGS or ICC_PROGRESS_CLASS
ICC_FLAGS = ICC_FLAGS or ICC_TAB_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_TREEVIEW_CLASSES
ICC_FLAGS = ICC_FLAGS or ICC_UPDOWN_CLASS
ICC_FLAGS = ICC_FLAGS or ICC_USEREX_CLASSES

       .DATA
icc INITCOMMONCONTROLSEX <sizeof INITCOMMONCONTROLSEX,ICC_FLAGS>

       .CODE
       INVOKE  InitCommonControlsEx,offset icc

total size ~ 18 bytes

Hutch - i doubt there is any harm in initializing controls you don't use
although, it may use memory unnecessarily
the problem i see is that if you don't initialize the ones you do use....
.... it has to be tested on a platform that exhibits the problem   :'(

hutch--

Dave,

Apart from the MASM line length limit there is nothing to stop you from orring the whole lot together so that you only had 4 bytes but size is not the problem, I am trying to quantify why initialising all of the controls works on some Windows versions but not others and by versions I mean the language version. I cannot duplicte the problem with any of my US English versions.

I have the OR list for convenience of being able to comment them in and out, not for minimum size even though their memory usage is trivial.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

that's why i listed them seperately, as well - so you can comment them out

i see a lot of uninitialied structures - initialized in code
if you initialize a dword in code, it usually takes at least 5 bytes   :dazzled:
why not just pre-initialize the data - execution time = 0 - and it is smaller
(it might make sense if much of the structure need not be initialized)

Antariy

Quote from: hutch-- on March 18, 2011, 04:00:49 AM
Alex,

I have no doubt that many read you post, its just that I remembered it.  :U

Thank you, Hutch! :bg

hutch--

Dave,

The assumption that the size matters is one we don't share, this type of stuff most probably would not line up to the next 512 byte section. I am far more interested in getting it to work on multiple language versions.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Antariy

Jochen:

call InitCommonControlsEx ; this will never be called, but


:wink this is right, the dll just should be statically linked. On my system InitCommonControls code is just a RET as first instruction of the "function". Very funny.
What it is on other systems?

Vortex

Hi Hutch,

Thanks for the new version of the example. It works fine. InitCommonControls solved the problem.

Hi Antariy,

I remembered for your posting, thanks.

Ramon Sala

Hi Hutch,

This is my report for catalan and spanish versions of Windows:

Win2K3 Server and Win7 32-64 bit: The dialog works fine without initializing common controls.

WinXp SP3: The dialog just works if common controls are initialized. However, calling InitCommonControls is enough (no need to call InitCommonControlsEx).

Regards.
Greetings from Catalonia

jj2007

Quote from: Antariy on March 18, 2011, 02:10:24 PM
:wink this is right, the dll just should be statically linked. On my system InitCommonControls code is just a RET as first instruction of the "function". Very funny.
What it is on other systems?

Win XP SP2, Italian edition: InitCommonControls is just a retn, and static linking without actually calling it makes the dialog work ::)
InitCommonControlsEx has the same positive effect, but when you call it, there is a bit more than just a retn. It starts with the intelligent opcode mov edi, edi ;-)

dedndave

perhaps there is more to it than meets the eye
it may be that pulling the function in also pulls in some other code and/or data that is not readily obvious