Thread: Anyone using HTA or WinForms with "C", "not c++",

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    31

    Anyone using HTA or WinForms with "C", "not c++",

    Greets,
    Anyone using WinForms with "C", (not c++),
    using HTA with "C"?
    I would like to find some examples of such.
    Thanks...Vernon
    Win7x64, HotBasic, 'Beginning C programming', 'Arduino Uno R3'.
    "All things in moderation, except for love and forgiveness"... www.vmars316.com

  2. #2
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    I don't know what HTA is in this context. HTML Application - Wikipedia, the free encyclopedia ? I don't know anything about it, but doesn't sound like something you can use with C or C++...

    It's not possible to make a C-only Windows Forms project - the forms are programmed in C++/CLI C++/CLI - Wikipedia, the free encyclopedia

    What's your reason for wanting to avoid C++?

    Don't assume that a C library will be easier to understand. I don't have personal experience with C GUI libraries, but I reckon they'll be hard work the same ways as C++: You'll have representations of various bits and pieces, e.g. a button, with an API to do various buttony things. Figuring out what to call, how, where, when... isn't going to be any easier in C.

    Whether you choose a C or a C++ library, I wouldn't recommend starting with Windows Forms. It's easy to get started with the nice drag and drop design view, but when it comes to coding you'll end up learning to write Microsoft-specific managed C++ (which is a very unportable skill).

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    31
    Thanks
    Reason for no C++: too verbose.
    HTA: Extreme Makeover: Wrap Your Scripts Up in a GUI Interface
    ...vm
    Win7x64, HotBasic, 'Beginning C programming', 'Arduino Uno R3'.
    "All things in moderation, except for love and forgiveness"... www.vmars316.com

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    Quote Originally Posted by vmars316 View Post
    Reason for no C++: too verbose.
    What do you mean by "too verbose"? Do you mean you have to write too much code to get something simple done? I don't think that's the case, at least not if you're comparing it to C.
    I don't think there's anything you can do in C that would be "verbose" in C++.

    Windows Form's autogenerated output is overly verbose I guess. There's no need to keep specifying "this->", or to repeat the access specifier in front of every function. But I think that's so the GUI can pick up code changes in its property boxes.

    There are plenty of good reasons not to use C++, but I'm not convinced about "too verbose".

    Hmm. You mean use a HTML App to drive a C program?
    HTA looks like it's meant to work with scripting languages that can be interpreted and executed by IE alongside the HTML. C isn't an interpreted Microsoft browser script, so obviously you won't be able to drop C code into the <script> bit.

    You could compile a C program and start it from VBScript in an HTA, then use the stdin and stdout to communicate
    Code:
    Set shell = CreateObject("WScript.Shell")
    Set app = shell.exec ("yourprogram.exe")
    
    // read a character from C prog
    app.StdOut.Read(1)
    
    //write a string to C prog
    app.StdIn.Write(string)
    I had a play with this idea and wrote a little C program to update a HTA status bar to different values, and put some data from text boxes into a data structure in C. It was fun, but I think it's a really bad idea. There were some horrible timing issues -- often both the C and script would block waiting for input. There's no non-blocking WshShell read, so if the script expects data and doesn't get it, it'll just hang.
    This guy suggests writing out to files and reading back in to avoid the timing issues. WshShell.Exec Considered Harmful Due To Blocking Programming News from Bozeman, MT | Digital Engine Software Blog

    This was fun to play with, but I'm pretty much 100% sure that HTA+C is not a quick and easy way to a C GUI -- certainly not in the way I tried with the 2 programs running concurrently. If the majority of the code was in the GUI, and some buttons/actions started a C program then collected the results when it'd finished, it'd probably be fine. It's not really a GUI for the C program then though, if you can't interact with it while it's running.

    So yeah, it's possible, but painful. It wasn't designed for this, so when problems arise you don't have the right tools to fix them.

    Use a library. Isn't GTK C?

  5. #5
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by smokeyangel View Post
    Use a library. Isn't GTK C?
    Yes it is...and it is where the definition of verbosity lies.

  6. #6
    Registered User
    Join Date
    Jan 2010
    Posts
    31
    Hmm...
    Ok, maybe i should take a look at C++ or C#.
    What are the meaningful differences between C++ or C# ?
    I have heard that c++ has less visual controls than c#.
    Thanks...Vernon
    Win7x64, HotBasic, 'Beginning C programming', 'Arduino Uno R3'.
    "All things in moderation, except for love and forgiveness"... www.vmars316.com

  7. #7
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    Heh, there are quite a lot of differences. Google it, lots of points of view all over the net. I don't really know C# well so I don't know.

    C++ is older and well established so will have more good, stable library options.

    C# is a Microsoft invention, and while it seems to be gaining some support, it's still relatively new.

    Visual C++/CLI seems to be generally reckoned to be pretty horrible and hard to work with compared to C#. In general I think C# is meant to be easier to learn than C++. Hence, going from C++ to C# is easier than the other way round.

    I'd say C++ would be the better but maybe harder choice. You just need to do some research on the differences and decide, based on your priorities - trying to learn to program, or just trying to get a program working.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 46
    Last Post: 08-24-2007, 04:52 PM
  2. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  3. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM