Fix for WPWordConv

  • After much searching I finally fixed the problem of WPWordConv.pas not working with the latest Office 2007 converters on Windows Vista. Below a snippet of code with the line that needs to be changed:
    ......
    try
    InitConverter(Application.Handle, PChar(Uppercase(Application.ExeName)));
    GlobalOutStream := Output;
    Output.Clear;
    ghszSubset := StringToHandle('');
    //WAS: ghszConvtrVersion := StringToHandle('Word 97');
    ghszConvtrVersion := StringToHandle(GetFileDescription(FConverter));

    //WAS: ghszFile := StringToHandle(InputFile);
    ghszFile := StringToHandle(StringToOem(InputFile));
    //GlobalBuffer := GlobalAlloc(GMEM_FIXED {GHND}, 1024 * 4); // Old line of code
    GlobalBuffer := GlobalAlloc(GHND, 4096); //new line of code changed to work with Office 2007 converters.
    FError := '';
    if Mode = wpcnvExport then
    begin
    result_value := RtfToForeign(ghszFile, nil, GlobalBuffer, ghszConvtrVersion, @ReadCallback);
    if result_value <> 0 then
    FError := FError + ConvErrorStrings[abs(result_value)];
    end
    ........

    Someone who is more familar with the code may come up with another solution, but for me it appears to be working. I also checked it and it appears to work with Windows XP and Office 2003.