Categories

 Edit Translation
by Transposh - translation plugin for wordpress
IPv6 logo

VUSiBino Tachometer II – Host

Utility files

imported functions

Start with a function “itoa()” I found very useful, It is not standard and serves to pass any base number and return it in a text string. The function returns a cedena and is fed to the evaluating value and the base we want the resulting string. This is the link to the function.

USB functions

Are those of this shipment.

Dialog functions

I will focus on reviewing the specific functions “sliders”, Having explained the other in the corresponding chapter of VUSiBino Demo.

The function “setInfoSlider” It serves to control related information in a specific format. Input parameters are hwndDlg, where we refer to the control container, sliderId, which it is the reference control, buddyId, which it is the reference to the associated control information “slider” y sliderUnits, that is how we want the information to be displayed. Currently only we choose between show “in raw” (case “AS_IS”) or as a percentage (case “PERCENTAGE”).

We use messages to obtain the information we need. We get the position where the marker meets “SendMessage(GetDlgItem(hwndDlg, sliderId), TBM_GETPOS, 0, 0)”, which sends the message “TBM_GETPOS” control “sliderId” of the window “hwndDlg”, and identify with “GetDlgItem” for what “SendMessage” He is able to know what we mean. The message “TBM_GETRANGEMAX” It returns the maximum position us to take control, useful for calculating the percentage you want to show.

Acts calculations, We show the information function “SetDlgItemText”.

The function redrawSlider sirve para reposicionar el cursor del control cuando la llamemos, The variable “newValue” This is where we put the value that we want the “slider”. Llama a su vez a setInfoSlider tras poner el cursor en el nuevo lugar con el mensaje “TBM_SETPOS”.

The function setMySlider It is to initialize the control values ​​and look you want to have default.

We declare the call the varianles “minRange” for the start control, “maxRange” the final and maximum value, “ticFreq” markers that will put us each step and you say “initPos” where we want the slider is set courses. With these data we send messages “TBM_SETRANGE,1,MAKELONG(minRange, maxRange))” and “TBM_SETTICFREQ,ticFreq” and calling redrawSlider and we put everything in place. While the rest of the control parameters can put using the resource editor, We can always change dynamically if we need. This is a list of messages that can be used for this purpose, and there are links to macros and functions to make it easy.

 

Principal function

In this function we will handle all data flow, I used a very primitive form of “threads” programming because the compiler did not seem to be very well all functions called and found no way to run the examples necessary for proper control of the threads without something burst. The important thing is that it works and is simple.

 

statements

 

 

In the next installment, we will focus only hardware to use fans three- and two-wire.

Leave a Reply