Simple Question about sciter

Sciter Forums Native Simple Question about sciter

This topic contains 7 replies, has 3 voices, and was last updated by  midi 4 months, 3 weeks ago.

  • Author
    Posts
  • #49184

    Something else
    Participant

    Hello
    1/ i am new at c++ but i already know the basics of winapi … do you recommend me to use sciter in my c++ app ?
    2/ if the answer is yes then can you give me a good and simple start … like the one in Awesomium ()
    if no then what GUI library should i use ? (please don’t answer VCL)
    thank you for your time

  • #49185

    Andrew
    Keymaster

    And what do you know beside of C++? If you are comfortable with Web front end stack then Sciter is definitely for you.

    What is your development platform? Windows, Mac OS or Linux? I need to know to provide steps needed.

    • #49188

      Something else
      Participant

      some knowledge in html and css
      Windows , i am not interesting on making my app Cross-platform

  • #49195

    Andrew
    Keymaster

    Steps for Microsoft Visual Studio 2015 (Community Edition will work).

    1. Download sdk in some folder, let it be C:\projects\sciter-sdk

    2. In VS: New Project -> (Templates/Visual C++) -> Win32 -> Win32 Project:

    Step 0

    In the same wizard choose project model:

    Step 1

    Click OK to close the wizard. Project will be created. Verify that you have this folder structure:

    c:\projects\
       sciter-sdk\
       HelloWorld\

    Right Click on project in VS, select Properties and change “Additional Include Directories” to $(SolutionDir);$(SolutionDir)..\sciter-sdk\include :

    Step2

    In the same properties dialog change output dir to $(SolutionDir)bin\

    Step 3

    Let Visual Studio know that your project is High-DPI aware:

    High-DPI awareness

    3. Add to the project file sciter-sdk/include/sciter-win-main.cpp (Project -> Add Existing Item …)

    4. Replace content of HelloWorld.cpp file (generated by VS) by this:

    // HelloWorld.cpp : Defines the entry point for the application.
    //
    
    #include "stdafx.h"
    #include "HelloWorld.h"
    
    #include "sciter-x-window.hpp"
    
    class frame : public sciter::window {
    public:
      frame() : window(SW_TITLEBAR | SW_RESIZEABLE | SW_CONTROLS | SW_MAIN | SW_ENABLE_DEBUG) {}
    };
    
    #include "resources.cpp"
    
    int uimain(std::function<int()> run) {
    
      //sciter::debug_output_console console; - uncomment it if you will need console window
    
      sciter::archive::instance().open(aux::elements_of(resources)); // bind resources[] (defined in "resources.cpp") with the archive
    
      frame *pwin = new frame();
    
      // note: this:://app URL is dedicated to the sciter::archive content associated with the application
      pwin->load(WSTR("this://app/main.htm"));
    
      pwin->expand();
    
      return run();
    
    }

    5. Create /res/ sub-folder. There you will put your HTML/CSS/images/scripts.
    For now put there single file res/main.htm having this content:

    <html>
        <head>
            <title>Test</title>
            <style></style>
            <script type="text/tiscript"></script>
        </head>
        <body>
    
          Hello World!
    
        </body>
    </html>

    6. In the root folder of your project create file named pack-resources.bat with this content:

    ..\sciter-sdk\bin\packfolder.exe res resources.cpp -v "resources"

    And run it. It shall create file resources.cpp in the same folder. That is compressed binary blob containing your resources from /res/ folder. Note: you need to run that .bat file each time you change something in your /res/ folder. You can add pack-resources.bat invocation as a project compilation step in VS.

    Now you can compile your project (CTRL+SHIFT+B) in Visual Studio.

    Output file (HelloWorld.exe) will be in /bin/ folder.

    Copy in that folder one of sciter.dll from SDK/bin folder that matches your compilation model (32 or 64 bits).
    And run HelloWorld.exe. You should see this:

    final

    Let me know if anything above will not go through

    • This reply was modified 4 months, 3 weeks ago by  Andrew.
  • #49198

    Something else
    Participant

    everything work fine
    thank you

  • #49200

    Andrew
    Keymaster

    Open sciter-sdk/include/sciter-win-main.cpp and add this include:

    #include "stdafx.h"
    
    #include <vector>
    
    #include "sciter-x-window.hpp"
    
    #define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
    // Windows Header Files:
    #include <windows.h>
    #include <shellapi.h>                   // <<<<<<<<<<<<<<<<<<<
    
    HINSTANCE ghInstance = 0;
  • #49202

    Andrew
    Keymaster
  • #49215

    midi
    Participant

    You can skip all this setup by downloading the C++ package from http://misoftware.rs/Bootstrap/Download
    Just build and run it, and you instantly get this:

You must be logged in to reply to this topic.