VS 2008 Multithread With Comm (bass Visualisation)?
Jan 21, 2010I have a thread executing the following:
vb
Do UpdateVis()
System.Threading.Thread.Sleep(Interval)
Loop
UpdateVis is as follows:
[Code]...
I have a thread executing the following:
vb
Do UpdateVis()
System.Threading.Thread.Sleep(Interval)
Loop
UpdateVis is as follows:
[Code]...
Visual Studio Just-In-Time DebuggerAn unhandled win32 exception occured in test_project.vshost.exe[3216]
code :-
Imports System
Imports Un4seen.bass
[code].....
I am trying to successfully multithread a piece of software I have been working on. I have an array of threads 'gen' already working, calling to a method taking a single integer as a parameter (done via typecasting).Now in this thread, when the function gets processed (for each thread a roughly 500 iteration while loop) the index seems to be getting mixed up. As far as I can tell, my threads are messing with eachother and warping values. Now this is happening in locally declared variables inside this function, not global variables.It may be useful to know that I am using a WebRequest via a call to another method. Don't know if that makes a difference or not.
View 7 RepliesI'm trying to manipulate something that is in a different thread, and I know I need to do something by the way of Invoked procedure, but I'm unclear on how. I looked up some examples here on the forums and tried to follow the basic template, but I continue to have the same problem. how to use invoke correctly.
Private Sub getMessage()
For Me.infiniteCounter = 1 To 2
'Try
[CODE]...........................
I currently have a browser go through the same list of sites one by one and gather updates. The problem though this takes awhile. Can a browser be multithreaded, (so it could visit several sites at a time) and if so would this take up a lot of server resources?
View 2 RepliesI am doing this within a thread:For Each item As ListViewItem In lvUsers.Items and I am getting: Cross-thread operation not valid: Control 'lvUsers' accessed from a thread other than the thread it was created on.I have been able to adjust a control in a way using something like:
Public Delegate Sub ListAddNameInvoker(ByVal text As String)
Public Sub ListAddName(ByVal text As String)
If lvUsers.InvokeRequired Then
[code]....
But how do I get data from a control and pass it to another thread?
Basically I need to send the hex command FA through a COM port.
I have added the com port and set the baud etc and all seems to be working well there. I am just a little unsure how to send the correct hexadecimal command. For example,
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SerialPort1.Open()
[Code].....
What are the possible handshaking protocol available using COMM-DRV for communication through MODEM
View 5 RepliesI have been writing a COM callable assembly for my current solution allowing unmanaged code some access. I have just been told that I can now start using 3.5 of the framework having used 2.0 for some time.I then came across WCF and was wondering if I could use any of this to create my application api and allow access from anmanaged code.
View 1 RepliesI'm making a type of download manager which downloads parts of a file using HTTPREQUEST.addrange. The parts download without a problem and currently I use 5 instances of the same class to download the parts simultaneously each one downloading a different section of the file. Now my problem is that I don't want to save each part as a file then merge them later, I want to use a singular filestream and append everything asynchronously. In the code below I attempted to use the seek method but it feels like it changes the seek for all of the other parts as well.
[Code]...
how do I multithread using timers. For instance 3 picture boxes that change ever 3 seconds?
View 1 RepliesI have client/server app.I have a class for the tcpclient and a class for the tcplistenerIn my tcpclient class I have a system.timers.timerThe timer elapsed event fires a public event(in the tcpclient class) which the tcplistener class handles.During debugging I see the timer firing its elapsed event and calling raiseevent on the public method, yet the event is never fired in my tcplistener class.
View 1 RepliesI'm working on a project. It is a windows form app which has a webbrowser. The app navigates to a url automatically, checks the url's document, and jumps to another url (depends on the document). It works fine. But, now, the problem is the project needs check many urls, so, I'm trying to make it as a MDI form project. when the start button clicked, it create a control thread, in the thread, it launchs 10 MDI forms (within main form), each form does the work for different urls. once done, then launch the next 10 urls.
It works. However, I noticed that, although 10 MDI forms are open, the navigating part in their webbrowser seems run in sequencial. I thought these 10 MDI forms will load 10 urls at the same time, do the work at the same time, but I found that it seems they do load urls one by one, not at the same time.
so, I did some research, it seems webbrowser can only be run STA mode. does it mean I can not use multithread to load different urls at the same time?
basically, I want to have a multi tab webbrowser, and navigate to different urls in these tabs at the same time.
Is it possible to create a logical serical port in vb that another application can open and read/write to?
View 2 RepliesI currently have software that sends out plain text(i.e. 'X') to comm 1 port and was wondering if there was any way to capture that plain text and also respond to that port on the same compute as the port without having anything plugged into the machine (i.e. 9 pin serial cable). I am trying to avoid buy any more hardware as this is an objective to acutally cut down on hardware.
View 1 RepliesWe working with a Modem type interface that use's the Comm port for two way communication. The App starts and sets up the Comm port, and sends config info to the 'Modem'. Trick here is you have specific timing issues that need to be considered, and we got it all sorted, by using Threading.
You send The Config command to the modem and wait X ms for the confirmation reply (Single Byte), If no reply, send a Wake up command, wait X ms and send Config command again. Once confirmed that the modem is in config mode, send parameters, Waiting for confirmation of each one. Once config is set, send the 'Return to normal mode' command and wait for confirmation. [Code]
The SwitchModemMode sub runs under the Comms thread and not the main thread, like the Checkmodem sub at the top. Mostly because the Comms thread Raises the Data Event, which in turn calls the SwitchModemMode. Now because of that the Thread that is supposed to be checking for the input and setting the Flag, is actually the one waiting for the Flag to be set. And Yes App.DoEvents could solve it here, however that can/will mess with the Timing needed with these commands. I'm looking for how to pass the Raised event to the Main thread.
I used microsoft com control 6.0 in the application for sending data to the led control
MSComm1.EOFEnable = True
MSComm1.SThreshold = 100
MSComm1.InputLen = 0
[code].....
the differences between multi threading and background worker and when I should be using either.
View 3 RepliesOn this piece Of code I want to multithread, beginning where the for loop takes the data out of the array arydata. The threads would all do the same task.
View 1 RepliesVB and programming on Windows as such. Mostly c++/gcc/linux. I am trying to build this VB app that shows a streaming video from a camera and that needs to be overlaid with some custom graphics and text. I used the code published here: [URL] to get the capture part to work. It essentially uses the avicap32.dll that most of you would probably know.
My plan:
1) Capture frames using SendMessage(windowHandle, WM_CAP_EDIT_COPY, 0, 0) and then copy from clipboard.
2) Do whatever graphics/text overlay on the obtained bitmap
3) send it to some picturebox on some form that is being shown
4) Do step 1 to 3 in a loop by a spawned worker thread.
Firstly is this a reasonable way to do what I want? or is there a much more efficient/easier way to about?
Now the specific problem: From my main thread directly if I do step 1 to 3 once UIComponent.DrawImage(VideoComponent.GetBitmap()) It shows me once captured image as it should and all is good.
Just to clarify: UIComponent is an object/instance that launches the Form and owns the picturebox I want to display on. VideoComponent is an object/instance that has started the videocapture and owns the picturebox to which the video is being captured. But if I wrap the same call above in a function and launch a thread that would start with that function as its starting point, I see a blank screen. Again, for testing purpose, I am only doing step 1 through 3 just once.
The thread part of the code is like this:
Private drawthread As Thread
public sub main()
drawthread = New Thread(AddressOf threadfunc)
[CODE]........
Now I know whats going to happen, I will post a request for code syntax and one of the admins is going to say that I need to post the code I already have. The code I already have is irrelevant to what i wish to do. So, continuing on; I have a micro controller that i wish to send commands to it in HEX data type. Communication is via the serial port RS232. (well technically its through the USB to serial converter)Steps:
1) Sending a "001" tells the micro controller to await instructions as to what to set the duty cycle to
2) The data that follows i.e." 050, 010, 185 " will be added to 400 (by the micro controller) to come up with a duty cycle based on a 10 bit resolution of 0-1024. I am only going to be using the range of 401- ~500.
I can communicate with the micro controller via hyper terminal. Using the Alt + #keys method I can transmit data to the micro controller, and this is what i with to do with vb.net.[code]
I have an older VB6 application which uses a scanner on the COMM port and does the following... (I have been tasked with re-writing it in ASP.NET (VB)...
OLD APPLICATION...
1. reads a Scanner and loads the data onto the PC
2. FTP's the data file to a SQL Server (where a small app picks it up and processes it)
3. Deletes the data from the scanner[code]...
I'm debugging a VB app where I'm using a comm port attached to a bluetooth radio paired to another bluetooth radio in order to communicate with a remote barcode scanner. The pair of bluetoooth devices basically work as a serial cable replacement. Sometimes it works fine, but after a while I get an UnauthorizedAccessException message which breaks the program (see attached jpeg).
I only get this when I use the radios and not when I use a direct cable. I wonder if it has something to do with other bluetooth devices nearby trying to communicate with mine. I've used the .NET Framework 2.0 Confuration tool to adjust the zone security to give full trust to MyComputer, so I don't think it has to do with security, but I'm really going beyond my area of expertise here. I don't know what's going on.
[Code]...
I have this situation: a Form with a System.Timer in it (with AutoReset = False). The form has its main thread and the timer its own thread too (nothing new here). When the user press a button I need to stop the timer, wait until the timer thread has stopped its execution and do something more.
On the other side, the timer updates an item at the form so BeginInvoke is used. The code looks like this:
Button Code: Private Sub ButtonStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonStop.Click
[Code]...
The point is that I wait the main thread to let the timer thread to end its work.The problem is that this code deadlocks when the user clicks the button when the BeginInvoke is going to be called. How a simple thing like this one can be done? Looks like I cannot find a good solution to this problem
SERVER
Im using this code:
Imports System.Threading
Imports System.Net.Sockets
[code]....
but when i tried to run the application, it hangs even if i wait several minutes.., is there something wrong with the code..
I have a multithread program and in a thread i read a stram from ftp server and write them to a file and close it and in another thread open saved file and read it for process.but sometime when i want to open saved file i receive a error that say : cannot open file , because another user open it .i create 2 filter that surly file saved and closed , but i don't success.
View 5 RepliesI did a search for "How do I implement Serial COM Port communications? and found a response by Xiaoyun Li which was last posted on April 10, 2009. Xiaoyun's response included sample code. My intent has been to get a clean compile on the sample code, then test it, then expand the code into a real application. I am down to a single error message, which I can't figure out how to resolve: "Method 'Public Sub DoUpdate()' does not have a signature compatible with delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'." [code]I marked where the error occurs in the code with *** to the right of the error line.The code is attached to a simple form, Form1 which contains a single text box, TextBox1.It appears to me that the code needs a Delegate statement, but I can't figure out how to code it or where to put it.d.
View 3 RepliesI am getting scale values from a comm port into a richtextbox control, now as long as the connections and the scale is working great scale readings continuously flow into the control all the time, however when the connections or the scale is turned of the label that displays the weight will give a message saying error.
After 5 seconds I want to be able to give the operator the choice to take scale readings manually. This is my code so far.
Private Sub tmScaleTimer_Tick(sender As System.Object, e As System.EventArgs) Handles tmScaleTimer.Tick
If rtbDisplay.Text.Length = i Then
[Code].....
how do I restart the timer if the interval has elapsed
May I know instead of using WriteLine(MyTextBox.Text) to send data to a serial port, how do I send character by character? Use BaseStream.Write?
Now:
Dim ComLine As Ports.SerialPort
ComLine.WriteLine(MyTextBox.Text)
I am writing a VB.NET app that has a piece which needs to send a small command to comm port 2 and get the return result. The problem is .NET doesnt have any support for serial communication seems like.
I just need to send the command "headtype" and get the result.