Menu

#373 Issues after TUrlLink moved to OWLExt [r2663]

unspecified
wont-fix
None
1
2020-07-28
2017-03-03
No

On the trunk (version 7) in [r2663], TUrlLink was moved to OWLExt. After that, I had these problems:

  • When including owlext/urllink.h I needed to explicitely #define USE_OWLEXTLIB.
  • In debug mode, a CHECK fails in urllink.cpp on the attempt to load the cursor IDC_HANDCURSOR from urllink.rc.

Related

Bugs: #373
Bugs: #477
Commit: [r2663]

Discussion

  • Vidar Hasfjord

    Vidar Hasfjord - 2017-03-06
    • summary: Issues after urllink moved to owlext --> Issues after TUrlLink moved to OWLExt [r2663]
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -After TUrlLink was moved to OWLExt I had these problems:
    +On the trunk (version 7) in [r2663], TUrlLink was moved to OWLExt. After that, I had these problems:
    
    
     *     When including owlext/urllink.h I needed to explicitely #define USE_OWLEXTLIB.
     *     In debug mode, a CHECK fails in urllink.cpp on the attempt to load the cursor IDC_HANDCURSOR from urllink.rc.
    
     

    Related

    Commit: [r2663]

  • Vidar Hasfjord

    Vidar Hasfjord - 2017-03-06

    Are these issues real bugs?

    Regarding USE_OWLEXTLIB, isn't this "by design"? I.e. the intended way to specify that the OWLExt library should be linked statically? Presumably, unlike OWLNext, it defaults to dynamic linking. Right?

    Regarding "urlink.rc", I don't see an aggregate resource file to link instead. Seems to me that OWLExt is designed piece-meal, and that you need to build and link the resources needed for each component you use. In other words, again the issue seems to be "by design".

    If these are not bugs, but porting issues, this content is better put into the wiki (e.g. "Changes" section of the [Upgrading_from_OWL] document, and/or the [FAQ].) after the release of version 7.

     

    Related

    Wiki: Upgrading_from_OWL

  • Erwin Lotter

    Erwin Lotter - 2017-03-07

    Regarding USE_OWLEXTLIB, isn't this "by design"?

    I'm not really familiar with the design of OWLExt, I only know that the other OWLExt headers I include (dockingex.h, gadgetex.h) do not require this definition, so there seems to be some inconsistancy.

    Regarding "urlink.rc": It should be included from owlext.rc but for some reason, the IDC_HANDCURSOR is not avl., so where is the relation to design?

     
  • Vidar Hasfjord

    Vidar Hasfjord - 2017-03-07

    Regarding ["urllink.rc"]: It should be included from owlext.rc [...] the IDC_HANDCURSOR is not avl., so where is the relation to design?

    Ah, overlooked that there is an aggregate resource file ("source/owlext/owlext.rc"). However, it does include "urllink.rc", which includes IDC_HANDCURSOR ("owlext/res/hand.cur"), so I don't understand why it won't load. How did you solve the issue?

     
  • Erwin Lotter

    Erwin Lotter - 2017-03-08

    How did you solve the issue?

    I didn't. In non-debug mode, the code in urllink switches to an alternative cursor.

    ...so I don't understand why it won't load.

    Looking closer at owlext.rc I saw that it's supposed to include the resources into a DLL. Does this mean, the resources go not into the static libs?

     
  • Vidar Hasfjord

    Vidar Hasfjord - 2017-03-08

    Does this mean, the resources go not into the static libs?

    Correct. There's no resources in static libraries. You have to explicitly add the resource file to your project when linking statically, in this case "owlext.rc" (or just the resources you need, e.g. "urllink.rc"), so that the resulting executable includes the relevant resources. If this is the only issue, then it's "by design", and there's nothing to fix.

     
  • Erwin Lotter

    Erwin Lotter - 2017-03-14

    Ok.
    Regarding USE_OWLEXTLIB I found now that for my other OWLExt includes I defined it in a header somewhere else.

    What to do with this ticket: Can I delete it?

     
  • Vidar Hasfjord

    Vidar Hasfjord - 2017-03-15

    Hi Erwin, rather than deleting it, you can set the status to "wont-fix" to close the ticket. Someone may benefit from the information in the ticket at a later date.

     
  • Erwin Lotter

    Erwin Lotter - 2017-03-15
    • status: open --> wont-fix
    • assigned_to: Erwin Lotter
     
  • Sebastian Ledesma

    Hi:

    The current implementation of TURLLink uses the 'hand' cursor from the same executable.
    If the user didnt include urlink.rc into the executable then it will try to extract the resource from the "Winhelp32.exe".
    Winhelp32 it's not longer available in a standard Windows distribution, it has been replaced by .chm help.
    So as alternative we can update the code from

    void
    TUrlLink::SetupCursor()
    {
      SetCursor(GetModule(), IDC_HANDCURSOR);
      if(HCursor == 0){
        // if was problem try load cursor from winhlp32.exe
        // Get the windows directory
        TAPointer<TCHAR> Buffer = new TCHAR[MAX_PATH];
        ::GetWindowsDirectory(Buffer, MAX_PATH);
         _tcscat(Buffer,_T("\\winhlp32.exe"));
        // This retrieves cursor #106 from winhlp32.exe, which is a hand pointer
        HMODULE hModule = ::LoadLibrary(Buffer);
        if (hModule) {
          HCURSOR hHandCursor = ::LoadCursor(hModule, TResId(106));
          if (hHandCursor)
            HCursor = CopyCursor(hHandCursor); // it is a macro in Win32
    
          ::FreeLibrary(hModule);
        }
      }
    }
    

    to

    void
    TUrlLink::SetupCursor()
    {
      SetCursor(NULL, IDC_HAND);
    }
    

    IDC_HAND it's standard in Windows 10 (and previous). I dont know since what version but I'm pretty sure that Windows 2000 and above.

    See:
    https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-loadcursora

    Sebas

     
    👍
    1
    • Vidar Hasfjord

      Vidar Hasfjord - 2020-07-24

      Hi Sebastian, you should commit this fix, and also remove the unnecessary cursor resource (IDC_HANDCURSOR in "urllink.(rc|rh)").

       
  • Sebastian Ledesma

    Hi Vidar:

    I've made the commit 5253 https://sourceforge.net/p/owlnext/code/5253/
    where now TUrlLink no longer depends on IDC_HANDCURSOR and it also works fine in Windows.

    We can remove the definition of IDC_HANDCURSOR and also the same resource cursor from urlink.rc. It's an ABI compatible change, but some user code could depend on it, so by removing it, it could break code but it's an easy change for the final user.
    I've reviewed the whole OWLNext & OWLext code and there is no other reference to IDC_HANDCUR.

    A little of history:

    • Winhelp was introduced in 1990 in Windows 3.0
    • In 1995 Windows 95 introduced winhelp32 in wich was based the resource load of previous TUriLink in case that the user didnt included the urllink.rc.
    • In 1996 Microsoft announced that .hlp will be replaced by 'Compiled HTML Help' . The chm format.
    • The .chm help were introduced in 1997. Winhelp32 was included for compatibility in the next versions of Windows until Windows XP launched in 2003.
    • A new help format was launched by in 2001: Microsoft Help 2
    • Windows Vista launched in 2006 no longer included winhelp32.
      So for 14 years we depended in a file that no longer was included in standard Windows distribution.

    Sebas

     
  • Vidar Hasfjord

    Vidar Hasfjord - 2020-07-26

    Hi Sebastian,

    I've made the commit [r5253] where now TUrlLink no longer depends on IDC_HANDCURSOR and it also works fine in Windows.

    Good! I have created a separate ticket for this issue [bugs:#477] and, since you've committed the change on the 6.44 branch, I have included it in upcoming fixes for 6.44.12.

    For compatibility, you can leave the IDC_HANDCURSOR intact on the 6.44 branch.

    For consistency, please merge the change to the trunk and branch/7.0 as well. Here you can remove the superfluous cursor resource, if you want to, since TUrlLink has been deprecated since 7.0 anyway (replaced by TSysLink and moved to OWLExt).

    PS. Any SourceForge resource (artifact) can be linked with surrounding square brackets, e.g. [r5253] and [bugs:#373]. See the Markdown Syntax Guide.

     

    Related

    Bugs: #373
    Bugs: #477
    Commit: [r5253]


    Last edit: Vidar Hasfjord 2020-07-26
  • Sebastian Ledesma

    I'm still a little rusty with SVN, so please check the commit 5254 in the trunk
    https://sourceforge.net/p/owlnext/code/5254/

    Sebas

     
  • Vidar Hasfjord

    Vidar Hasfjord - 2020-07-28

    Hi Sebastian,

    Your commit [r5254] looks good. I changed the log statement to follow our conventions, and added a note about the removal of the obsolete IDC_HANDCURSOR:

    Merged [r5253] from branches/644 to trunk:
    BUG: TUrlLink uses outdated WinHelp [bugs:#477].
    
    Note: This revision also removes the IDC_HANDCURSOR from "urllink.rc", since it is not used (the code now always uses the standard IDC_HAND cursor).
    

    See OWLNext Coding Standards and review the Code log to get a feel for our conventions.

    Tip: Use SourceForge artifact link syntax (square brackets) for linking to revisions and ticket in posts and log statement, e.g. [r5253] and [bugs:#477]. This syntax can also be used to link to discussions and wiki pages. Set the Markdown Syntax Guide (press the question mark icon on the editor toolbar).

     

    Related

    Bugs: #477
    Commit: [r5253]
    Commit: [r5254]


Log in to post a comment.

MongoDB Logo MongoDB