|
Dave sorry but it is still not working...
Dim Ip32 As UInt32 = CType(TargetIp.Address, UInt32)
rc = SendARP(Ip32, 0, MacBytes, Length)
it is not not converting the TargetIP.Address to UInt32 say that "Public Property address as long is absolute and is family dependent"
i tried a lot other type of conversions but not working.
also while calling sendARP the second parameter 0 is also not converting i tried UInt32.parse(0) then it is not showing any error but dont seems to be working..
please help me.
abhinav
|
|
|
|
|
Did you ever get this to work? I am looking for some code to get all the mac address from out network. I beleive this is the same thing your tring to do.
Thanks
|
|
|
|
|
Ya it is working fine with some modifications thanks to dave .
what i m doing is taking the IP address in a text box from the user than showing the MAC address in another textbox
do like this :
form level declaration:
<br />
imports system.net<br />
<br />
<DllImport("iphlpapi.dll")> _<br />
Private Shared Function SendARP(ByVal DestIP As UInteger, ByVal SrcIP As UInteger, <Out()> ByVal pMacAddr() As Byte, ByRef PhyAddrLen As Integer) As UInteger<br />
End Function
than in any button event use this:
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click<br />
<br />
Try<br />
Dim addr As IPAddress = IPAddress.Parse(TextBox5.Text)<br />
Dim mac(6) As Byte<br />
Dim len As Integer = mac.Length<br />
SendARP(CType(addr.Address, UInteger), 0, mac, len)<br />
<br />
Dim macAddress As String = BitConverter.ToString(mac, 0, len)<br />
If macAddress = "" Then<br />
MsgBox("Cannot Resolve MAC from The Given IP Address")<br />
Return<br />
End If<br />
TextBox6.Text = macAddress<br />
<br />
Catch ex As System.FormatException<br />
MsgBox("Enter an Valid IP Address..." + ex, MsgBoxStyle.Critical)<br />
Catch ex As System.ArithmeticException<br />
MsgBox("Cannot extract MAC address " + ex, MsgBoxStyle.Critical)<br />
<br />
End Try<br />
<br />
End Sub
try it and tell me if u have any problem
abhinav
|
|
|
|
|
I have been searching all over the net for an answer to this and haven't been able to find anything. I know that this probably sounds petty but...
Has anyone else noticed that when you change the cursor in a .NET app to the "hand", that it doesn't have the shadow under it? Does anyone know a different way of displaying the hand cursor so that it looks like the "normal" link cursor in windows.
It just doesn't look right to me when I use that cursor. I mean, people that are used to using XP expect that when they hover over something that the cursor changes to the hand with the nice shadow under it. But when I use it, it just looks... Cheap, I guess is the right word.
|
|
|
|
|
If it's in XP, perhaps it's styled ? You can change the cursor to anything you like, but I don't know of any way to change the hand that is built in.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
I have one ISDN PCI card installed on w2k system for voice communication.
When ever there is a incoming call i should get an aural indication through a buzzer which is on board of ISDN card.
Now the problem is that while giving the device driver the supplier has not compiled the buzzer activating file and now i am not getting aural indication.
So we have thought that we will activate the buzzer by accessing the registers of the card for which the supplier has given the details.
The supplier has given that in the register AOE and ACFG1 of PSB21150 IPAC Ic if we put value 0x04 and 0xfb the buzzer will activate and 0xff the buzzer gets deactivated.The incoming call indication is coming as interrupt to my VB application program and during that time i should activate my buzzer.
So if any one knows about how to access the registers then please let me know.
vani
|
|
|
|
|
Hardware registers? Can't be done from VB. You need to write a Ring 0 .DLL, essentially a device driver, accesses that hardware for you and exports functions for your VB code to call. What's stopping you from doing this in VB is the HAL (Hardware Abstraction Layer) of any NT Kernel-based Windows OS - NT4, 2000, XP, 2003, Vista.
You can find an example of this technique here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey guys,
Is there anyway to make a panel scroll when AutoScroll is true? If so, how does one accomplish this? Thanks
Mike
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
hi all;
I need Tutorial or source code to open
web cam on vb.net form (application)
and capture picture form it and save
it ofcourse as bitmap image.
I searched and I didnt found any thing.
THANKS
AMR-CIS
|
|
|
|
|
Look in the windowsmedia sdk documentation, or even directx has some examples.
|
|
|
|
|
How can I enforce Referential Integrity between 2 or more of my DataTables in VB.NET.
Please help with some sample code and oblige.
R. A. Abbasi
|
|
|
|
|
This largely depends on your database schema but you would probably be better off doing this via database triggers and stored procedures rather than in a VB program.
...Steve
|
|
|
|
|
Thanks Steve for the idea. I will appreciate if you would elaborate more on it as I am not very well versed with databases.
Regards.
|
|
|
|
|
I presume this is for an assignment/project? Unfortunately I cannot give you a tutorial on r/i via what I'd consider the best way (i.e. triggers) as it would take too long and I honestly cannot afford to spend the time doing so. Your best bet therefore is to implement the r/i in discrete code in your program.
This definition explains it better than I can. I hope it helps http://databases.about.com/cs/administration/g/refintegrity.htm[^]:
Definition: Referential integrity is a database concept that ensures that relationships between tables remain consistent. When one table has a foreign key to another table, the concept of referential integrity states that you may not add a record to the table that contains the foreign key unless there is a corresponding record in the linked table. It also includes the techniques known as cascading update and cascading delete, which ensure that changes made to the linked table are reflected in the primary table.
Consider the situation where we have two tables: Employees and Managers. The Employees table has a foreign key attribute entitled ManagedBy which points to the record for that employee’s manager in the Managers table. Referential integrity enforces the following three rules:
1. We may not add a record to the Employees table unless the ManagedBy attribute poi
2. nts to a valid record in the Managers table. If the primary key for a record in the Managers table changes, all corresponding records in the Employees table must be modified using a cascading update.
3. If a record in the Managers table is deleted, all corresponding records in the Employees table must be deleted using a cascading delete.
...Steve
|
|
|
|
|
Thanks again Sterve for further help.
I just expect to have a sample Stored Procedure, which implements Referential Integrity. The rest, I may try to manage myself.
Sorry for asking for more of your valuable time.
Best regards.
|
|
|
|
|
No problem. I don't mean to sound too harsh it's just that to provide detailed instructions on this board does take some time to do properly and there are other resources (either on this board or other web sites) that do address your questions. It's just a matter of finding them. I'm very glad to help where I can.
If you have access to the MSDN documentation, it provides some great info on transact-SQL and stored procedures, triggers, referential integrity etc. - most may be available free on the web too. Try a Google search and I'm sure that there will be something in the first few results that may be of interest.
Take your time to learn about the subject properly. It is something that cannot be learnt in one night.
...Steve
|
|
|
|
|
Hello again,
I'm trying to have have a command button that will map drives in vb.net...I have some code that does it...but it uses a command shell to map the drive and if the drive is already in use it does not show an error messsage to say it is not connected...I would also like a message showing that it is connected...I'll show you my code hopefully someone can show me where I went wrong...thanks again guys!
Private Sub btnMap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMap.Click
Dim ServerName As String
ServerName = txtIP.Text
Try
System.Diagnostics.Process.Start("net", "use h: \\" & ServerName & "\c$")
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
Andrew "Wondering where I went Wrong" Kong
|
|
|
|
|
Try this bit of code: (modify to suit your program)
Dim oNet As Object
Dim arrDrives() As String
Try
oNet = CreateObject("Wscript.Network")
'
' GetLogicalDrives returns an array with each entry
' being of the form "X:\" where X is the drive letter.
'
arrDrives = System.Environment.GetLogicalDrives
'
' Detect if it is already mapped.
'
If arrDrives.IndexOf(arrDrives, sDriveLetter.ToUpper & "\") >= arrDrives.GetLowerBound(0) Then
'
' optionally remove the drive
'
'oNet.RemoveNetworkDrive(sDriveLetter)
End If
'
' Map it.
'
Dim s As String = ""
s = oNet.MapNetworkDrive(sDriveLetter, sUNCPath)
'
' Report any errors by throwing an exception.
'
If s <> "" Then
Dim ex As New IOException("Unable to map the " & sDriveLetter & " drive. " & s & " - " & Err.Description)
Throw ex
End If
Catch ex As Exception
End Try
...Steve
|
|
|
|
|
I am getting the error message "Access of shared member or nested type through an instance; qualifying expression will not be evaluated." for the arrDrives.IndexOf line
I set the constant sDriveLetter and sUNCPath as:
Dim sDriveLetter As String = txtDrive.Text
Dim sUNCPath As String = txtIP.Text
but it still has not worked...
|
|
|
|
|
I assure you that code works very well on my system and it is in daily use.
Does the code compile? Maybe there is a typo or you have not included the required libraries?
Try stepping thru it in the debugger and inspect all the parameters to those calls. Something is not in the correct format as expected. Also look at the help files for the various methods and functions being used.
...Steve
|
|
|
|
|
I dont deny that your code works
I was thinking that maybe I'm missing the library...or perhaps the changes I made in the declaration are the problem...definately not typo though
Andrew
|
|
|
|
|
Hi all,
hope you can help me. I'm trying to create a dice roll project. I can't get the images to be randomly generated though. for the second one I tried picturebox instead of label - but I think that was probably wrong too.
any ideas?
thanks,
chris
Private Sub ButtonGooi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGooi.Click
Dim Dice As Integer
Dice = (6 * Rnd())
Select Case Dice
Case 1
LabelSteen1.Image = Image.FromFile(CurDir() & "\..\ds" & 1 & ".gif")
LabelSteen1.Image = Image.FromFile(CurDir() & "\..\ds" & 2 & ".gif")
LabelSteen1.Image = Image.FromFile(CurDir() & "\..\ds" & 3 & ".gif")
LabelSteen1.Image = Image.FromFile(CurDir() & "\..\ds" & 4 & ".gif")
LabelSteen1.Image = Image.FromFile(CurDir() & "\..\ds" & 5 & ".gif")
LabelSteen1.Image = Image.FromFile(CurDir() & "\..\ds" & 6 & ".gif")
Case 2
PictureBox1.Image = Image.FromFile(CurDir() & "\..\ds" & 1 & ".gif")
PictureBox1.Image = Image.FromFile(CurDir() & "\..\ds" & 2 & ".gif")
PictureBox1.Image = Image.FromFile(CurDir() & "\..\ds" & 3 & ".gif")
PictureBox1.Image = Image.FromFile(CurDir() & "\..\ds" & 4 & ".gif")
PictureBox1.Image = Image.FromFile(CurDir() & "\..\ds" & 5 & ".gif")
PictureBox1.Image = Image.FromFile(CurDir() & "\..\ds" & 6 & ".gif")
Case 3
Labelsteen3.Image = Image.FromFile(CurDir() & "\..\ds" & 1 & ".gif")
Labelsteen3.Image = Image.FromFile(CurDir() & "\..\ds" & 2 & ".gif")
Labelsteen3.Image = Image.FromFile(CurDir() & "\..\ds" & 3 & ".gif")
Labelsteen3.Image = Image.FromFile(CurDir() & "\..\ds" & 4 & ".gif")
Labelsteen3.Image = Image.FromFile(CurDir() & "\..\ds" & 5 & ".gif")
Labelsteen3.Image = Image.FromFile(CurDir() & "\..\ds" & 6 & ".gif")
Case 4
LabelSteen4.Image = Image.FromFile(CurDir() & "\..\ds" & 1 & ".gif")
LabelSteen4.Image = Image.FromFile(CurDir() & "\..\ds" & 2 & ".gif")
LabelSteen4.Image = Image.FromFile(CurDir() & "\..\ds" & 3 & ".gif")
LabelSteen4.Image = Image.FromFile(CurDir() & "\..\ds" & 4 & ".gif")
LabelSteen4.Image = Image.FromFile(CurDir() & "\..\ds" & 5 & ".gif")
LabelSteen4.Image = Image.FromFile(CurDir() & "\..\ds" & 6 & ".gif")
End Select
End Sub
Private Sub ButtonResultaatTonen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonResultaatTonen.Click
Dim LetsPlay As New FormToonDobbelStenen
LetsPlay.Show()
End Sub
Private Sub FormDobbel_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
randomize ()
End Sub
End Class
|
|
|
|
|
It looks like you're selecting the Dice at random but you are still loading the image controls in the same order (i.e. 1 thru 6) and the last one loaded will be the one displayed (i.e. "6").
You should be using the Dice variable (or another randomly generated one) to determine the face showing on the selected die.
Check that Dice = 6 * Rnd() will actually return an integer from 1 to 6 (hint: it doesn't the way it is coded now).
Additionally, if you only need to show one dice face this code can be simplified by removing the redundant image control load statements. If you need to show all faces of each die then be aware that opposite sides of the die total 7 (that is to say that 1 and 6 are on opposite sides of the die, as are 2 and 5, and 3 and 4).
...Steve
|
|
|
|
|
Is there any function to calculate z position in vb. We can calculate the x and y axis but how can we calculate the z axis. It is urgent.
|
|
|
|