|
-
Jun 20th, 2009, 01:52 AM
#1
Thread Starter
New Member
inpout32 run well in c# but problem in vb6
Dear All
I got a program which is utilizing inpout32 developed with c#, unfortunately the developer has gone. Now i want to continuing the programming with vb6. This inpout32 is controlling 3 unit of seven segmen digital display box, every box is having 3 characters.
Display box whill showing the number which is send from database, for example, box one displaying 123, box2 is displaying 221, box3 displaying 331. There is no problem while using C#, when i trying to developing vb6, the display could not showing what we have sent.
The following is the right code of C#
class LPT
{
// Call OutPut function from DLL file.
[DllImport("inpout32.dll", EntryPoint = "Out32")]
public static extern void Output(int adress, int value);
// Call Input functionfrom DLL file
[DllImport("inpout32.dll", EntryPoint = "Inp32")]
public static extern int Input(int adress);
}
private void ShowNumber(string nomor, int iloket)
{
string satuan;
string puluhan;
string ratusan;
try
{
satuan = nomor.Substring(nomor.Length - 1, 1);
puluhan = nomor.Substring(nomor.Length - 2, 1);
ratusan = nomor.Substring(nomor.Length - 3, 1);
LPTCall(int.Parse(satuan));
LPTCall(int.Parse(puluhan));
LPTCall(int.Parse(ratusan));
LPTCall(iloket);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
private void LPTCall(int angka)
{
try
{
LPT.Output(888, angka);
LPT.Output(888, angka + 128);
System.Threading.Thread.Sleep(50);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
And the following is my not working vb6 codes, what s wrong with this
Private Sub Command3_Click()
Dim sat, pul, rat, loket As Integer
sat = 1
pul = 2
rat = 3
loket = 1
Out 888, sat 'perintah ini sama dengan out val("&H"+"378"),sat
fctPause (10)
Out 888, sat + 128
fctPause (10)
Out 888, pul
fctPause (10)
Out 888, pul + 128
fctPause (10)
Out 888, rat
fctPause (10)
Out 888, rat + 128
fctPause (10)
Out 888, loket
fctPause (10)
Out 888, loket + 128
fctPause (10)
Out 888, 0
fctPause (10)
Out 888, 0 + 128
fctPause (10)
Out 888, 255
fctPause (400)
End Sub
Thanks for any kind helps
Kholid
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|