docdoc 0 Newbie Poster

I would like to write a program to be able to display the events in the windows event viewer logs. Currently I need to drill down thru menu items on the control panel to get to the event viewer and logs. Does anyone know where the event logs are held or how they are created so I get access to them?

docdoc 0 Newbie Poster

The below code is used to access a webpage I called myPage.html by entering a password of 1234. Once the password is entered the User either clicks the Login Button or presses the "Enter" key.

Clicking the login button works OK. My problem is that I have to press the Enter key twice for it to go to myPage.html

What do I need to change so I only have to press the Enter key once?


function TheLogin() {
var password = '1234';
if (this.document.login.pass.value == password) {
top.location.href="http://myPage.html";}
}

</script>
<p align="center">
<p align="center"><br>
<p align="center"><font size="5"><b><font color="#000000">Please enter the Password to Enter</font></b></font><br>
<p>&nbsp; </p>
<center>Enter your password:<br>
<form name="login" style="margin: 0px">


<INPUT TYPE="password" NAME="pass" size="17" onKeyDown="if(event.keyCode==13) event.keyCode=9;" style="width: 152px; margin: 5px;"><br>

<input type="button" value="Click to Login" style="width : 150px; margin: 3px" onClick="TheLogin(this.form)">
</form>
</center>

docdoc 0 Newbie Poster

The following bit of code is to send a string of data to the usb port. How can I modify the code so I only send one byte of data to the usb port instead of a string?

private void usb_OnSpecifiedDeviceArrived(object sender, EventArgs e)
        {
            this.lb_message.Items.Add("My device was found");

            //setting string form for sending data
            string text = "";
            for (int i = 0; i < this.usb.SpecifiedDevice.OutputReportLength - 1; i++)
            {
                text += "000 ";
            }
            this.tb_send.Text = text;
        }

private void btn_send_Click(object sender, EventArgs e)
        {
            try
            {
                string text = this.tb_send.Text + " ";
                text.Trim();
                string[] arrText = text.Split(' ');
                byte[] data = new byte[arrText.Length];

                for (int i = 0; i < arrText.Length; i++)
                {
                    if (arrText[i] != "")
                    {
                        int value = Int32.Parse(arrText[i], System.Globalization.NumberStyles.Number);
                        data[i] = (byte)Convert.ToByte(value);
                    }
                }

                if (this.usb.SpecifiedDevice != null)
                {
                    this.usb.SpecifiedDevice.SendData(data);
                }
                else
                {
                    MessageBox.Show("Sorry but your device is not present. Plug it in!! ");
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
docdoc 0 Newbie Poster

The following bit of code is from the Atmel AtUsbHid example. Can someone please explain the line DYNCALL(writeData)((UCHAR *)"12") which i believe is part of a DLL, maybe....

I know the code turns on and off a LED but i want to know how the code works....

void CUsbHidDemoCodeDlg::OnLed2() 
{
 if(Led2 == false) {
  Led2 = true;
  m_Led2.SetWindowText(_T("LED 2 ON"));  
  DYNCALL(writeData)((UCHAR *)"12");
 }
 else {
  Led2 = false;
  m_Led2.SetWindowText(_T("LED 2 OFF"));  
  DYNCALL(writeData)((UCHAR *)"02");
 }
 
}

Thanks
Don

docdoc 0 Newbie Poster

It's a ARCHEON’s USB-Parallel Printer Cable and the manual doesn't say what address it uses. I did try 0x278 but still no joy.

docdoc 0 Newbie Poster

My laptop doesn't have a parallel port so I purchased a USB to parallel convertor. I wrote a program which sends data to the parallel port to turn on some LEDS and it works ok on a PC with a built in parallel port but it wont work on my laptop with the USB to Parallel convertor. I used the delphi parallel port driver inpout32.dll which I found at http://www.sixca.com/eng/articles/pardel/index.html

Typical use is shown below....

procedure TForm1.Button1Click(Sender: TObject);
begin
Out32($378,$0f); //send $0f to parallel port
end;

Does anyone know why the above code will not work with a USB to parallel convertor?

docdoc 0 Newbie Poster

Thanks...it's easy when you know how. I'm just started to teach myself...

docdoc 0 Newbie Poster

Can anyone explain why the OnKeyPress Event does not work with a TButton on the same Form. What am I doing wrong?

procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:='button';
end;

procedure TForm1.KeyPress(Sender: TObject; var Key: Char);
begin
if Key='a' then Label1.Caption:='OK';
end;