1. wxEuphoria: wxWidgets_Version() Function?

Is there a function I can use to determine what version of wxWidgets is being used? I have six PCs (all various flavors of Windows and Office for testing purposes), and I think someone is lagging behind. I need to be able to get the version of wxWidgets, only because I think it would help me debug why delete_tree_item() isn't working.

new topic     » topic index » view message » categorize

2. Re: wxEuphoria: wxWidgets_Version() Function?

euphoric said...

Is there a function I can use to determine what version of wxWidgets is being used? I have six PCs (all various flavors of Windows and Office for testing purposes), and I think someone is lagging behind. I need to be able to get the version of wxWidgets, only because I think it would help me debug why delete_tree_item() isn't working.

If I recall correctly, the version information is only exposed via macros so there are not any functions that you could link to dynamically. If you're on Windows, you could try using the GetFileVersionInfo function to determine the library's version. I've wrapped it from memory and available docs, but I don't have the opportunity to test it right now. Good luck!

include std/dll.e 
include std/machine.e 
 
atom Version_dll = open_dll( "Version.dll" ) 
constant xGetFileVersionInfoSize = define_c_func( Version_dll, "GetFileVersionInfoSizeA", {C_POINTER,C_POINTER}, C_DWORD ) 
constant xGetFileVersionInfo = define_c_func( Version_dll, "GetFileVersionInfoA", {C_POINTER,C_DWORD,C_DWORD,C_POINTER}, C_BOOL ) 
constant xVerQueryValue = define_c_func( Version_dll, "VerQueryValueA", {C_POINTER,C_POINTER,C_POINTER,C_POINTER}, C_BOOL ) 
 
public function GetFileVersionInfo( sequence filename ) 
 
    atom lpFilename = allocate_string( filename, 1 ) 
    atom dwLen = c_func( xGetFileVersionInfoSize, {lpFilename,NULL} ) 
    atom lpData = allocate_data( dwLen, 1 ) 
 
    integer result = c_func( xGetFileVersionInfo, {lpFilename,NULL,dwLen,lpData} ) 
    if result then 
        -- success 
        return lpData 
    end if 
 
    -- failure 
    return NULL 
end function 
 
public function VerQueryValue( atom info, atom value ) 
 
    atom pBlock = info 
    atom lpSubBlock = allocate_string( "\\", 1 ) 
    atom lplpBuffer = allocate_data( 4, 1 ) 
    atom puLen = allocate_data( 4, 1 ) 
 
    integer result = c_func( xVerQueryValue, {pBlock,lpSubBlock,lplpBuffer,puLen} ) 
    if result then 
        -- success 
        atom lpBuffer = peek4u( lplpBuffer ) 
        atom len = peek4u( puLen ) 
        return peek4u( lpBuffer + value ) 
    end if 
 
    -- failure 
    return {} 
end function 
 

Example:

include std/convert.e 
 
atom info = GetFileVersionInfo( "wxmsw28u_core_gcc_eu.dll" ) 
if info != NULL then 
 
    atom lo_dword = VerQueryValue( info, dwFileVersionMS ) 
    atom hi_dword = VerQueryValue( info, dwFileVersionLS ) 
 
    sequence bytes = int_to_bytes(lo_dword) & int_to_bytes(hi_dword) 
 
    atom major = bytes_to_int( bytes[3..4] ) --  2 
    atom minor = bytes_to_int( bytes[1..2] ) --  8 
    atom patch = bytes_to_int( bytes[7..8] ) -- 12 
    printf( 1, "wxWidgets %d.%d.%d\n", {major,minor,patch} ) 
 
    -- prints "wxWidgets 2.8.12" 
 
end if 

Edit:

I had some time to test this and of course it was wrong. Updated VerQueryValue function and example code. I tested against the same DLLs that you should be using from the 0.17.0 package I've provided.

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: wxEuphoria: wxWidgets_Version() Function?

ghaberek said...

I tested against the same DLLs that you should be using from the 0.17.0 package I've provided.

What particular DLL tells me what version of wxWidgets I have? And what should those values be?

new topic     » goto parent     » topic index » view message » categorize

4. Re: wxEuphoria: wxWidgets_Version() Function?

euphoric said...
ghaberek said...

I tested against the same DLLs that you should be using from the 0.17.0 package I've provided.

What particular DLL tells me what version of wxWidgets I have? And what should those values be?

All of the DLL files have the same version assigned: 2.8.12, which is the latest in the 2.8 release. Here is an expanded example to show all the versions.

include std/convert.e 
 
sequence wxlibs = { 
    "wxbase28u_gcc_eu.dll", 
    "wxbase28u_net_gcc_eu.dll", 
    "wxbase28u_xml_gcc_eu.dll", 
    "wxmsw28u_adv_gcc_eu.dll", 
    "wxmsw28u_aui_gcc_eu.dll", 
    "wxmsw28u_core_gcc_eu.dll", 
    "wxmsw28u_html_gcc_eu.dll", 
    "wxmsw28u_media_gcc_eu.dll", 
    "wxmsw28u_qa_gcc_eu.dll", 
    "wxmsw28u_richtext_gcc_eu.dll", 
    "wxmsw28u_xrc_gcc_eu.dll" 
} 
 
for i = 1 to length( wxlibs ) do 
     
    atom info = GetFileVersionInfo( wxlibs[i] ) 
    if info != NULL then 
     
        atom lo_dword = VerQueryValue( info, dwFileVersionMS ) 
        atom hi_dword = VerQueryValue( info, dwFileVersionLS ) 
 
        sequence bytes = int_to_bytes(lo_dword) & int_to_bytes(hi_dword) 
 
        atom major = bytes_to_int( bytes[3..4] ) --  2 
        atom minor = bytes_to_int( bytes[1..2] ) --  8 
        atom patch = bytes_to_int( bytes[7..8] ) -- 12 
 
        printf( 1, "%s = %d.%d.%d\n", {wxlibs[i],major,minor,patch} ) 
     
    end if 
     
end for 

-Greg

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu