|
Having used parallel, serial, usb and all sorts of input/output cards or serial/usb-to-**** add-ons, including building my own, I've not come across anyone trying this. Not saying it can't be done but one function of the 'interfacing' circuits you say are not necessary is to protect your PC/laptop from damage. A relay will require an external power source which if wrongly connected could damage your LAN port and perhaps more. I recommend you get for a USB-to-serial or USB-to-IO converter instead, there's a lot already done with and written about using these.
|
|
|
|
|
That's a very VERY BAD IDEA!
Controlling a relay without external hardware is just going to KILL whatever port you plug it into.
There is a reason why you see capacitors and diodes sitting on the control pins of a relay. This is to prevent power from going backwards INTO the pins you attached it to.
Do yourself a HUGE favor and di it correctly. Get yourself some kind of external controller, like a Netdunio, Arduino, or a Phidgets controller and connect the relay to that. You can talk to those controllers and have them do the work instead.
Don't tell me you can't afford them either. They are VERY cheap compared to the cost of replacing the motherboard in your laptop.
Oh! And DROP VB6 right now. Do yourself a favor and get VB.NET instead. VB6 has been dead for quite a long time now. By using it you're just doing yourself a disservice by letting it teach you all kinds of bad habits that you will have to unlearn when you finally do upgrade. The Visual Studio Express editions are FREE and can be found here[^].
|
|
|
|
|
hi guys ..
there are big misanderstand
i'm not said that i will not using protection circuits
i said dont need interfacing circuits such as ICs ... etc
just one pin gives (1 , 0) to control something .
|
|
|
|
|
|
You don't get it. First off, you don't have direct access to the pins. Well, at least not without a very special driver being written.
Second, you WILL burn up the chip you connect this relay to! You MUST MUST MUST use protection circuitry in order to prevent this.
Why? A little grade-school science... What happens when you run electricity through a wire?? You get a magnetic field surrounding the wire.
Great! Now, what happens when the electricity is taken away from the wire?? The magnetic field goes away, right? Wrong! The magnetic field COLLAPSES and during this collapse, it generates electricity in the wire!
Where do you think that power goes if the only thing you have connected to it is your precious Ethernet chip??
YES YOU NEED PROTECTION CIRCUITRY!
You've been warned...
|
|
|
|
|
If you read my last post you will find whom dont got it
i said ok , yes i must use protection circuits
my question out of its purpose , as a result of these posts
you absolutely dont understand what i mean
and now we discuss protection instead of control and signals .
|
|
|
|
|
I don't know about your previous posts, nor about any previous conversations you've had here. Never assume that everyone knows your own personal history on any site. It would have been nice if you brought that up in your original post to this thread.
As you've already been told, you need to write a very custom driver to expose the pins on the Ethernet port. This is something you're not going to do in a managed language like C# or VB.NET. You can start by going here[^] and start reading.
|
|
|
|
|
to make the idea much clear and what i exactly need
there is two Leds attached to the lan port , one of them is TX data
which is green color , if i can just get like that signal
then my problem would be solve .
|
|
|
|
|
Well as I suggested earlier, it's easy. You just need to write a LAN driver that will act on your commands.
Veni, vidi, abiit domum
|
|
|
|
|
can you tell me how ... please
|
|
|
|
|
|
not writing driver .. just using existing one
for example 'Realtek RTL8168D/8111D Family'
sure with Visual Basic .
|
|
|
|
|
Then you need to get a copy of the driver documentation which will explain it. I would suggest using Google to search for sample programs or tutorials on this subject.
Veni, vidi, abiit domum
|
|
|
|
|
Considering what you're doing is very much outside the functionality exposed by those drivers, this is not an option for you. You MUST write a custom driver for this.
Like I said in my first reply, it is FAR easier to do this with a microcontroller.
|
|
|
|
|
Here need use specialy chip like ft232rl. For exsamlple Look : http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232R.pdf
|
|
|
|
|
Code the click event of the Play Game button to do the following
i. Generate a random integer between 1 and 100
ii. Code a loop that will end when the user guesses the number or 10 guesses have failed to find the number.
iii. Use an inputbox function so that the user can enter each guess.
iv. If the user does not enter an integer number display an error messagebox, show the answer, and exit the loop. If the user enters a number outside the range of 0 – 100 display an error messagebox, show the answer, and exit the loop.
v. Show each guess in the Guesses Label using concatenation.
vi. If the guess is incorrect change the message portion of the InputBox function to “Guess Higher” or “Guess Lower”. Hint: Only use one InputBox – not three different ones.
vii. Use a messagebox to inform the user that the correct number has been guessed or that ten guesses have failed to guess the number.
|
|
|
|
|
Please do not dump your homework assignments here in the hope that someone else is going to do your work for you.
Veni, vidi, abiit domum
|
|
|
|
|
Is that a contribution to the "Training Questions for Students (Beginner Level)" section (which is still missing on CodeProject)?
|
|
|
|
|
Here more than couple of ways to learn anything in Internet.
Education Needed[^]
thatrajaNobody remains a virgin, Life screws everyone
|
|
|
|
|
Hi,
I posted this in general questions and then realized I should have posted it here. I have a large vb6 app that I turned into a dll so I could run it from vb .net. When I run the vb6 & .net projects in debug everything works fine. If I open the forms non modally everything works fine all the time.
However when I compile the vb6 into a dll the vb6 forms are not being placed in the .Net container form when I open them modally (non modal is OK). The vb6 form just sits in the upper left of the screen.
I came up with this solution based on an article by Eduardo Campano on embedding vb6 forms in .Net applications from July 2007. Great article and a good idea if you have a million lines of code to convert to .net.
I have sample code but don't see how to upload it to the forum.
The code for loading the vb6 into the container is from the container load event in .net:
SetParent(mintFormHandle, Me.Handle.ToInt32)
SendMessage(Me.Handle.ToInt32, WM_NCACTIVATE, 1, 0)
SetForegroundWindow(Me.Handle.ToInt32)
LockWindowUpdate(0)
Such a Larry
modified 24-Oct-13 11:17am.
|
|
|
|
|
larry118 wrote: Great article and a good idea if you have a million lines of code to convert to .net. Calling VB6 code from VB.NET is not a conversion. It's merely building another layer on something that should have been retired a few years ago.
What does "sit there" mean? Does it still process messages? You can test if it is by dragging another application over it - if a white smear appears, then the paint handler is no longer being called. I suggest you turn your DLL back into an executable; that's the easiest way.
Outside of that, the recommended way to use legacy code would be by using the InterOp Form Toolkit[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yes of course the best thing would be to convert the code but its not going to happen right away when there is so much code and so many customers and users (100's).
By stripping the vb6 forms borders and putting them in a .net wrapper we get a really nice look in Windows 7 & 8 and now we have more time to properly analyze and convert the remaining code and marketing can demo an upgraded look and feel to the application.
As far as sit there. The vb6 form is frozen but you can drag stuff over it without a paint problem.
I wish I could upload the code.
Larry
Such a Larry
|
|
|
|
|
larry118 wrote: I wish I could upload the code. VB6 has been dead to me for a few years.
larry118 wrote: and now we have more time to properly analyze and convert the remaining code and marketing can demo an upgraded look and feel to the application Microsoft extended support ended in 1998. Your excuse was valid until 2007.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Larry you have my sincere sympathies, imagine working for an organisation so forward thinking that they don't plan for an end of life on their development platform. Then wait 6 YEARS after the end of support to attempt to remedy the situation.
To top it off the development is now being driven by the marketing departments need to show of a new look and feel. You really should submit your situation to WTF it sounds like a classic to me!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
These are really good people. I like them and don't mind being responsible for converting the code. I have made some progress on this issue. The setparent now seems to be working. The vb6 form is now appearing in the .net container. The problem was passing the parent from vb6 and that is now handled.
So setparent works now but it's followed by a send message, setforegroundwindow and lockwindowupdate which appear not to be working. My declarations are as follows:
<system.runtime.interopservices.dllimport("user32.dll")> _
Private Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Int32
End Function
Public Declare Auto Function SendMessage Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal s As String _
) As Int32
<system.runtime.interopservices.dllimport("user32.dll")> _
Private Shared Function SetForegroundWindow(ByVal hwnd As IntPtr) As IntPtr
End Function
<system.runtime.interopservices.dllimport("user32.dll")> _
Private Shared Function LockWindowUpdate(ByVal hwndLock As IntPtr) As Boolean
End Function
and the code is:
SetParent(mintFormHandle, Me.Handle.ToInt32)
SendMessage(mintFormHandle, WM_ACTIVATE, 1, IntPtr.Zero)
SetForegroundWindow(mintFormHandle)
LockWindowUpdate(0)
Me.Refresh()
Any suggestions?
Such a Larry
|
|
|
|