Post C++ source fix for KitCADi3ie5.exe

Uploaded the C++ source for allowing KitCADi3ie5.exe to use web form POST data (Variant *PostData). The example provided using supplied code will only compile with Rad Studio 2010 C++Builder (and so no public release is currently uploaded). A work-around for older compilers is taking longer than expected but will be developed before any public release which will include POST functions for all webforms (example provided is only enabled to use KP2-KPX.html#HASH form POST’s).

KitCADi3ie5.exe; C++ Builder 2010 source post fix:- ie5.5sp2-2010postfix.zip
KitCADi3ie5.exe; C++ Builder 4 PRO srouce post issue:- Ptr_to_TVariant ???

17 Responses to “Post C++ source fix for KitCADi3ie5.exe”

  1. Admin Says:

    Attempt #1;
    To compile with BCB4PRO (No PostData will be returned) :-

    Modify the source 2010 code back to the BCB4 version for using TWebBrowser_v1 *CppWebBrowser1 and void *PostData_which_is_really_a_Ptr_to_TVariant.

    Then; Before the text of #pragma insert the following line :-

    #include <shlwapi .h> //StrCpyN

    Before the text of if (PostData != NULL insert the following line:-

    TVariant *PostData = static_cast<TVariant *>( PostData_which_is_really_a_Ptr_to_TVariant );

    And, Before the text of if(formpostdata != “” insert the following line:-

    delete PostData; //cleanup the static_cast

    Build and run. Note that the Post fix does NOT work. 🙁
    Help ? Searching …

  2. Admin Says:

    Attempt #1.5; A test run just for fun…

    Ripped code from RAD Studio 2010 and inserted it into code for BCB4 version. Got to have Variant *PostData_which_is_really_a_Ptr_to_TVariant and TVariant *PostData_which_is_really_a_Ptr_to_TVariant working during code runtime and designtime but still had no luck getting PostData = I kinda expected that this time 🙁

    It also may possible to build an EXE file using RAD Studio for running on 95 so long as all the possible BPL LIB files are included within builds, along with unicows.exe (the MSLU SDK).

  3. Admin Says:

    Attempt #1.6; A BCB4PRO work-around

    Have been able to extract the un-encoded form data value using MSHTML.h and BCB4PRO. The returned data value is NOT by Variant *PostData but is returned by using OlePropertyGet commands to scan the DOM Elements of the owindow frame 🙂

    Some re-writting is needed for KitCADi3ie5.exe source code – after which will support compiles by both RAD Studio 2010 (PostData/UTF) and BCB 4 (DOM/ASCII).

  4. Admin Says:

    Uploaded changes for webform POST to KitCADi3ie5.exe C++ source code using RAD Studio 2010 and Borland C++ Builder4 at: ie5.5sp2-2010.zip

    Adjused previous upload file ie5.5sp2-2010postfix.zip to only contain the updated _i3_kpx.htm webform POST file.

  5. Admin Says:

    Changes to source code have Failed during runtime testing on XP Box (KitCADi3ie5.exe was compiled using BCB4PRO)

    🙁

  6. Admin Says:

    Made more changes, removed Variant *PostData SafeArray input. Replaced PostData input method by using a Ole calls to the HTML Document frames and Current DOM for data input.

    These changes also remove the #HASH option from output files. Instead these files now generate content that is then sent to the KitCADi3ie5.exe pogram using a hidden webform POST method from within the owindow frame.

    Re-tested on XP Box without errors 🙂

  7. Admin Says:

    Updated KitCADi3ie5.exe and hypertext markup to use URL?DOM in the download of KitCADi3_file_localhost_test_w32_setup.exe (for file://localhost/).

    Updated KitCADi3ie5.exe files in downloads without changes from URL#HASH hypertext markup in the downloads of KitCADi3.zip, KitCADi3_setup.zip, KitCADi3_wampp2_localhost.zip, KitCADi3_xampp_localhost.zip, and Online. These file downloads will be updated to use URL?DOM at a later date (after more testing and because there is no imediate need to update).

    No notice of update to KitCAD i3 will be shown (release date of latest update will be 17th April 2010). Downloaded KitCAD i3 versions after the 22nd of May will include the updated files for allowing KitCAD i3 to use the URI?DOM input/output functions. Changes to use URL?DOM will be completed before the 15th of June 2010 upgrade.

  8. Admin Says:

    Re-tested on XP without KitCAD 2 installed.
    Found bugs, and corrected, retested, and uploaded KitCADi3_file_localhost_test_w32_setup.exe

    Corrected HASH loading that resulted in ‘undefined’ value error in Index.html; The script was looking for a webpage value that had not loaded.

    Corrected missing vcl40.bpl file error message that was shown during the loading of KP2 files (kp2html.exe -400kb -> +794kb).

    The notice to update KitCAD i3 TEST Setup(KitCADi3_file_localhost_test_w32_setup.exe) will be shown with the release date of 22nd May, 2010.

  9. Admin Says:

    Test Results of lse353637.kp2 and KitCAD i3 KGC exe TEST (Default i3 mode). Below are some runtime errors that will be corrected if possible before next update. Bugs below seem to be caused by missing or altered text processed by KitCADi3ie5.exe

    –Save/Open–

    KP2:
    Tested Ok.

    –Rendering–

    VRML97
    Tested OK

    X3DV:
    Tested OK

    VML: *
    Rendered page rendered and displays ok but has text on top left of page:
    default#VML” ?><![endif]–>#

    Canvas:
    Tested OK

    SGV: **
    XML parsing failed: syntax error (Line: 7, Character: 0)
    Reparse document as HTML
    Error: invalid attribute specification
    Specification: http://www.w3.org/TR/REC-xml/#NT-Attribute

    WPFE: **
    The Silverlight.js script src should contain a file path to prevent missing script errors.
    And while rendering the Silverlight error message shows:
    ErrorCode: 7008
    ErrorType: ParserError
    Message: 7008 An error has occured
    XamlFile: file///c:/Documents%20and%20Settings/Jason/Desktop/kitcadi3_wpfe.xaml
    Line: 2
    Position: 1

    –Reports–

    HTML3.2
    Tested OK

    PDF1.4
    Tested OK

    *Error or bug.
    **Single Object Items are rendered correctly. Bugs occured while processing lse353637.kp2. If KitCAD 2 supports the output target and KitCAD i3 in 227 mode; then no bug for KitCAD i3 is possible (also svg, vml, ahc, x3d, and wpfe is not supported by default).

  10. Admin Says:

    X3DV: Notes
    Tested with Xj3D Version: 2_M1_DEV_2009-05-18 error with multi DEF’s of same item
    Tested with freeWRL win32 rev0.0, Java console shows file:/// errors

  11. Admin Says:

    VML: Notes
    The update for using DOM?POST was not applied – still using URI#HASH to send data to KitCADi3ie5.exe

  12. Admin Says:

    Bug located within i3ie5.cpp TKitCADi3_MainForm::decodeGETPROCESSOR loop for each line.

    The return value of (decodeGET->Lines->Strings[ counter ]) is limited to 4096 characters for each line (TRichEdit 4096, TMemo 1024?). The correct value in some tests showed at least 10,000 characters is required for a single line. The 4096 limit applies for XP but may change for other operating systems/memory.

    The SendMessage workaround did not work as expected (still limited).

    Another method for reading lines will be used; based on RichEdit control SelText function to read text between /n and /n.

  13. Admin Says:

    Rebuilt using RichEdit control to gather lines, but saw massive timeout when reading data with lots of line returns.

    Another work-around instead fixed bugs by removing large lines without the need for the KitCADi3ie5.exe to be rebuilt.

    Work-around example:

    SVG Fix:
    Edit _i3_svg.htm and change the line of
    formdata = formdata + document.formp.data.value + "\r\n";
    to be like
    formdata = formdata + document.formp.data.value.replace(/\<g/gi,"\r\n<g") + "\r\n";

  14. Admin Says:

    A faster C++ line split can be achived using:-

    //4096 fix starts
    bool foreachline = true;
    do {
    decodeGET->SelStart = 0;
    decodeGET->SelLength = AnsiString(decodeGET->Lines->Text).AnsiPos("\r");
    try{ //this try block prevents exit errors found during debuging - caused by incorrect code for MSHTML ?!?
    decodeLINEPROCESSOR(theURI + '#' + Trim(decodeGET->SelText), "", true, this);
    }catch(...){}
    decodeGET->SelText = "";
    if(AnsiString(decodeGET->Lines->Text).AnsiPos("\r")>=1){foreachline = true;}else{foreachline = false;}
    }while(foreachline);

    The above method is still slow, and generates bugs in output code.

  15. Admin Says:

    Work-around example (continued from SVG Fix above)

    WPFE Fix:
    Edit _i3_wpfe.htm and change the line of
    formdata = formdata + document.formp.xamlwpfe.value + "\r\n";
    to be like
    formdata = formdata + document.formp.xamlwpfe.value.replace(/\<Canvas/gi,"\r\n<Canvas") + "\r\n";

  16. Admin Says:

    Continued from 4096 fix above.

    //4096 rev 2 fix starts
    bool foreachline = true;
    do { try{ decodeLINEPROCESSOR(theURI + '#' + Trim(AnsiString(decodeGET->Lines->Text).SubString( 0, AnsiString(decodeGET->Lines->Text).AnsiPos(AnsiString("\r")) + 1 ) ), "", this); }catch(...){}
    decodeGET->Lines->Text = AnsiString(decodeGET->Lines->Text).SubString( AnsiString(decodeGET->Lines->Text).AnsiPos(AnsiString("\r")) + 2, AnsiString(decodeGET->Lines->Text).Length() );
    if(AnsiString(decodeGET->Lines->Text).AnsiPos(AnsiString("\r")) == AnsiString(decodeGET->Lines->Text).AnsiPos(AnsiString("\r\n\t\r\n"))){foreachline = false;}else{foreachline = true;}
    }while(foreachline);

    The above method faster; Still generates bugs in output code and processes VRML output very slowly.

  17. Admin Says:

    Updated KitCADi3_file_localhost_test_w32_setup.exe; using work-around SVG/WPFE Fix examples above.

    The 4096 character limit and bugs will not be corrected until a later date if possible.

    No notice of update to KitCAD i3 TEST version will be shown (release date of latest update will be 22nd May 2010). Downloaded KitCAD i3 TEST versions after the 24th of May 2010 will include the work-around fixs.