Spell checker - AddFromPath fails under windows 7

  • Hi,

    I'm installing my application which uses TextDynamic with the spell checker switched on, under Windows 7.
    When installed on a pristine clean Win7, the spell checker dictionaries fail to load. But they load just fine under Vista and WinXP

    Here is the code sample i'm using

    Code
    wpTextDynamic.SetLayout("c:\Program files\MyAPP\wpButtonsDefault.pcc"), "default", String.Empty, "main", "main");
    
    
    // the following line fails under windows 7
    wpTextDynamic.SpellCtrl.AddFromPath("c:\Program files\MyAPP\wpDictionaries");
    
    
    wpTextDynamic.SpellCtrl.SetLanguage("9"); // English
    wpTextDynamic.wpaProcess("SpellAsYouGo", "1");

    The specified directory does indeed have the .dct files (7 in all i think).
    I've chosen not to use an ini file or a registry entry to initialise the control (I want to keep the target machine as clean as possible), and doing it like this works beautifully under WinXp and Vista.
    The usual tricks using Win7 of "running as administrator" or "running in XP sp3 compatibility mode" makes no difference. Neither does the location of the directory, or the NTFS permissions on that directory.

    I've checked with the sysinternals process monitor and found that when the "AddFromPath" line is executed, that all *.dct files in that directory are enumerated, but they then appear to be ignored.

    Does anyone else have this problem?
    If so is it possible to request a bugfix?

    Thanks

  • Hi Julian,

    I originally had the files under "C:\ProgramData\<myapp>\Data" and the NTFS permissions on that directory are the default ones (all according to microsoft guidelines on shared data).
    It works under Vista just fine (which is what i discovered initially). But it doesnt work under Win7.

    So to make sure I have just double checked on both a clean image of vista and a clean win7. I've just confirmed that the problem is not there in vista, but is definitely there in win7.

    In the code sample above i moved it to "c:\program files...." just for illustrative purposes. But i tested it in various different directories, it made no difference. Under vista any directory worked, under win7 no directory worked. Both the configuration (directory and permissions) and the code is identical under both os's but they have different behaviours.

    To confuse me a little i can even see SysInternals process monitor tool enumerating the files under win7, so it does detect their presence, but the textdynamic editor ignores them anyway.
    To confuse things further still, if i go into the configuration dialog for spellchecking options i can add the files in manually from that exact folder "C:\ProgramData\<myapp>\Data", it works just fine. It just doesn't seem to initialize for the very first time programatically under Win7 only.

    cheers

    Neil

  • Hi,

    We are using WPSpell 1.55 and experience some (the same?) problems under certain circumstances. Our application (with WPSpell 1.55) is running on a variety of OS's.

    On some OS configurations (Vista/Win7/W2K8/W2007/...) the DCT files which are queried by the TWPSpellController.AddFromPath routine are not found!.
    After doing some small debug work we've found the following line of code which is causing this 'problem'.

    Unit : WPSpell_Controller.pas
    Method : AddFromPath
    Line nr: ~ 2726

    [code snip]
    repeat
    if (sr.Attr and FileAttrs) = sr.Attr then <<--- problem caused by this line
    AddFromFile(path + '\' + sr.Name);
    until FindNext(sr) <> 0;
    [/code snip]

    When evaluating the sr.Attr value the debugger returns 8224 instead of an masked 63 value. This problem can easily reproduced...

    Locate the .DCT file which are added by the AddFromPath method, right click on a DCT file and go to the 'advanced' settings of the file.
    Uncheck the "file contents and properties can/may be indexed" checkbox (don't know how they call it exactly on a English OS, I'm having a Dutch OS).
    When Unchecking this property the attribute FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = $00002000 is added to the current file attributes. And voila... problem created.
    Check in your app if the WPSpell part *CAN* find this 'changed' file. In our code/app it won't!

    when changing the source line: if (sr.Attr and FileAttrs) = sr.Attr then
    into: if (sr.Attr and FileAttrs) > 0 then
    it all works fine.

    Is this 'fix' correct?

    Thanks in advance,

    R. Lichtendahl
    ENK Software BV.
    Europe - The Netherlands (+1GMT)