1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Guide 15" Colour LCD: A networking, VB and Photoshop tutorial.

Discussion in 'Modding' started by acrimonious, 24 Apr 2003.

  1. acrimonious

    acrimonious Custom User Title:

    Joined:
    8 Nov 2002
    Posts:
    4,060
    Likes Received:
    3
    We all have one laying around, an old laptop, that beautiful 15" or more TFT display just sat there laughing at us. As people who use the electronics forum will know, seperating this display is very difficult, costly and time consuming, so why seperate it at all!?

    In this guide I'm going to show you how to use simple networking, Microsoft Visual Basic and Adobe Photoshop to create essentially a 15" full colour graphic LCD to put wherever you like, displaying memory, diplaying news, diplaying mp3 data, writing info to a standard LCD, etc.

    Allthough I'm going to be starting at the basics, and will be happy to help you out with any problems, some knowlege of networks, VB and image editing would be handy. Please remember also that I am learning from this experience as well so any help, corrections, comments or ideas are very welcome :).

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

    Objectives
    • To find a use for that old laptop
    • To make a 15" colour LCD to display system stats such as:
      Time, Date, CPU Load, HDD Load, Network Traffic, System Up-Time and, eventually, bit-tech stats at a glance, ie unread posts and stuff.
    • To teach people about how easy networking is, and how easy it is to get creative with it.
    • To teach people about VB programming and that satisfaction it provides when it finally works!
    • To teach people about how to add cool GUI's to their programs.

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

    Things Done:
    • The networking bit
    • Visual Basic basics
    • The winsock and timer control
    • The basics of the laptop program
    • The system monitor control
    • The whole of the main PC program
    • The GUI design
    • Implimented the GUI
    • The article for the GUI design
    • Getting the Laptop to split and sort the string it recives.
    • Article on implimenting the GUI into the laptop program (mostly done)
    • Article about testing and setting it up

    Thing(s) I'm Working On:
    • Temperature information(optional) - anytime now
    • Adding mp3 stats, player has already been coded(optional) - looking into winamp integration
    • Adding a news ticker tape(optional) - working on XML parsing

    Things Not Started On Yet:
    • Adding Bit-Tech stats, ie is there any new posts(optional)
    • More work on the hardware side of the old laptop(optional)
     
    Last edited: 12 Mar 2004
    mookie likes this.
  2. acrimonious

    acrimonious Custom User Title:

    Joined:
    8 Nov 2002
    Posts:
    4,060
    Likes Received:
    3
    Installment 1: The Network

    I have a 'mini5' switch that i am going to be using for this tutorial:
    [​IMG]
    Its a small 7 port switch however a patch cable, 2-port-or-more hub, switch or router should work fine.

    My network is connected like this:
    [​IMG]
    My internet connection comes through a router and into port 1, my main PC is in port 2 and the old laptop is in port three (i sometimes have another machine in port 4). This is the diagram for my set up, cheesily drawn on a white board:
    [​IMG]

    The Main PC:
    [​IMG]
    The (not-so-old) Laptop:
    [​IMG]
    [​IMG]
    I am using this shiny Sony laptop in this guide, for the simple reason that i broke my ethernet card for my old and tatty Toshiba laptop :blush:


    For our laptop system to work we are going to need to connect our laptop to the main computer through a 'patch cable' or a hub, switch or router. This process is very plug-and-play and i'm not goign to go into much detail at this stage as every machine is different, more help is available online and many network cards, hubs switches and routers come with good guides.

    Once this is done we can get to the fun part :)
     
    Last edited: 24 Apr 2003
  3. acrimonious

    acrimonious Custom User Title:

    Joined:
    8 Nov 2002
    Posts:
    4,060
    Likes Received:
    3
    Instalment 2: The scarey Visual Basic bit

    Not many people have Visual Basic, i'm using a student version of VB6 proffesional which i got for under £50 along with the full 'Visual Studio' which is a good deal, since it also includes InterDev (great for web programming), Visual C++, J++, Fox, and alsort of other stuff that you'll probably never use. Other editions are also available that do not allow you to compile, which are good for fiddling with.

    Okay this is (something like) the frightening thing that greets you when you start VB:
    [​IMG]
    We want to create a 'Standard EXE'

    Here's the basics of the daunting interface, most of the stuff we wont be using, these are the main things:
    [​IMG]



    Now your familliar with the interface its time to get started!
    I've adjusted the work area to help show you what i'm doing and highlighted anything i've changed since the last time in green.

    Okay so lets make our form suitable for what were goign to be doing first (filling a laptop screen/monitor):
    [​IMG]
    Easy, it might be a good idea to mention that pressing [​IMG] at this point in the proccess is not a good idea, it will start your fullscreened form (frmMain) with no close, minimise or restore buttons.


    Okay then, next we're going to add a close 'Command Button' so we can test our form (frmMain) without worring about not being able to close it. Click this button [​IMG] (you should find it on the left hand side of the window) and create a button somewhere on your form:
    [​IMG]
    But the button wont work yet, its time to get our first peek at the code window, double click on the button, the code window should appear:
    [​IMG]
    Type in End in between "Private Sub cmdClose_Click()" and "End Sub" so it reads:
    Code:
    Private Sub cmdClose_Click()
    
    End
    
    End Sub
    
    This basically says 'When cmdClose (our close button) is clicked end the program'.

    Okay we can test our button now, press [​IMG] near the top of the screen. The screen should turn grey (because of the maximised grey form), click the 'Close' button and the form should disapear leaving you back in VB.



    Okay so now the basics are over, its time to get some useful data put on the screen (this program will run on the laptop remember). There's two basic types of data in our project: Data local to the laptop (we could use the laptops date and time on the form) and Data remote to the laptop (stuff from the main PC like HDD space, RAM percentage, etc and data like news items and forum data from the internet).

    The first thing we are going to do is the simplest, add some text 'labels' on the form to display the date and time. So we need to add some labels to the form (frmMain) by clicking the [​IMG] button on the left of the screen. We are going to create 4 labels, one for date, one to label the date (ie 'Date' or 'Todays date is'), one to display the time and one to label the time (ie 'Time:' or 'The time is'). It doesn't really matter where you put them at this point(because were going to make a cool interface/skin for it in Photoshop at a later stage). I've changed the label names to something memorable (lblDateLab, LblDate, lblTimeLab, lblTime) and changed the 'Captions' (the text they display by default, click on the label and look in the 'Properties' box on the right) like this:
    [​IMG]

    We want our time and date to automatically update so its time to introduce another tool, the Timer. We need to make our programs code update the time every second so were going to add a timer to our form (frmMain). Click the timer button, [​IMG] and place one somewhere on the form, a little gray box with a stop watch inside should appear, this will not be visible when our program is running, press [​IMG] and see for yourself. Okay so next were going to change some of the timers propeties, click on the timer and change this settings:
    [​IMG]
    We've now told the timer (which I've called tmrSec) to activate every second (1000 miliseconds in this case).

    Now were going to add some code to be run every-time the timer is activated (every second in other words), double click on the little stop watch on our form (frmMain), the code window will appear. Make your code look like this:
    Code:
    Private Sub cmdClose_Click()
    'When cmdClose is clicked...
    
    End
    '...End the program.
    
    End Sub
    
    Private Sub tmrSec_Timer()
    'When tmrSec is activated (every second)...
    
    lblTime.Caption = Time
    '...Change lblTime's caption to the current system time...
    
    lblDate.Caption = Date
    '...Change lblDate's caption to the current system date.
    
    End Sub
    
    (if you've used the same object names as me (frmMain, lblTime, tmrSec, etc) you can simply copy and paste this code.
    I have added some explanations in the code, these explanations start with a ' symbol, this tells Visual Basic to ignore this following text (upto the end of that line), and that it's just for our use.


    Waho! We've just made our first real steps into Visual Basic coding, wasn't that easy! Now click [​IMG] and enjoy your work, the clock and date should update every second (the date will just update and not change though). If it doesn't work, you've done something wrong, check your spelling, timer settings, names and cases (VB is VERY fussy).
     
    Last edited: 26 Apr 2003
  4. :: Phat ::

    :: Phat :: Oooh shakalaka!

    Joined:
    7 Jun 2002
    Posts:
    4,886
    Likes Received:
    3
    Looking good :)

    and in the words of the little shop of horrors, (taken in a different context obviously)

    "FEED ME SEMOUR!"

    more more more more!
     
  5. Dad

    Dad You talkin to me?

    Joined:
    15 Apr 2003
    Posts:
    5,375
    Likes Received:
    8
    Ooooooo.... A VB tutorial! Sad thing is I know VB Script to design web sites, but never tried VB itself. This would be GREAT for that old junky PII 233 I have collecting dust under my desk. :clap:
     
  6. fivecheebs

    fivecheebs Dont panic!

    Joined:
    19 Feb 2003
    Posts:
    1,768
    Likes Received:
    2
    What a good idea :idea: I hope a complete VB virgin like me might be able to give it a go, looks quite scarey allready hehe
     
  7. modmaster

    modmaster What's a Dremel?

    Joined:
    10 Apr 2003
    Posts:
    171
    Likes Received:
    1
    i know quight alot about visual basic. i have tought myself it and it took me 3 years to learn it so far and i might be able to help you with any problems.:D
     
  8. dakar

    dakar What's a Dremel?

    Joined:
    6 Mar 2002
    Posts:
    460
    Likes Received:
    0
    Just jumping on to sub to the thread...looks like things could get interesting. the close button...hmm thats further into VB than i could stand to venture last time around.
     
  9. penski

    penski BodMod

    Joined:
    29 Aug 2002
    Posts:
    8,159
    Likes Received:
    2
    I spent two years doing A level computing that was virtually exclusively VB :)

    *hunts for el cheapo laptoppen*

    *n
     
  10. DeX

    DeX Mube Codder

    Joined:
    22 Jul 2002
    Posts:
    4,152
    Likes Received:
    3
    This is looking good acrimonious. Although most people who own vb will probably know how to do what you've explained so far (done about 3-5 years of vb myself) I still think it was well written and fun to read. I just can't wait to see what you're going to do next with this giant grey form.
     
  11. penski

    penski BodMod

    Joined:
    29 Aug 2002
    Posts:
    8,159
    Likes Received:
    2
    My guess is that he's going to use a VB form to show PC stats et cetera.

    *n
     
  12. djengiz

    djengiz Pointless.

    Joined:
    16 Aug 2002
    Posts:
    1,129
    Likes Received:
    0
    Im a vb programmer too. So if you want any help id be glad to help you.
     
  13. Premium

    Premium What's a Dremel?

    Joined:
    10 Mar 2003
    Posts:
    26
    Likes Received:
    0
    hehe i have 2 old lappy's.. 1 my mum used to use at work...and a old toshiba i bought off a friend for $3. w00t, cant wait to see the rest of the tut :clap:

    oh yeh, if you need any help with photoshop stuff, just give me a shout, ive got 2 years experiance... thats at least 2 hours a day of photoshop...
     
  14. acrimonious

    acrimonious Custom User Title:

    Joined:
    8 Nov 2002
    Posts:
    4,060
    Likes Received:
    3
    Installment 3: VB and Networking, Remote Data

    Okay so now we've got some VB basics under our belt, its time to get busy with the remote data (see Installment 2). So next we are going to figure out how to send some data from our Main PC across the network and to the Laptop so it can then display that data on the Laptop's sexy 15" screen.

    To do this its time to indroduce another one of our VB friends, the curiously named 'WinSock' control. Strangely this tool has nothing to do with underwear, but it does allows us to connect 2 or more PC's together across a network and then send data to and from them, its pretty simple (as far as network programming goes) so its perfect for what we want (unless you need a new pair of socks)!

    We are going to need 2 programs to get our system working, the one that we are programing now for the laptop and another one we will make later to go on the PC. The WinSock control is going to connect the PC will be acting as what we call a 'Client' to the Laptop which will be acting as the 'Server', no wallthough this sounds scarey, all its means is that the PC will connect to the Laptop instead of the other way round.

    So to achive this we need to add a 'WinSock Control' to our form (frmMain) and tell it to 'Listen' for the PC.

    The WinSock control button looks like this: [​IMG]. Now by default we don't have one in out tool bar on the left of the screen so we need to right click on the tool bar, this should appear:
    [​IMG]
    Click 'Components', this window should then appear:
    [​IMG]
    Scroll down until you find an item called 'Microsoft WinSock Control', we need to check this item. Click Okay, the window should disapear and a WinSock button,[​IMG], should appear in the tool bar.

    Add one to your form (frmMain), a little grey box will appear, like the timers, with the WinSock icon inside it, just like the timer this little box will be invisible when the program is running, click [​IMG] and see.

    First we need to cahnge a few properties of the control, so select the control and change as shown:
    [​IMG]

    As you can see we've changed its name to 'wskMain' and another property called 'LocalPort', this is so when we tell the control (wskMain) to listen, it will listen on that 'Port', later on when we are programing the PC's program (or Client side) we well tell it to try and 'Connect' through that port (123).

    Okay so now we need to tell the WinSock control (wskMain) to listen. To do this we need to add some simple code, so, double click somewhere on teh gray space that is your form (frmMain). In the code window a 'SubRoutine' should have been added that starts 'Private Sub Form_Load()' and ends 'End Sub', in between those 2 lines add 'wskMain.Listen'. So our code should now be similar to this:
    Code:
    Private Sub Form_Load()
    'When the Form(/program) Loads...
    
    wskMain.Listen
    '...Tell wskMain to Listen (on LocalPort).
    
    End Sub
    
    
    Private Sub tmrSec_Timer()
    'When tmrSec is activated (every second)...
    
    lblTime.Caption = Time
    '...Change lblTime's caption to the current system time...
    
    lblDate.Caption = Date
    '...Change lblDate's caption to the current system date.
    
    End Sub
    
    
    Private Sub cmdClose_Click()
    'When cmdClose is clicked...
    
    End
    '...End the program.
    
    End Sub
    
    It doesn't matter about the order of our 'SubRoutines', however it is best to put them in a logical order so its easier for us to edit later on.

    Next we're going to add a Log to our form, not the wooden tree kind, but a text box that will display all the things that our WinSock Control is doing, you don't have to do this, its very much an extra, but I feel it is suitably worth it, it will make finding problems in out program so much easier and look quite cool when we come to deal with the cosmetic side of our program.

    So to add a Log we need to add a text box to our form, the button in the tool bar looks like this [​IMG]. Click it an add a decent sized text box to your form (frmMain), you may need to make the form a little bigger. We need to change some properties of this text box, you know the score by now:
    [​IMG]
    We've changed the name, as usuall, to something memorable, in this case txtLog and, the 'MutiLine' property to true so the log can have more than one line and finally I've cahnged the 'Text' propety to "System Log Started @".

    Next we'er going to add some code to the 'Form_Load' SubRoutine to add the time to the log, so when the program starts it will read: "System Log Started @ 15:02:54" for example. So double click on your form (frmMain) and make your code look like this:
    Code:
    Private Sub Form_Load()
    'When the Form(/program) Loads...
    
    wskMain.Listen
    '...Tell wskMain to Listen (on LocalPort)...
    
    txtLog.Text = txtLog.Text & Time
    '...Make txtLog's Text: txtLog's current Text and the current system Time.
    
    End Sub
    
    
    Private Sub tmrSec_Timer()
    'When tmrSec is activated (every second)...
    
    lblTime.Caption = Time
    '...Change lblTime's caption to the current system time...
    
    lblDate.Caption = Date
    '...Change lblDate's caption to the current system date.
    
    End Sub
    
    
    Private Sub cmdClose_Click()
    'When cmdClose is clicked...
    
    End
    '...End the program.
    
    End Sub
    
    
    
    Okay, pretty simple eh? Next we need to add a bit more code to get the WinSock control to work correctly when the PC (Client) requests to connect with it. So open up the code window (if it isn't allready open) and make your code look like this:
    Code:
    Private Sub Form_Load()
    'When the Form(/program) Loads...
    
    wskMain.Listen
    '...Tell wskMain to Listen (on LocalPort)...
    
    txtLog.Text = txtLog.Text & Time
    '...Make txtLog's Text: txtLog's current Text &  the current system Time.
    
    End Sub
    
    
    Private Sub tmrSec_Timer()
    'When tmrSec is activated (every second)...
    
    lblTime.Caption = Time
    '...Change lblTime's caption to the current system time...
    
    lblDate.Caption = Date
    '...Change lblDate's caption to the current system date.
    
    End Sub
    
    
    Private Sub wskMain_ConnectionRequest(ByVal requestID As Long)
    'When wskMain recives a connection request, store a ID for this request in a variable called requestID...
    
    If wskMain.State <> sckClosed Then wskMain.Close
    '...If wskMain's State is not (unequal to) Closed then Close the connection...
    
    wskMain.Accept requestID
    '...Accept the connection with that same ID (requestID)...
    
    txtLog.Text = txtLog.Text & vbCrLf & "Client Connected"
    '...Make txtLog's Text: txtLog's current Text & new line & 'Client Connected'.
    
    End Sub
    
    
    Private Sub cmdClose_Click()
    'When cmdClose is clicked...
    
    End
    '...End the program.
    
    End Sub
    
    Once you've got your head around that, we need to tell our WinSock control (wskMain) what to do when the Main PC (Client) sends some data. First we need to maek it put that data in the Log (txtLog) and then decide what to do with it, but before we decide what to do with it we need to know a few things first, what data the PC is going to send, and how that data will be fomated or laid out, because it will all come in one chunk.

    So before we start work on the Main PC's program we will add some code to this program that tells the WinSock control (wskMain) to put the data that it recives in the Log (txtLog), on a new line. To do this we need to add a new SubRoutine so open up the code window and make the code look like this:
    Code:
    Private Sub Form_Load()
    'When the Form(/program) Loads...
    
    wskMain.Listen
    '...Tell wskMain to Listen (on LocalPort)...
    
    txtLog.Text = txtLog.Text & Time
    '...Make txtLog's Text: txtLog's current Text &  the current system Time.
    
    End Sub
    
    
    Private Sub tmrSec_Timer()
    'When tmrSec is activated (every second)...
    
    lblTime.Caption = Time
    '...Change lblTime's caption to the current system time...
    
    lblDate.Caption = Date
    '...Change lblDate's caption to the current system date.
    
    End Sub
    
    
    Private Sub wskMain_ConnectionRequest(ByVal requestID As Long)
    'When wskMain recives a connection request, store a ID for this request in a variable called 'requestID'...
    
    If wskMain.State <> sckClosed Then wskMain.Close
    '...If wskMain's State is not (unequal to) Closed then Close the connection...
    
    wskMain.Accept requestID
    '...Accept the connection with that same ID (requestID)...
    
    txtLog.Text = txtLog.Text & vbCrLf & "Client Connected"
    '...Make txtLog's Text: txtLog's current Text & new line & 'Client Connected'.
    
    End Sub
    
    
    Private Sub wskMain_DataArrival(ByVal bytesTotal As Long)
    'When wskMain recives some data, store the size of the data in bytes...
    
    wskMain.GetData varData
    '...Get wskMain to get the newly recived data and stroe in in a variable called 'varData'...
    
    txtLog.Text = txtLog.Text & vbCrLf & "Recived Data:" & varData
    '...Make txtLog's Text: txtLog's current Text & new line & 'Recived Data:' & the newly recived data (varData).
    
    End Sub
    
    
    Private Sub cmdClose_Click()
    'When cmdClose is clicked...
    
    End
    '...End the program.
    
    End Sub
    
    
    
     
    Last edited: 26 Apr 2003
  15. SciGuy

    SciGuy What's a Dremel?

    Joined:
    25 Jul 2002
    Posts:
    115
    Likes Received:
    0
    Gonna be a sweet mod mate,
    Might have to try this baby out with this just about useless laptop i've got lying here. :D
     
  16. acrimonious

    acrimonious Custom User Title:

    Joined:
    8 Nov 2002
    Posts:
    4,060
    Likes Received:
    3
    Installment 4: Time for a break. Ripping a Laptop Apart (optional)

    Well we've got a big chunk of our coding for the Laptop system done now. All that coding can be, in fact, is allways very stressful. So what better way to relive that pent up agression than by taking a break and ripping the casing of an old Laptop.

    <weird david dickenson cross over bit>Here is an old, yet working Toshiba Laptop from sometime in the 90's. As you can see its a lovely peice, only about £2 so its cheap as Integrated Circuits. Its in need of restoration and has an original retail value of around £2000</weird david dickenson cross over bit>:
    [​IMG]
    [​IMG]

    Time to get busy:
    [​IMG]
    First off was the plastic front of the screen

    [​IMG]
    Next i took out the battery and CD drive, it's really light without them

    [​IMG]
    Next to die was the plastic back of the lid, freeing the LCD.

    [​IMG]
    As you can see its pretty thin now, this shell will fit in some of my cases, however i think its going to look best mounted like a TFT, I will hopefully be mouting this in one of my projects at a later stage.


    Now, we've taken the battery off because it wasn't going to be used anyway, lets discuss power. Now we could just use the original cable and plug it in that way, which is fine, but there is another way, take at look at this from Maplin (i'm sure similar products are available worldwide):
    [​IMG]
    I'm hopefully going to power the machine with this device, which slots into a spare PCI cover slot, gets its power from the PSU and converts it from 3v-12v (selectable with jumpres) and then puts it through an adapter cable which we can plug into our old, skinned laptop.

    Of course you don't have to do any of the above, i just think it will look cooler.
     
    Last edited: 5 May 2003
  17. acrimonious

    acrimonious Custom User Title:

    Joined:
    8 Nov 2002
    Posts:
    4,060
    Likes Received:
    3
    Installment 5: The Main PC (Client) Program

    Okay so now its time to write the program for the PC (the 'Client'), this program will connect to the Laptop (the 'Server') and send information about the PC to the Laptop for it to display on that lovely, colour TFT display.

    So we're going to make a form with a 'Command Button' that, when pressed, will connect to the Laptop and hide the 'Form' and thus everything on the 'Form'.

    So, its time to get busy, start Visual Basic, we want to create a 'Standard EXE':
    [​IMG]

    First we're goign to re-size our Form and change a few Properties:
    [​IMG]

    We're going to add a 'Command Button' [​IMG] to our form (frmMain) and change 2 Properties:
    [​IMG]

    Next we're going to add a 'WinSock Control' [​IMG] (if this is not in the tool bar you will need to add it using the components window, see Installment 3) and change a few Properties:
    [​IMG]
    Note that I've put the IP address in 'RemoteHost' as 127.0.0.1, this is the 'Local' IP address not the Laptops, I have put this in so I can test both Programs (Main PC and Laptop) on the same machine or 'Locally'. When the system is being set up properly we will need to change this to the Laptop's IP address. If you need to find out the IP address, i have written a small (20KB) program to help, get it here

    Okay, so I know your now itching to test our program and feel the satisfaction only a peice of VB network porgramming can provide. To test our program we are going to need to run 2 copies of the 'VB Development Enviroment' so open up another one. One should have the PC's program in ('Client') and the other the Laptops ('Server').

    Now in a moment were going to hit [​IMG] on both running copies of VB, but first we need to make sure the Laptop's Form (frmMain) doesn't swallow our screen making it impossible for us to click 'Connect and Hide' (cmdConn) on the other program (Main PC's). So make sure your in the copy of VB with our Laptop program open, click once on the Form (frmMain) and then change the 'Window State' to '0 - Normal' in the Properties box (on the right).

    Okay so now we're ready to test, press [​IMG] on both program. Now making sure you can see both windows click 'Connect and Hide' on the PC's program, if it works you will see 'Client Connected' appear in the Log window of the Laptop's program and the Main PC's program will disappear. If it doesn't check your code, object names, cases, etc.
     
    Last edited: 4 May 2003
  18. acrimonious

    acrimonious Custom User Title:

    Joined:
    8 Nov 2002
    Posts:
    4,060
    Likes Received:
    3
    Installment 6: The System Monitor Control

    Okay so the next step is to write some code to retrive some system information from the Main PC. Now the most common way to do this is with API's, this is really complicated and really scarey and I'd feel guilty putting the VB virgin through that! So we're going to use another control called 'System Monitor'. This control will retrive system information such as CPU Load, RAM Free, Network Speed, etc for us which we will then pack up into one 'variable' and send to the Laptop's program to display it.

    Now, I'm afraid this control doesn't come with operting systems that pre-date Windows 2000, but all hope is not lost, you simply need to obtain the control and dump it in your 'c:\windows\system32' folder, i would upload it to my web-site but i'm not sure about the laws on distributing this control but i'm sure you could find it somehwere, its filename is 'sysmon.ocx', if you do find a source please share it :). Note that you will only need to use this control on the Main PC and not the shoddy old laptop!

    Right lets get started, the first thing we need to do is add the 'System Monitor' control to our toolbox, like we did with the WinSock control:
    [​IMG]

    Add the system monitor control to our form, click the system monitor button that should now be in our tollbox: [​IMG] as you can probably see it's allmost a full program on its own, with a GUI, toolbars, graphs, reports, etc but we are not interested in that, resize the control into something that fits on your form, a small box is good, click on it and change these properties:
    [​IMG]
    So we've now given it an easy to remember name, changes what numbers it gives out (to the current value from the default) and made it invisible.

    Now were going to some code that tells our system monitor what to report on, we need to add some 'counters', double click on the form and make you code look like this:
    Code:
    Dim Data As String
    'Make sure the varible Data is allways a string (letters and numbers)
    
    
    Private Sub Form_Load()
    'When the Form(/program) starts up...
    
    SysMon.Counters.Add "\Processor(_Total)\% Processor Time"
    SysMon.Counters.Add "\Memory()\Available MBytes"
    SysMon.Counters.Add "\PhysicalDisk(_Total)\% Disk Time"
    SysMon.Counters.Add "\System()\Processes"
    SysMon.Counters.Add "\System()\System Up Time"
    SysMon.Counters.Add "\Network Interface(3Com EtherLink PCI)\Bytes Total/sec"
    SysMon.Counters.Add "\Network Interface(MS TCP Loopback Interface)\Bytes Total/sec"
    '...add named 'counters' or items for the system monitor to monitor
    '(To find more, or the names of your network controllers make the control on your form bigger and use the add counters button in the GUI to figure it out).
    
    End Sub
    
    
    Private Sub cmdConn_Click()
    'When cmdConn is clicked...
    
    wskMain.Connect
    '...Connect wskMain to 'RemoteHost' through 'RemotePort'...
    
    frmMain.Visible = False
    '...Make frmMain (and everything in it) not Visible.
    
    End Sub
    
    
    Private Sub SysMon_OnSampleCollected()
    
    MemFree = SysMon.Counters.Item(1).Value
    NetEthernetTotal = SysMon.Counters.Item(2).Value
    NetLoopbackTotal = SysMon.Counters.Item(3).Value
    HDDTime = SysMon.Counters.Item(4).Value
    CPUTime = SysMon.Counters.Item(5).Value
    SysProccess = SysMon.Counters.Item(6).Value
    SysUpTime = SysMon.Counters.Item(7).Value
    '...retrive the current value of all the 'counters' of the system monitor numbers 1-7 (alphabetical full-name order)...
    
    Data = CPUTime & "n" & MemFree & "n" & HDDTime & "n" & SysProccess & "n" & SysUpTime & "n" & NetEthernetTotal & "n" & NetLoopbackTotal
    '...combine all the varibles, sepertate them with the letter n (in my head for next) into one long variable called 'Data'.
    
    End Sub
    
    
    Next we need to add a timer [​IMG] on the form, to tell the WinSock control (wskMain) how often to send the system information (Data) to the laptop, lets change its '(Name)' to something memorable 'tmrMain', and its 'Interval' to '5000' (miliseconds) and is 'Enabled' property to 'False', you know what to do;). Next we need to double click on the little timer box (the little stopwatch in a grey box on the form) and make your code look like this:
    Code:
    Dim Data As String
    'Make sure the varible Data is allways a string (letters and numbers)
    
    
    Private Sub Form_Load()
    'When the Form(/program) starts up...
    
    SysMon.Counters.Add "\Processor(_Total)\% Processor Time"
    SysMon.Counters.Add "\Memory()\Available MBytes"
    SysMon.Counters.Add "\PhysicalDisk(_Total)\% Disk Time"
    SysMon.Counters.Add "\System()\Processes"
    SysMon.Counters.Add "\System()\System Up Time"
    SysMon.Counters.Add "\Network Interface(3Com EtherLink PCI)\Bytes Total/sec"
    SysMon.Counters.Add "\Network Interface(MS TCP Loopback Interface)\Bytes Total/sec"
    '...add named 'counters' or items for the system monitor to monitor
    '(To find more, or the names of your network controllers make the control on your form bigger and use the add counters button in the GUI to figure it out).
    
    End Sub
    
    
    Private Sub cmdConn_Click()
    'When cmdConn is clicked...
    
    wskMain.Connect
    '...Connect wskMain to 'RemoteHost' through 'RemotePort'...
    
    frmMain.Visible = False
    '...Make frmMain (and everything in it) not Visible.
    
    End Sub
    
    
    Private Sub SysMon_OnSampleCollected()
    
    MemFree = SysMon.Counters.Item(1).Value
    NetEthernetTotal = SysMon.Counters.Item(2).Value
    NetLoopbackTotal = SysMon.Counters.Item(3).Value
    HDDTime = SysMon.Counters.Item(4).Value
    CPUTime = SysMon.Counters.Item(5).Value
    SysProccess = SysMon.Counters.Item(6).Value
    SysUpTime = SysMon.Counters.Item(7).Value
    '...retrive the current value of all the 'counters' of the system monitor numbers 1-7 (alphabetical full-name order)...
    
    Data = CPUTime & "n" & MemFree & "n" & HDDTime & "n" & SysProccess & "n" & SysUpTime & "n" & NetEthernetTotal & "n" & NetLoopbackTotal
    '...combine all the varibles, sepertate them with the letter n (in my head for next) into one long variable called 'Data'.
    
    End Sub
    
    
    Private Sub wskMain_Connect()
    'When the WinSock controll estabises a connection...
    
    tmrMain.Enabled = True
    '...Enable the timer (start counting).
    
    End Sub
    
    
    Private Sub tmrMain_Timer()
    'Every time the timers time limit is up (loops)...
    
    wskMain.SendData Data
    '...use the WinSock control to send the variable 'Data' (to 'LocalHost' through 'LocalPort')
    
    End Sub
    
    
    PTO...
     
    Last edited: 5 May 2003
  19. modmaster

    modmaster What's a Dremel?

    Joined:
    10 Apr 2003
    Posts:
    171
    Likes Received:
    1
    THIS MODD IS LOOKING SWEET AND I AM GONA HAVE TO TRY IT. ALL I NEED FIRST IS TO GET HOLD OF AN OLD LAPTOP AND THEN I CAN DO IT. MY FRIEND HAS AN OLD LAPTOP BUT IT IS ONE OF THESE WHERE YOU PUT EITHER A FLOPPY DRIVE IN OR A CD DRIVE IN YOU JUST TAKE THEM OUT AND PLACE THE ONE IN YOU WANT. YOU CAN NOT HAVE THEM BOTH IN TOGETHER SO IT IS A PROBLEM LOADING UP WINDOWS AND MY FRIEND FORMATED THE HARD DISK AND I CANT GET WINDOWS BAK ON. I AM GONA GET IT OFF HIM ANYWAY SO THAT I CAN GET THE 15" COLOUR LCD OUT OF IT AND MAYBE USE IT IN A FUTURE MODD. BUT IF YOU GUYS KNOW HOW TO GET WINDOWS 98 BACK ON I NEED TO KNOW. I AM LOOKING ON EBAY FOR A LAPTOP.
     
  20. Meblin

    Meblin Supposed IR God!

    Joined:
    5 Mar 2002
    Posts:
    1,018
    Likes Received:
    0
    I should have read your post before you posted it in my class :nono: :hehe:

    Bring the laptop in and I'll show you how to get windows back on it.

    Meblin
     
Tags:

Share This Page