Professional Documents
Culture Documents
This program servers the weather to the PIC from www.weather.com using any zip code programmed into
the PIC when it is initialized. Set the form visible property to false, the shown in task bar property to false,
and set the startup state to minimized. This hides the application. You might also want to place this into
the startup folder so it runs whenever the PC is started.
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
System.Runtime.InteropServices;
// for C# 2007
namespace Weather
{
// There is an apparent bug in the webbrowser that requires that the
// following change to the browser needs to be made to prevent a popup
// scripting error message from appearing because of a script error at
// weather.com. To turn off the Scripting Debugger in Internet Explorer,
// on the Tools menu, click Internet Options. On the Advanced tab, select
// the Disable all script debugging check boxes, and then click OK.
//
public partial class Form1 : Form
{
// must place mpusbapi.dll in the bin/debug and bin/debug folders
[DllImport("mpusbapi.dll")]
private static extern int _MPUSBGetDLLVersion();
[DllImport("mpusbapi.dll")]
private static extern int _MPUSBGetDeviceCount(byte[] array);
[DllImport("mpusbapi.dll")]
private static extern IntPtr _MPUSBOpen(int a, byte[] b, byte[] c,
int d, int e);
[DllImport("mpusbapi.dll")]
private static extern IntPtr _MPUSBWrite(IntPtr a, byte[] b, int c,
ref int d, int e);
[DllImport("mpusbapi.dll")]
private static extern IntPtr _MPUSBRead(IntPtr a, byte[] b, int c,
ref int d, int e);
[DllImport("mpusbapi.dll")]
private static extern IntPtr _MPUSBReadInt(IntPtr a, byte[] b, int c,
int[] d, int e);
[DllImport("mpusbapi.dll")]
private static extern bool _MPUSBClose(IntPtr a);
private static IntPtr outPipe;
private static IntPtr inPipe;
private enum MP_MODE { MP_WRITE, MP_READ };
private string zipCode;
private int state = 0;
private int temp;
public Form1()
{
InitializeComponent();
}