backnowbot

Wxwidgets Serial Port Programming Vb6

Hello there people, I always had a crush for programming. I've wrote some programs in C, because I had a course in C language, but always in 'console mode' and this was one factor that led me to quit programming. Now that I've been learning in my class, Data Structures and Algorithms with C, I gained again the interest in programming. I know that they still remain using the console mode, but I think that this is a new opportunity to restart. Apart from this detail, what I'd like to learn is something more related to GUI. I don't know how this works, so I hope that you guys could help me out.

My interest are on building some applications that could be useful, like calendars, photo database, mp3 players, and etc, all beginner stuffs. And other interest is on building applications that could communicate with RS232, IrDA, Parallel port, USB, etc. For example, communicating to a printe via USB, communicating with a equipment through RS232 like a multimeter, and so on. For example, the multimeter - Fluke has a software that uses their own language, where we can write down a code that can communicate with their multimeter, and who says their multimeter, can be with others, I think. It is possible to do all this with C?

Does the C has a GUI interface, like java? I hope that you can help me out here guys. Best regards, Charles. Although there is no built-in library to do this in C, there are a lot of API's to pick from to do the work for you. My personal recommendation would be Qt, which I am, in fact, learning myself (be it with very long gaps of time between it). Qt is good for doing multi-platform GUI development and usage, meaning that your code will work on Windows, Linux and Mac OS (be sure to compile per OS to get the desired program, but there is no change in source code). As far as I know it works for all major platforms, has some nifty features and seems to be pretty fast.

If you are developing for Windows specifically, try using Visual C. It should be packed with the appropriate 'templates' to build your program (Windows Form) from. Qt and Windows Forms are a lot like each other, though, Qt might seem a bit more of a problem (especially to install).

Thank you all guys. Framework, the site that you gave me is reliable? I'm using the MS Visual Studio 2005. In that website, the content is like too advanced, no? All that code is really needed to know for building an application? And theForger's, the same goes with the website that you sugested (Win32 API), but more friendly, but with the same hard code.

Allow me to ask you something. Can you give some examples of applications that are built with this Win32 API stuff? By the way, the code that is your website theForge, is in C. It can be used in C applications? Well, C is no an Object Oriented Programming, so, it still a good why to then learn more about C? I mean, because I'm learning Data Structures and Algorithms in C (I know, there is some code in C), learning this stuff isn't a waste of time, or is the same thing?

Well, I'm basically a newbie on the topic, but since I stand where you stand, I will tell you why I went with Qt. If you want GUI, you should first ask yourself, do you want it to be cross-platform or OS specific. If you want OS specific GUI, and the OS is Windows, then MS technologies are ok. However, learning a GUI api is not fun, especially when proprietary vendors tend to change their interface over night. I used to study Win32, which was very uncomfortable API, and then for some time COM for certain purposes, and finally MS invented.Net. So, if you don't want to learn OS specific stuff, which will evolve under your feet, then you need some kind of mediator - a cross-platform mediator. I'm not saying that learning the ever changing MS technologies is a bad thing, but for personal development I wouldn't recommend it.Net is not cross-platform in practice, although as I said, it is very productive.

Then you are left with either using something like Java, or C frameworks, or Python, etc. For Python, I can not help you much, except to tell you that it looks like a (relatively) clean language, but unfortunately produces slow programs.

10x slower at times compared to C/C. If your program is not processing intensive you can consider it.

You should probably learn it anyways, since it is very pervasive. I've been planning on taking this step for some time. Java is as cross-platform as they get. It is also as fast as a managed language gets and garbage collection is really nice for GUI development, since manual memory management is simply not justified for such trivia. The language is fast all right, but the memory consumption is much higher and the GUI is very slow.

Also, it doesn't look native. I believe there are changes happening with Java as we speak, but the memory consumption will remain a problem. I have used Eclipse for a while in the past, which is written in Java, also a version control system written in Java, and a mail client written in Java.

It simply suffocated the hardware that my employer provided, and although not top of the line, it was a decent box. What I am saying is, Java is a bit of resource hog and has a somewhat flickering GUI.

So, there are different C frameworks, wxWidgets, Qt, GTK+, etc. Almost all support comparable features. I know that both Qt and wxWidgets use the platform look-and-feel, which was one of my criteria. But Qt IMHO is simply more evolved as a framework.

It has a very convenient programming model. It can actually improve the quality of your coding practice. The only downside I see is that it uses a meta-compiler in front of your C compiler and this is not entirely desirable in some situations. Qt supports stuff like networking, databases, etc, but wxWidgets also extends beyound GUI. There are not many books for Qt, but the ones available from bookstores are of above average quality. And there is a nice official IDE available, although some people might say that's a downside. Now, no matter what you choose, GUI is always sluggish and resource hog these days, so Java is something to consider.

But C is a low-level language, which gives you a lot of possibilities to develop hardware specific stuff without using Java Native Interface to connect between C and Java. The lack of garbage collection and debugging features is pain in my opinion. For the serial port.

Qt does not offer anything out of the box, but you can use any library you choose. There seem to be few cross-platform (if you go that way), but I found those: Please, make note that I am studying Qt as we speak, so my information may be premature. Also, my comparison is based on info from the web and browsing example code of various frameworks and platforms and using applications written with those. Then you are left with either using something like Java, or C frameworks, or Python, etc. For Python, I can not help you much, except to tell you that it looks like a (relatively) clean language, but unfortunately produces slow programs. 10x slower at times compared to C/C. If your program is not processing intensive you can consider it.

You should probably learn it anyways, since it is very pervasive. I've been planning on taking this step for some time.

When we do comparison, we try to compare orange to orange if possible. Python being interpreted like Perl perform not as well as compiled languages like C/C is understandable. But we cannot deny the abundant built-in operators and data-type Python provides is a time-saver. To do a fair comparison, I would think Perl vs Python vs Ruby. For C/C, hmmmm. Compare with who?

Java, Pascal, Ada, Others?:P. Sohguanh wrote: When we do comparison, we try to compare orange to orange if possible. Python being interpreted like Perl perform not as well as compiled languages like C/C is understandable. But we cannot deny the abundant built-in operators and data-type Python provides is a time-saver. This was not supposed to be a detrimental comparison. It did sound a bit unjust to Python.

I didn't want to compare languages at all, but I had to summarize briefly on the topic. And the topic was, what options for constructing GUI are there. Interpreted languages are good for anything as long as it is less processing intensive. And I can not help in this case.

It is not my area of interest. However, learning interpreted languages facilitates the development process if you want to prototype a solution fast, or create a tool, or a code generator.

So everyone should know some. Pity I don't. Thank you all guys. Well, my idea is to build a simple application that read some data from a multimeter, like, for example Volts. What I'm thinking is something like a form, with a blank space, where the 'volts' will be displayed, accordingly to the multimeter readings. I don't know if I'm explaining myself well, or maybe I'm not quiet well 'inside' the subjetc to make myself clear.

The fluke 45 has a RS232 port, which, in matter of fact, communicates with the Fluke software named Metcal. Well, when you guys and other, says that want to make an app to communicate with RS232, I think that, that app that they/you want, will do something that you already know. I mean, you type something in the hyper terminal or something else, whatever, but that you already know. Now, I don't know if trying to get the reading from the multimeter, through the RS232 to the app that I want to build, have the same 'story' like those who want to build their app to communicate with the RS232. Do you understand what I'm trying to tell? For example, this is the user guide/manual of the Fluke 45: From page 60/122 to 92/122 you can see the 'theory' about programming the multimeter There is some Computer Interface Command Set, and register that are explained there. Attention that exists two types of commands, EEE-488 and RS232.

Port

In page 89, you can look to a code in BASIC A (I don't even know what's that, never heard about) that has an example of that 'communication' to the multimeter. Has you can see, there some commands, that belongs to the RS232 category, that are used to do some interaction with the multimeter. Now, my doubts are, how can I write an app similar to that BASIC A code, that make the thing that I mentioned above? Did I made myself clear? Sorry about my english. Best regards. Hi based on my working experience about 10 years ago, I wrote a Visual Basic app that is supposed to interface to a RS232 port which is connected to GPS and compass.

Step 1 Visual Basic provide a Comms control so it is very easy for your application to 'talk' to the RS232 port which will be pumping out data sent in from the GPS and compass. I use the HyperTerminal app to see those data. At this step, you need to find an equivalent API to do that. That is, find some API that allow your app to 'talk' to the RS232. Step 2 Assume your app can now 'talk' as in read from RS232 you need to have the hardware manual. The GPS and compass all uses text-oriented data format to make my life easier.

The content of the data is of course different since the GPS and compass are manufactured by different manufacturers. E.g A,123,456 //manual will say first field represent what, second field represent what etc etc Step 3 You then interpret those data based on what the hardware manual says. Then you write your own company specific business requirement from there onwards.

My business requirement during that time did not request for me to write to the GPS and compass but I presume the method would be similar. That is, send data TO the RS232 and the data must conform to what the hardware manual say. Possibly a RESEND, RESET etc etc commands to the hardware. Please note some hardware data format is binary instead of text so using HyperTerminal you see lot's of hexa-decimal numbers which is very reader un-friendly. Most of the time you will spent some time to build some small utility to convert those hexa-decimal numbers to human-readable string so it is easier for you to do debugging during development. I don't see much problem with creating the program if you know the tools.

I am just not the man to guide you through it, because I am exploring the options myself. With Qt, it would be very (and I mean very) easy to create a dialog box with a text edit control for logging the communication and some other control for the multimeter readings.

I think you will have to start another thread (Qt supports platform-independent threads) to perform the initialization. Then, you can subscribe to a timer and request a reading every xx ms from the device.

Altogether, only the threading aspect is more sophisticated, and beyond my capabilities at the moment, but it is certainly doable. Your multimeter seems to use console like interaction through the serial port, and that should be (in theory) no issue with the libraries I dug from the web. I understand your tentativeness. You want to do it in the proper, established, most productive way.

But, if you have some time on your hands, why don't throw yourself in.:) Regards.

Wxwidgets Serial Port Programming Vb6

We can easily program the parallel port in DOS. But as we know, DOS programs have their own limitations. So, if you want to move from DOS to Windows, go through this article.

This is an introduction to program the parallel port in VC. You need not have much knowledge about VC. This article is designed for one who know basics of parallel port and beginners of VC. If you don't know anything about parallel port, read my first article '.

There you get basic information about parallel port and programming the port in Turbo C or Borland C. Now, you are knowing the pins and registers of parallel port. You know how to access them in DOS. If you want to run your program in Windows 95 or 98, you are having access to the port in the similar way. You need to know how to use dialog boxes and windows materials with it.

But your program should also run in Windows XP, NT or higher versions, then there is another issue. Higher versions of Windows do not allow to access the hardware directly for security reasons. But still, there are ways, I will explain later. First we will start programming which will work only in lover versions of Windows. Direct Access: If you want to program the port in VB, there is no direct access to the port.

Still you can access the port using DLL files created with VC. You can use the next method. If you are familiar with Visual C, then create a dialog based application named ParallelPort and skip this section, go to.

Creating the application:. Start Visual C, Select File- New. In the tab 'Projects', Select 'MFC AppWizard (exe)', give project name as 'ParallelPort' and click OK. In the next window, select radio button ' Dialog based' and click next leaving all other options default. Click Finish, then OK to get a window with two buttons and one sentence 'TODO: Place Dialog controls here.'

, select and delete that sentence. Click to select the button 'Cancel' and delete it. Right click on button labeled OK, select Properties from the drop down menu. Change the value of Caption to '&EXIT' from 'OK'. Resize the dialog box to get a window as shown below.

If you run the application by clicking this icon:, it should give 0 errors and 0 warnings, and you will get the following window. Figure(2.1) Adding controls: Now, you should see a tool bar as shown here, it is called Control toolbar.

If not, select it from view menu-toolbars. Icon marked here with red color is the Check Box.

If you click the check box icon and draw in the window, You will have the check box placed in the window. You need to place 17 such check boxes in the window. You can use copy-past to make your work easy. After that, Group then using 3 group boxes. Group box icon is there above the check box in the figure. After doing this much, your design should look like figure(2.3).

So, re arrange your dialog components to look like that. Again run the application and make sure that there is no error. Figure(2.2) Figure(2.3) Next, right click on the Group Box labeled Static and go to properties. Change the captions to Data, Status and Control respectively.

Wxwidgets Serial Port Programming Vb6

Right click on the first Check box Check 1, Change the caption to 'Pin 2' and ID to IDCPin2. Similarly change the captions of check boxes in data group to Pin 2 to Pin 9; status port Pin 10, Pin 11, Pin 12, Pin 13 and Pin 15; Control Port Pin 1, Pin 14, Pin 16 and Pin 17. Change the ID's correspondingly(IDCPin2, IDCPin3.). Window designing is over. Next part is coding. We have placed some controls in the dialog box. To get the values of these controls, we need to have variables associated with then.

To do that, right click and select 'ClassWizard' from drop down menu. Select tab 'Member Variables'. You will get a list of Control IDs. Select each IDs separately and click Add Variable. Type variable name as mpin1. Mpin10, mpin11. And retain Category Value and Variable type BOOL.

Refer following figure. Figure(2.4) In the Workspace, Select ClassView tab, under ParallelPort classes, right click on CParallelPortDlg, click Add Member Function.

Give function type as void and function name as UpdatePins. It will take you to the new function created. Edit the code as follows. #define DATA 0x378 #define STATUS 0x379 #define CONTROL 0x37a The function CParallelPortDlg::UpdatePins is used to display values of all pins initially. Here, we have used inp function to get the values of registers associated with the ports. inp(PORT) will return the data present in PORT.

Depending on the status of the pins, we are making Check boxes checked or unchecked. When we change the value of member variable and call the function UpdateData(FALSE), the values in the member variables will be updated in the corresponding controls in the window. Similarly if you call UpdateData(TRUE), Values which are there in the corresponding controls will sit in the member variables. Here, The values from the variables should be updated in the window. So, UpdateWindow(FALSE).

If you have read my first article, you will understand all other things done here. To make run this code when the dialog is initialized, we need to call it. So, go to function OnInitdialog in the file CParallelPortDlg. (In the class view tab of the workspace, under ParallelPort Classes, expand CParallelPortDlg, you will get the function name, double click it.) Add the following code to it. This code will call the function UpdatePins and set a timer to scan the port pins.

Wxwidgets Serial Port Programming Vb6 Download

You can change the second parameter to change the frequency at which ports are needed to be scanned. I have used 200 milli seconds.

outp(CONTROL, 0xDF) will reset the control register bit 5 low so that data pins will act as output. outp(PORT, DATA) sends the byte DATA to the address PORT. Short stdcall Inp32(short portaddr); void stdcall Out32(short portaddr, short datum);. Where ever inp comes, change them to Inp32 and where ever outp comes, change them to Out32. Copy DLL file inpout32.dll and lib file inpout32.lib got by compiling the source code available at logix4u.net to the project folder. From project menu, select settings, go to tab link, in object/ library modules write inpout32.lib. Now your program should run without any errors.

C++ Serial Port Programming

If you have any comment, feedback and suggestions, please send an e-mail to or Also Read: -转自: http://electrosofts.com/parallel/parallelwin.html.

Pinkham Pediatric Dentistry Pdf FreeJAF Virtual Pkey V2 Zip