Results 1 to 16 of 16

Thread: Interesting code formats and code snippets.

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Interesting code formats and code snippets.

    When searching for clipboard info, I saw the following snippets. I suddenly feel that this code format is very interesting, it is JavaScript and Json style. I think, if VB6 also has such a script interpreter, then VB6's power will be greatly enhanced.

    The following three functions are:

    wx.setClipboardData(OBJECT)
    wx.getClipboardData(OBJECT)
    wx.connectSocket(OBJECT)
    Attached Images Attached Images    
    Last edited by dreammanor; Apr 25th, 2017 at 08:44 PM.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Interesting code formats and code snippets.

    I'm not sure what you are after. If you want to write JavaScript then write JavaScript. There are a number of runtimes that wrap a JavaScript engine to make a sort of desktop application.

    Electron is one of those.

    Performance? Well, that's another matter. Even JITting script engines like the .Net runtime can be pokey and then you have that spit and sputter of garbage collection based object lifetime.

    Just be careful of that screen door on your way out, the spring is pretty strong.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Interesting code formats and code snippets.

    The above three code pieces are examples of the open APIs for China's WeChat mobile communication platform.

    Two months later, I will use VB6 to develop a IM software. So I'm collecting all the technical information about web development, mobile-phone development and communication development.

    I have been working on local database application development for many years, but I have no experience on Web/Mobile/Communication development. Using VB6 to develop IM and Web applications is a huge challenge for me, but I'm still going to try it.

    Finding the right solution is the most important thing, but now I don't have any clue.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Interesting code formats and code snippets.

    A desktop IM program isn't too hard, hosting the server somewhere useful (on the public Internet) is the tough part. VB6 doesn't really have much of a role anymore in web applications. We got things like WebClasses but they were quickly deprecated and are mostly unusable now. The idea was taken up and turned into ASP.Net.

    If you are really VB-centric and interested in other platforms you might consider the B4X products. These are several tools that all use a language syntax somewhere between VB and VB.Net in flavor.

  5. #5
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by dreammanor View Post
    Two months later, I will use VB6 to develop a IM software. So I'm collecting all the technical information about web development, mobile-phone development and communication development.

    I have been working on local database application development for many years, but I have no experience on Web/Mobile/Communication development. Using VB6 to develop IM and Web applications is a huge challenge for me, but I'm still going to try it.

    Finding the right solution is the most important thing, but now I don't have any clue.
    Who's the audience or the target for whom you are going to create an IM platform, what is your goal?
    Is it a hobby project or a commercial project?

    You can't use VB6 to create mobile (phone/tablet) applications. Won't work.
    Use VB6 to create the huge backend for handling/storing/retrieving, why would you??

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by dilettante View Post
    A desktop IM program isn't too hard, hosting the server somewhere useful (on the public Internet) is the tough part. VB6 doesn't really have much of a role anymore in web applications. We got things like WebClasses but they were quickly deprecated and are mostly unusable now. The idea was taken up and turned into ASP.Net.

    If you are really VB-centric and interested in other platforms you might consider the B4X products. These are several tools that all use a language syntax somewhere between VB and VB.Net in flavor.
    I haven't found an excellent IM software which is stable, practical, large concurrent and developed with VB6, so I have no good example that can be used to learn or reference. I know C# and ASP.NET are more suitable for web applications, but use VB6 to do web development is more challenging and interesting, I like this.

    I am paying attention to B4X this product, maybe in the future my mobile development need to use it.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by Arnoutdv View Post
    Who's the audience or the target for whom you are going to create an IM platform, what is your goal?
    My audience is enterprise user and I want to use the IM as a maintenance tool. At present it's a hobby project, but I hope it will become a professional software maintenance tool in the future.


    Quote Originally Posted by Arnoutdv View Post
    You can't use VB6 to create mobile (phone/tablet) applications. Won't work.
    I know it's not easy to implement, but maybe we could find a way or a compromise solution.

    Quote Originally Posted by Arnoutdv View Post
    Use VB6 to create the huge backend for handling/storing/retrieving, why would you??
    Because I love VB6.

  8. #8
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by dreammanor View Post
    I haven't found an excellent IM software which is stable, practical, large concurrent and developed with VB6, so I have no good example that can be used to learn or reference.
    Maybe the little example below will encurage and help you, to set up your own environment,
    which (in case you want to develop the serverside with VB6) has to be:
    - a "Classic ASP" Host-environment (which allows to run fast, natively compiled code from your own VB6-ActiveX-Dlls)
    - this would be ideally based on a Windows-Host, which runs the MS-Internet-Information-Server (IIS)
    - there's Internet-Providers, which offer such Windows-Hosts for about 10-15$ per month
    - in a first step you could develop it locally (against the IIS, which comes with each Windows-System)

    Quote Originally Posted by dreammanor View Post
    I know C# and ASP.NET are more suitable for web applications, but use VB6 to do web development is more challenging and interesting, I like this.
    That's not true at all (besides the "more interesting" part).
    VB6 can be used at the (Web-)Serverside with relative ease (even a "Remote-Debugging" of the
    Serverside is possible by re-delegation into the appropriate VB6-IDEs ActiveX-Dll-project) - and
    the performance is really good (when one is using COM-Dlls for the critical parts instead of VBScript).

    Also the JavaScript-example from your Opener-post is directly usable in VB6, when you load an appropriate engine for it...
    I've done this in the example below, which is:
    - demonstrating a simple "Web-ClipBoard"
    - the ClipBoard-content stored on vbRichClient.com (which is such an "ASP-Hosting" I've described above)
    - the clientside is using the RC5-lib for JSON and the Scripting-engine (and WinHttp-5.1 for the async Web-Requests)

    Here's what it currently looks like - at the moment it handles "Unicode-text" only
    (but could be easily enhanced, to handle the HTML-based ClipBoard-content - retrieved from Word for example).



    Here's the SourceCode for the Demo:
    http://vbRichClient.com/Downloads/JScriptCallbacks.zip

    Generally, an IM-Software (as long as you don't plan Video-Chats or Audio-Streaming in realtime), but restrict
    yourself to basically exchange only Text + HTML + Images + DocumentUploads, then it's really more
    on the simple side of things (compared with e.g. a full-grown CRM-software or something like that) -
    it needs only a very simple DataBase-structure (mostly to manage the Users) - plus a quite
    simple Front-End (for Desktops e.g. with VB6... and for everything else a Browser-Interface in a second step)
    also at the serverside you will only need a few dozen lines of code.

    So, I'd start (as said) with a local IIS, which runs on your Dev-Machine (later in a company-LAN) -
    and when you're satisfied with that, you could move it all to a Hoster, starting with a single machine
    (as I'm doing on vbRichClient.com). Later, in case the whole thing really grows - and you need to
    support more concurrent Users, then you usually also have the money "to expand" (your single-server-
    hosting to a scalable WebServer-cluster).

    IMO VB6 is one of the *better* languages for easy to develop high-performance-stuff on the serverside
    (compared with e.g. PHP or Python).

    HTH

    Olaf

  9. #9
    Addicted Member
    Join Date
    Jun 2002
    Location
    Finland
    Posts
    169

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by Schmidt View Post
    - there's Internet-Providers, which offer such Windows-Hosts for about 10-15$ per month
    Is this the cheapest?
    https://buyvm.net/kvm-dedicated-server-slices/
    https://buyvm.net/operating-systems/...indows-family/

  10. #10
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by pekko View Post
    Is this the cheapest? ... links to buyvm ...
    I don't know the provider you mentioned in your links - but the offers are certainly interesting.

    I'm using a "managed one" from 1and1 (one of the "big guns" in the business) -
    and am paying 12,50€ or something per month currently...
    That includes unlimited storage on an SSD-based SAN + unlimited traffic, + 3 domains for free,
    2GB-RAM guaranteed, and the whole thing is running on a "full-core" (of an Intel-XEON with 2.6GHz base-freq.).

    I'm certainly satisfied with it (have it for a few years now, no maintenance needed -
    and the downtimes were *very* few and short so far).

    Newcomers are often somewhat cheaper (they have to be ... though no clue how long "buyvm" is in the business),
    but with the larger "well-known" ones, you'll know that they are there also "next year"...<shrug>

    Olaf
    Last edited by Schmidt; Apr 27th, 2017 at 01:37 AM.

  11. #11

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Interesting code formats and code snippets.

    Olaf, the information you provided is really useful to me. I will study your example carefully and start my IM-Software development tour from there.

    You and Jpbro have increased my confidence in using VB6 to develop web applications, and even develop mobile applications.

    I know a little Visual C++ and a little C#, I also studied Java and Python for a short time. However, my favorite programming language is still VB6. So I want to use VB6 to complete most of the Web/Mobile development tasks. The IM-Software is the first hurdle I need to cross, and I believe that I will be able to complete it with the help of you and other experts in the vbForums . Thank you very much, Olaf.

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Interesting code formats and code snippets.

    I know this isn't what you want to hear but...

    VB6 has no role in mobile apps. None at all unless you count server-side services. Almost nobody uses VB6 from within Classic ASP script anymore. Yes it can be done. A few people still do it.

    Even though you can do some of those things the programming model is entirely unlike anything you are probably already used to in VB6. Most of its advantages disappear in server-side environments, making far more common alternatives more attractive.


    But go ahead. I suggest you set up IIS on your PC to begin experimenting. You don't need hosting for that.

    An IM client is a fairly trivial thing but useless until you have designed and developed a server to work with it. Nothing says you couldn't cobble a server together out of ASP pages calling VB6 DLLs though. Before you tackle that you might want to play with some web services to get the hang of how to write clients for them.

  13. #13

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Interesting code formats and code snippets.

    dilettante, your words are straightforward, but always very helpful, it can make me think more comprehensively. Trying to make VB6 play a role in mobile apps is the next thing to do, maybe we can first make VB6 play a bigger role in web development.

    Web services is also a question I often think about. If VB6 also has a framework similar to C# Web-API, then VB6 can play a greater role in web/mobile development . My knowledge of the Web-API is still very limited, so I can't talk too much.

    I don't know whether vbRichClient can provide a framework similar to C# Web-API.

  14. #14
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by dilettante View Post
    VB6 has no role in mobile apps.
    Whilst that is true, not each and every (IM-)scenario requires the Client to have access
    to "Device-Video or Device-Audio" (the cam or microphone on a tablet or phone).

    Everything else could be done with a Browser-based frontend (which any mobile device can run).

    So the OP will have to ask himself, whether he wants to support video- and audio-capturing in the long run
    (with VB6 this could be implemented only for the "large Office- and Windows-based IM-Client-App" -
    but not for mobile devices).

    If he wants to stick with "Document- and simple HTML-formatted-Message-exchange" though,
    then all platforms could be served from a (VB6-driven) Server-backend.

    Quote Originally Posted by dilettante View Post
    Almost nobody uses VB6 from within Classic ASP script anymore. Yes it can be done. A few people still do it.
    Well, for that matter - everyone was surprised about the WhatsApp-guys choice of server-language
    (Erlang being surely quite an exotic implementation-choice for a Web-Backend, its common usage far
    below *.asp-usage).

    If you look at the statistics at this page, then *.asp-development (although in decline) is still in 5th place:
    https://trends.builtwith.com/framework (the Grid there can be sorted by clicking the headers)
    55.8 Mio PHP
    45.4 Mio ASP.NET
    4.6 Mio Shockwave Flash Embed
    3.5 Mio J2EE
    2.5 Mio Classic ASP
    ...
    more often used than (to name a few well-known ones): Ruby on Rails, ASP.NET MVC, ASP.NET Ajax...

    As for VB6 in an *.asp (VBScript)-context...
    Everyone who's programming with *.asp is making use of many (System-provided) ActiveX-Dlls cogently
    (as e.g. ADO or the Scripting-Runtime or the XML- or Mailing-Objects) - and since the introducion of the
    ActCtx-COM-Object one can upload and run VB6-compiled ActiveX-Dlls also on the IIS-based Servers of
    the providers (and not only at your development-machine) in a regfree manner.


    Quote Originally Posted by dilettante View Post
    ... the programming model is entirely unlike anything you are probably already used to in VB6.
    Most of its advantages disappear in server-side environments, ...
    Not sure what you mean there - of course, serverside code is "non-visual-code" - but the concept
    of a "remote-function" is not all that different from normal function-implementations, especially not
    when you place the server-function inside a normal VB6-class (where you can roundtrip-debug it).

    Olaf
    Last edited by Schmidt; Apr 27th, 2017 at 02:41 PM.

  15. #15
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Interesting code formats and code snippets.

    Quote Originally Posted by dreammanor View Post
    Web services is also a question I often think about.
    If VB6 also has a framework similar to C# Web-API, then VB6 can play a greater role in web/mobile development .

    My knowledge of the Web-API is still very limited, so I can't talk too much.
    I don't know whether vbRichClient can provide a framework similar to C# Web-API.
    Nowadays modern WebApps are driven more and more at the client-side (in the Browser)
    (due to modern JavaScript-Frameworks)...

    So the serverside-code (which is what we're talking about, when one is mentioning
    C# in conjunction with ASP.NET, or VB6/VBScript in conjunction with ClassicASP)
    becomes more and more unimportant, its volume being significantly lower when a
    modern js-Framework is at work in the Browser.

    Modern WebApps function (for the most part) declarative, meaning you don't have to
    do any coding at all, especially when you run a DB at the server-side and can describe
    bound Data-Sources with SQL.

    The efforts when writing such an App are mostly bindings you have to specify (between GUI-controls
    in the Browser-DOM and typically JSON-based Models you got from Ajax-Requests on the serverside).

    As for the RC5... it is not a "Web-Framework" - but I use it on the serverside (with ClassicASP) -
    and its fast JSON, SQLite, Crypto, Hashing, FileSystem -Classes surely help a lot with reducing
    serverside code.

    I'm using the quite powerful and well-maintained (SAP-driven) OpenUI5-javascript-framework at work
    (and also privately) - and as said, nearly everything is declarative, when you look at the following definitions

    a static JSON-Model:
    Code:
    {
      "Req_Table1": {"SQL":"Select * From Orders"},
      "View_Init" :  "RPC('/Req_Table1', function(Res){UpdateGrid(Res, 'Table1', '/Res_Orders')}, 'DBQuery')"
    }
    ...and a JavaScript-based View-Definition:
    Code:
    new sap.m.VBox("VBox1", {items:[
    
        ,new sap.m.HBox("HBox1", {wrap:"Wrap", items:[
            ,new sap.ui.commons.TextArea("Text1", { width:"500px", value:"{/Req_Table1/SQL}" })
            ,new sap.ui.commons.TextView("Spc1",  { text:"\u00a0" })
            ,new sap.ui.commons.Button("Button1", { text:"Execute", tooltip:"Execute the current SQL",
                press:function(){ eval(M("/View_Init")) } 
            })
        ]})
        
        ,new sap.ui.table.Table("Table1", {
            selectionMode:     sap.ui.table.SelectionMode.Single,
            selectionBehavior: sap.ui.table.SelectionBehavior.Row
        })
     
    ]})
    Both generated by a self-developed Tool, written in VB6...

    The above is all that's needed, to makes up this little Web-DataGrid-Demo
    (a free queryable Nwind.db, served from serverside SQLite - the Grid is interactively editable and can be sorted and filtered):



    In case you want to play around with it, here's the Link to an online-Demo:
    https://vbRichClient.com/JSONQueryDemo.html

    For those who are interested, I could post the needed environment-settings in a more elaborate
    post in the CodeBank (describing also the unchanging, generic code-parts)...

    Olaf

  16. #16

    Thread Starter
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Interesting code formats and code snippets.

    Great, I am very interested in it, looking forward to seeing the needed environment-settings in a more elaborate in the CodeBank. Thanks very much.

    BTW, I'm pretty sure my IM-Software will stick with "Document- and simple HTML-formatted-Message-exchange".
    Last edited by dreammanor; Apr 28th, 2017 at 06:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width