Results 1 to 24 of 24

Thread: I recently saw a topic comparing VB to C++....

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    norcross, ga, USA
    Posts
    82

    Post

    It was stated that VB can 'almost anything that C.. can do. If this is the case then my question is this:

    1. Can I talk through the serial port to a non-telecom device, i.e. Homemade remote..?

    Basically send a 5+ volt pulse to some sort of J/K and turn on a light for example.

    2. How can I determine which pin I am sending data on and can I control this?

    3. What type of data can I send?

    4. And lastly, can all of this be done through a parallel port? Mainly, desirable because of it's bidirectional capabilities.

    Any information would be greatly appreciated!

    <c>

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670

    Post

    Any programming language worth it's salt can access API calls - and I think it's these you will need to use to talk directly to the parallel port in this way. Search the net for API websites or get a book from the library - or, if you know which API calls you need then run the API TEXT VIEWER applet provided with VB to copy and paste the API call definitions into your project.



    ------------------
    Mark "Buzby" Beeton
    VB Developer
    [email protected]



  3. #3
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923

    Post

    C++ is much faster than C++. Wow! Where can I get this *new* version of C++??

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    C++ is faster then C++! BUT!!! is C++ faster then VB?!

    ------------------
    DiGiTaIErRoR
    VB, QBasic, Iptscrae, HTML
    Quote: There are no stupid questions, just stupid people.

  5. #5
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219

    Post

    yes c++ is way faster then vb i know i program with both of them sometimes it alldepends on what i am doing

  6. #6
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    Hi, cvaden.

    Nobody mention de parallel port question.
    Try Inpout32.dll. It can be found (among many other places) in:
    http://www.lvr.com/parport.htm

    Also check Jan Axelson's page on parallel port tutorials.



    ------------------
    I wish I was patient... RIGHT NOW!

  7. #7
    Lively Member FirstKnight's Avatar
    Join Date
    Jul 1999
    Location
    Johannesburg, South Africa
    Posts
    95

    Post

    Hm...I could tell you all about the Win32 API and how to use it, but then someone at VB-World would be without a job. So I'll just tell you the easy way. I had a similar project, in wich I wanted to open a electronic gate after a user was verified. So I asked a friend of mine, to design a simple device that works with a relay switch which is activated through a EPROM. What basicly happend is that the device plugs into a COM Port and all I had to do to open the gate, was send the character "a" to the COM port.

    Maybe you know someone that could build you something like that, coz it makes things a lot easier.


    ------------------
    Hennie Pieterse
    Senior Programmer
    Datcor International
    [email protected]
    Telephone: +27 15 7816335
    ICQ Number : 61636095
    Today is yesterday's tomorrow

  8. #8
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Messed up on what? That C++ is way faster than C++ or thinking that it's way faster than VB?

  9. #9
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    355

    Post

    lol, i used to think VB was written in VB

  10. #10
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    Post

    Don't know about the serial port, but as for the parellel, for electronics purposes, check out www.aaroncake.net He has a bit of info on programming the parallel port for electronics applications in both VB and QB.

    ------------------
    Micah Carrick
    http://micah.carrick.com
    [email protected]
    ICQ: 53480225


  11. #11
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Post

    That is interesting, does anyone know exactly how much faster C++ is?

    Steve

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    norcross, ga, USA
    Posts
    82

    Post

    I just wanted to thank the few people that actually addressed my question...it has helped a lot!

    Also, I wanted to say to people who have been discussing the nonsense....I didn't know I could learn something from nothing!

    I never stopped to think what language the VB app itself was written in. Even in nonsense, wonders never cease!

    <c>

  13. #13
    New Member
    Join Date
    Jan 2000
    Posts
    6

    Post

    Ohh...look at that flaming icon!!! Chunktastic brothers and sisters!

    Sorry, needed to be said. And now you can disable Smilies if you need to. Fantastic! I'm in super chunky VB HEAVEN!

    ------------------
    Regards,
    The Chunkster

    I appologise for my extrovert behaviour

    Remember, Mr Chunky is funky!



  14. #14

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    norcross, ga, USA
    Posts
    82

    Post

    Why is my Icon on Fire?

  15. #15
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170

    Post

    I do Hardware I/O, Serial, and Parallel projects all the time using VB. First of all, Hardware I/O CANNOT be accomplished using the tools shipped with VB. However, you can get a simple io library from www.lvr.com/parport.htm.

    VB has built in Serial comm functionality through the MSComm control. It even handles hardware handshaking signals and of course you can use it to manipulate ANY hardware connected to the PC's Com port.

    VB has NO built in parallel functions, although when you think about it, a parallel is nothing more than an address right? So again, grab you a IO library from Jan's page above and use the address of your parallel (378H or whatever)

    VB has the ability to do USB communications through the API. In the future, USB will be pretty common for hardware interfacing.

    VB is slower than C++, but C is faster than C++, but Assembly is faster than C. Depends on how time critical your hardware is as to what language you use. Today, with 800Mhz computers, I haven't found a single project of mine that needed anything faster than VB.

    Take it easy

    ------------------
    HTH,
    Philip
    [email protected]

  16. #16
    Guest

    Post

    I am in TOTAL agreement with PhilipG. I couldn't have said it better myself.. hehe..

    Assembler is where it all started Bay-Bee...

    Knight Vision

  17. #17
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    Phillip, that was the URL I gave before...!

    As for speed, I think an Indy car is faster than a family van, and a Dragster is still faster than an Indy, but which one would you choose to go midtown?

    Speed in programming is sometimes not determined but the language itself but the way in which you design your app, and besides that, speed is totally useless in certain kind of programs. Most of the time the processor is waiting for the user to select an option or input a text, and the processing times is totally out of question.



  18. #18
    Registered User
    Join Date
    Apr 1999
    Location
    Brazil
    Posts
    144

    Post

    why C++ is faster then VB ?

    Internal code of C++

    Public Function RTrim(c)
    ....
    commands...
    ....
    End Function

    Internal code in VB:

    Public Function RTrim(c)

    MSDalay()
    ....
    MSDalay()
    commands...
    MSDalay()
    ....
    MSDalay()

    End Function

    Jefferson

  19. #19
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    I can give an example of comparison between VB and C++. This example is simply to test loops in VB and C++.

    I wrote a For...Next loop in VB from 1 to 1000000 (million). I set the timer and BOOM....it took 52 Milliseconds.
    Then I did the same thing in C++.....BOOM.....it took 10 milliseconds.

    Then for testing purposes, I inserted If condition inside of that loop, so it looked something like this:

    Code:
    Dim i As Long
    
    For i = 1 To 1000000
       If i =50 Then
          'I didn't put any code inside of the IF
       End If 
    Next
    As you can see I didn't put anything inside of the If condition.....and....BOOM...it took 513 milliseconds (10 times more).
    i did the same thing in C++ so it look something like this:

    Code:
    void CMyDlg::OnButton() 
    {
    	int start;
    	int finish;
    	int i;
    
    
    	start = GetTickCount();
    	for (i=0; i<100000; i++)
    	{
    		if (i/10 == 1)
    		{
    		}
    	}
    
    	finish = GetTickCount();
    	finish = finish - start;
    	char str[15];
    
    	_itoa(finish, str, 10);
    	MessageBox(str);
    }
    Whoa.....it took only 13 milliseconds.

    So, you can see that difference as simple as loops is dramatic.

    Just my $0.02


    P.S I tested it on PII-400 128MB RAM.

    ------------------

    Serge

    Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819



    [This message has been edited by Serge (edited 01-30-2000).]

  20. #20
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170

    Post

    One note,

    The original post was about hardware\software differences between VB and VC++.

    When your hardware demands that a signal be there exactly 50ms from a byte of data being sent...this is a very different situation. Even C++ can't guarentee that.

    From my experience, I recommend you use the highest level language you can get away with. When working your way up the chain, file size increases and speed decreases, but programming is simplified.

    It's kinda the programmers decision as to which tool is the best for the situation. In my experience, hardware interfaced to a typical x86 can typically be handled through VB just fine. C++ is good stuff for hardware and byte manipulation. C and Asm are VERY cumbersome for writting Windows Apps, but if your app is a dos program, I highly recommend C.

    Sorry for yet another post to this flaming thread, but I just felt the thread was heading down the wrong direction...Although we could start another post about C++\VB Speed differences.

    Phil

  21. #21
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    Post

    Well said phillip. Speaking of assembly ... I'm an electronics student, know where i can find some good assembly resources?

    ------------------
    Micah Carrick
    http://micah.carrick.com
    [email protected]
    ICQ: 53480225


  22. #22
    New Member
    Join Date
    Oct 1999
    Posts
    3

    Post

    I have proof straight from the top that C is the slower of the languages:

    Code:
    /*
         TOP SECRET Microsoft(c)  Code
         Project: Chicago(tm)
         Projected release-date: MAY 1998
        $History$
     */
    
     #include "win31.h"
     #include "win95.h"
     #include "evenmore.h"
     #include "oldstuff.h"
     #include "billrulz.h"
     #define INSTALL = HARD
    
     char make_prog_look_big[1600000];
    
     void main()
     {
         while(!CRASHED)
         {
             display_copyright_message();
             display_bill_rules_message();
             do_nothing_loop();
             if (first_time_installation)
             {
                 make_50_megabyte_swapfile();
                 do_nothing_loop();
                 totally_screw_up_HPFS_file_system();
    
                 search_and_destroy_the_rest_of_OS/2();
                 hang_system();
             }
             write_something(anything);
             display_copyright_message();
             do_nothing_loop();
             do_some_stuff();
             if (still_not_crashed)
             {
                 display_copyright_message();
                 do_nothing_loop();
                 basically_run_windows_3.1();
                 do_nothing_loop();
                 do_nothing_loop();
             }
         }
    
         if (detect_cache())
             disable_cache();
    
         if (fast_cpu())
         {
             set_wait_states(lots);
             set_mouse(speed, very_slow);
             set_mouse(action, jumpy);
             set_mouse(reaction, sometimes);
         }
    
         /* printf("Welcome to Windows 3.11"); */
         /* printf("Welcome to Windows 95"); */
         printf("Welcome to Windows 98");
         if (system_ok())
              crash(to_dos_prompt);
         else
             system_memory = open("a:\swp0001.swp" O_CREATE);
    
         while(something)
         {
             sleep(5);
             get_user_input();
             sleep(5);
             act_on_user_input();
             sleep(5);
         }
         create_general_protection_fault();
     }
    Like that? Hehehehehe.

    Tyler C

  23. #23
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Why is the folder on this post flaming???

    ------------------
    Ryan

  24. #24
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Because the topic has more then 15 replies. See the explanations on the buttom of the root thread.

    ------------------

    Serge

    Programmer Analyst
    [email protected]
    [email protected]
    ICQ#: 51055819


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