|
Hi!
I want to develop a small program that has hyperterminal functionality to communicate remotely with a data logger and download file using dial-up modem. Any suggestions or links!!
Thanks
AJ
|
|
|
|
|
Google for and read up on the SerialPort class.
|
|
|
|
|
I have to write code that bounces a blue ball inside the panel. Draw ball using the fillellipse of the class Graphics. The ball should be created and begin moving in response to a MouseClick.
Imports System.Threading
Public Class BallClass
Private colorValue As Color
Private radiusValue As Single
Private xValue As Single
Private yValue As Single
Private dxValue As Single 'x velocity
Private dyValue As Single 'y velocity
Private panelWidthValue As Integer
Private panelHeightValue As Integer
Public Sub New(ByVal BallColor As Color, ByVal BallRadius As Single, _
ByVal BallXValue As Single, ByVal BallYValue As Single, _
ByVal BalldX As Single, ByVal BalldY As Single, _
ByVal BallPanelWidth As Integer, ByVal BallPanelHeight As Integer)
Colour = BallColor
Radius = BallRadius
xValue = BallXValue
yValue = BallYValue
dX = BalldX
dY = BalldY
PanelWidth = BallPanelWidth
PanelHeight = BallPanelHeight
End Sub
Public Property Colour() As Color
Get
Return colorValue
End Get
Set(ByVal value As Color)
colorValue = value
End Set
End Property
Public Property Radius() As Single
Get
Return radiusValue
End Get
Set(ByVal value As Single)
radiusValue = value
End Set
End Property
Public Property dX() As Single
Get
Return dxValue
End Get
Set(ByVal value As Single)
dxValue = value
End Set
End Property
Public Property dY() As Single
Get
Return dyValue
End Get
Set(ByVal value As Single)
dyValue = value
End Set
End Property
Public ReadOnly Property X() As Single
Get
Return xValue
End Get
End Property
Public ReadOnly Property Y() As Single
Get
Return yValue
End Get
End Property
Public Property PanelWidth() As Integer
Get
Return panelWidthValue
End Get
Set(ByVal value As Integer)
panelWidthValue = value
End Set
End Property
Public Property PanelHeight() As Integer
Get
Return panelHeightValue
End Get
Set(ByVal value As Integer)
panelHeightValue = value
End Set
End Property
Public Sub Run() 'makes ball move
While True
Thread.Sleep(10)
If (xValue + Radius >= PanelWidth) Or xValue = 0 Then
dX = -dX
End If
xValue += dX
End While
End Sub
End Class
Imports System.Threading
Public Class ballForm
Private ball As BallClass
Delegate Sub ReDelegate()
Private Sub FrmBallTest_MouseClick(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles BallPanel.MouseClick
'colour, radius, x, y, x-velociy, y-velocity, panel width, panel height
ball = New BallClass(Color.Blue, 15, e.X, e.Y, 1, 1, BallPanel.Width, BallPanel.Height)
Dim drawThread As New Thread(New ThreadStart(AddressOf Me.Draw))
drawThread.Start()
Dim runThread As New Thread(New ThreadStart(AddressOf ball.Run))
runThread.Start()
End Sub
Private Sub FrmBallTest_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
BallPanel.Width = 200
BallPanel.Height = 200
End Sub
Private Sub FrmGUIThreads_FormClosing(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.FormClosingEventArgs) _
Handles MyBase.FormClosing
System.Environment.Exit(System.Environment.ExitCode)
End Sub
Private Sub Draw() 'draws ball every 20 ms
While True
Thread.Sleep(5)
Dim b As Graphics = BallPanel.CreateGraphics()
b.FillEllipse(New SolidBrush(ball.Colour), ball.X, ball.Y, _
ball.Radius, ball.Radius)
b.Dispose()
BallPanel.Invoke(New ReDelegate(AddressOf BallPanel.Refresh))
End While
End Sub
End Class
My problem is the ball is moving vertically Its not moving up and down
Thanks
|
|
|
|
|
rbjanaki wrote: My problem is the ball is moving vertically Its not moving up and down
Your code has a lot of problems: you should not unnecessarily use CreateGraphics, you should not draw stuff outside the GUI thread, you should not use Thread.Sleep() inside a painting method, and you should use a timer (preferably a System.Windows.Forms.Timer), to name a few.
Here are some articles you should read:
- crossthreads1[^]
- animation1[^]
PS: as your code doesn't change yValue, the ball will never move vertically.
|
|
|
|
|
Hi, I have a question on what the proper way to remove a installed program from a computer is. If i go to the control panel and use the add/remove programs, it will remove the program, however, if i create shortcuts to that program, those remain on the computer. Is there a special uninstall program function that comes with visual studio maybe? or is there a way to remove all files associated with the program? I would like the user to be able to simply push a button and everything that was installed with the program, shortcuts, files. If anyone can help me with this, it would be greatly appreciated.
Thanks,
|
|
|
|
|
If your installation creates the shortcuts and so on then un-installing from add/remove programs will remove the shortcuts.
If the end user manually creates shortcuts later on then there nothing you can do as part of the un-install process to find them and remove them. They could be anywhere, and named anything, and are totally out of your control.
However, if your installer is creating the shortcuts programmatically then your uninstall code should be written to remove them programatically. Sloppy [rogramming to leave them behind.
|
|
|
|
|
Well there is a function in the program that when you push a button, it creates a shortcut in the start up folder. If I remove the program while the shortcut is in the startup folder, it doesnt disappear. I guess I am wondering, how do you make an uninstall program for an application?
Thanks
|
|
|
|
|
That depends on where the icon is put. If it's in the All User Startup folder, you can remove it. If it's in the Users Startup folder you have to leave it there. Why? Enumerating every users Startup folder is time consuming and, depending on who's doing the uninstall, the uninstall will not have permissions to see everyone's Startup folder.
|
|
|
|
|
Well all the uninstall program would need to do is see the current users startup folder. I dont know how to go about creating an uninstall program to uninstall the program. How would i do that?
|
|
|
|
|
You don't have to write another program to uninstall the app. You just add the .LNK file to the RemoveFile table in the .MSI using Orca or some other .MSI editing tool.
|
|
|
|
|
Okay so now i downloaded orca so i can edit the .MSI but now i need to know how to get the .MSI file. Does visual studio automatically create one? If so, how can i find it, if not how can i create one?
Thanks for your help, I really appreciate it.
|
|
|
|
|
Uhhh...you already said you have an installer. What is it?? VS does NOT create an .MSI automatically. It's a project you have to add to your solution that gets compiled using the outputs of your main project. Express Editions of VS do not have this option.
Or you use some third party packaging software, like InnoSetup or Wise Package Studio, to create the .MSI.
|
|
|
|
|
I am new in Programming Friends, Needs help in coding a Simple API.
My Target Window is :
Msn chat Window
Project is:
I want, if the user i am chatting with, sends me Hi, From me the API Should send "hi aswell" in return But it should be automatically.
Codes Needed :
What API Function code can get the hWnd of Msn chat window which is running?
After i got hWnd of targeted window, Then what API Function code can retrieve text from that Msn chat window Using the hWnd of it i recently got?
After i got the retrieved text, "Hi" What API Function will be used to Send auto command "Hi aswell".
Hope you friends understood. Please help.
Thanks in advance.
|
|
|
|
|
n0dy wrote: Project is:
I want, if the user i am chatting with, sends me Hi, From me the API Should send "hi aswell" in return But it should be automatically.
There's an easier way to achieve this, by creating a plugin[^]. You might also be interested in the Bible[^] that CP hosts here.
I are Troll
|
|
|
|
|
n0dy wrote: Friends
I chose my friends myself.
This 'project' sounds very much like one of those viruses circulating on msn.
Nobody is going to help you write anything that could potentially hurt pc users.
So unless you can provide a very good reason why you would want to do this, your not going to get any help.
|
|
|
|
|
n0dy wrote: Need code
This is NOT a good way to ask for help. If you want code written for you, go to RentACoder.com and have your credit card handy. By the way, you get what you pay for...
This is a very advanced topic for someone who is new to programming. What have you done so far? If nothing, see my first point.
|
|
|
|
|
n0dy wrote: Needs help in coding a Simple API
So go and write it and come back with specific problems - if you ever get that far, otherwise try rentacoder and pay for it.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
|
Hello every body:
I want to change the buttons backcolor, when I press it
|
|
|
|
|
|
That's nice. Let us know how you get on when you use the Click event and the BackColor property.
|
|
|
|
|
|
I'd love to help you on this, but you forgot to mention to what colour you want to chance. Therefore I see no chance to be of any help.
|
|
|
|
|
i use VB 6.0 with MS Access as a database. With the insertion in table1 i use to update a counter (N+1, ....) in table2. but some time table2 does not update its value and repeat the previous value. e.g if previous value is 2854 then it should be updated to 2855
Help please
|
|
|
|
|
It would be difficult to answer your question without looking into your code.
|
|
|
|