Re: commctrl v6 working

new topic     » goto parent     » topic index » view thread      » older message » newer message

Okay, nobody's shouting "it's been done" yet.

So what is it that it does do? I'm glad you asked. We have all seen those glossy dialogs and shiny controls those modern programs all have. You know they are there somewhere. Yet when you use Exw to create a window it looks plain old and grey no matter what flags and styles you give it. You may as well be using Win3.1.

This is no way to make impressive software.

Here is one method I found to activate the newer common controls library. Unlike all other system dlls the common controls will not activate the most recent version but will use an old version 5 unless instructed otherwise.

Microsoft alleges it is to increase compatibility, forcing coders to verify operation with the newer controls.

WARNING: This method requires altering your Euphoria executable(s). I would not expect much bad effect from an extra resource but no guarantees. If it is harmless, it may be an idea to throw it in the main Euphoria trunk, as one can still choose to use commctrl v6 or not with the init_commctrl call.

So here is what I did for anybody interested:

I added the following resource to exwc.exe as Type: "24" and Name: "1"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
<assemblyIdentity 
version="1.0.0.0" 
processorArchitecture="X86" 
name="Open.Euphoria.Program" 
type="win32" 
/> 
<description>Euphoria program.</description> 
<dependency> 
<dependentAssembly> 
<assemblyIdentity 
type="win32" 
name="Microsoft.Windows.Common-Controls" 
version="6.0.0.0" 
processorArchitecture="X86" 
publicKeyToken="6595b64144ccf1df" 
language="*" 
/> 
</dependentAssembly> 
</dependency> 
</assembly>  
 
 
I then declare Windows' InitCommonControlsEx:

comctl32 = open_dll("comctl32.dll") 
iInitCommonControlsEx = define_c_func(comctl32, "InitCommonControlsEx", {C_POINTER}, C_INT), 
 
 

and make a function with it.

--Initialise Common Controls v6  
global procedure init_commctrls(atom controls) 
  atom ptr, ok 
  ptr = allocate(8) 
  poke4(ptr, 8) 
  poke4(ptr + 4, controls)  
  ok = c_func(iInitCommonControlsEx, {ptr}) 
  free(ptr) 
end procedure 
 
 

I then call this routine from the WM_CREATE of my main window's callback.

  ... 
  if iMsg = WM_CREATE then 
    init_commctrls(or_all({ICC_LISTVIEW_CLASSES,...}) 
    ... 
 
 

And suddenly all my controls are even more windowsy without me needing to do anything else. M$ says this code ought to work with the following Windows and higher: Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0

There is a long list of control classes that correspond to many of the new standard windows controls. M$ says:

dwICC 
    The set of bit flags that indicate which common control classes will  
be loaded from the DLL. This can be a combination of the following values. 
 
ICC_ANIMATE_CLASS = #00000080 
        Load animate control class.  
ICC_BAR_CLASSES = #00000004 
        Load toolbar, status bar, trackbar, and tooltip control classes.  
ICC_COOL_CLASSES = #00000400 
        Load rebar control class.  
ICC_DATE_CLASSES = #00000100 
        Load date and time picker control class.  
ICC_HOTKEY_CLASS = #00000040 
        Load hot key control class.  
ICC_INTERNET_CLASSES = #00000800 
        Load IP address class.  
ICC_LINK_CLASS = #00008000 
        Load a hyperlink control class.  
ICC_LISTVIEW_CLASSES = #00000001 
        Load list-view and header control classes.  
ICC_NATIVEFNTCTL_CLASS = #00002000 
        Load a native font control class.  
ICC_PAGESCROLLER_CLASS = #00001000 
        Load pager control class.  
ICC_PROGRESS_CLASS = #00000020 
        Load progress bar control class.  
ICC_STANDARD_CLASSES = #00004000 
        Load one of the intrinsic User32 control classes. The user  
controls include button, edit, static, listbox, combobox, and scrollbar.  
ICC_TAB_CLASSES = #00000008 
        Load tab and tooltip control classes.  
ICC_TREEVIEW_CLASSES = #00000002 
        Load tree-view and tooltip control classes.  
ICC_UPDOWN_CLASS = #00000010 
        Load up-down control class.  
ICC_USEREX_CLASSES = #00000200 
        Load ComboBoxEx class.  
ICC_WIN95_CLASSES = #000000FF 
        Load animate control, header, hot key, list-view, progress bar,  
status bar, tab, tooltip, toolbar, trackbar, tree-view, and up-down control classes. 

I have tried all four combinations of mod/unmod Eu with init/no init code and nothing complains, you just don't get the new controls unless both are present.

Hope this helps someone.

Cheers, Nick.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu