Yes correct, in my initial post I realize that the threads were behaving exactly as they should and just ended when the variable broke the workers out of the Wloop.
Basically, I want the two workers threads to constantly be running, and then when the shared variable is set to true they then start doing work. Then when the user clicks the button again the worker threads "pause" and wait for the next time the variable is set to True.
The "IsActive" name was just an abstraction. I use a much more detailed name in my actual code.
In regard to the "TemporarilySuspended" flag and AutoResetEvent, could you provide some examples, would love to handle that properly.
I'm may throw up because I'm supporting a V6 user, but you have to dig out the manual on the printer and get the character sequence to send to the printer to tell it to cut the receipt. Then you modify your code to send that character sequence when your receipt printing code is done.
.NET cannot target building a true ActiveX component. You've built a COM-exposed library. I have no idea if Smart Install Maker handles .NET assemblies properly and regsiters them. You'll have to contact the people that make Smart Install Maker for that.
Hi all, Hope someone can help with this...
I wrote this code several years ago and it has worked great in XP. Our department is rolling out Windows 7 and the agency that uses the app I wrote are finally receiving their new Windows 7 systems.
One problem... code doesn't work any longer.
The code sets up a DSN entry on the fly. In XP, a standard user without any elevated rights could run the app and this code worked.
Now in Windows 7 when installing, I have the end user setup as local administrator and the app fails to Create the DSN. If I go in and right click on the "Click-Once" setup.exe and select "Run as administrator" it works. Also if I create a shortcut to the setup.exe and change the advanced settings to "Run as administrator" it also works from that shortcut.
If I use the icon created by the program from the "Start" menu or from the desktop, which doesn't have an option to "Run as administrator", even though the client is setup as local administrator, it kicks an error that it can't create the DSN. I can delete the DSN and see when it is created and when it can't and it coincides with the trials I've listed above.
Is there something I can put in code that allows it to work no matter if administrator or if a standard user, like it did in XP? Some google posts talk about UAC causing the problem, but just say they recommend to run as administrator.
I've searched google and code project, and most articles / posts seem to be from 2004 or around that time. We're using VS 2010... Is there a better way to creat the DSN's on the fly with VS 2010?
Here is the code
Public Declare Auto Function SQLConfigDataSource Lib "ODBCCP32.DLL" _<br />
(ByVal hwndParent As Integer, ByVal fRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer<br />
Private Const ODBC_ADD_SYS_DSN As Integer = 4<br />
Friend Shared Sub Create_DSN_For_Crystal_Reports()<br />
Dim attributes As New System.Text.StringBuilder()<br />
Dim returnCode As Integer<br />
attributes.Append("Description=DSN added via code from Beneficiary System")<br />
returnCode = SQLConfigDataSource(0&, ODBC_ADD_SYS_DSN, "SQL Server", attributes.ToString)<br />
If returnCode <> 1 Then<br />
Throw New Exception("DSN could not be setup to allow Crystal Reports access - Contact Programming Staff")<br />
End If<br />
Catch ... <br />
End Try<br />
End Sub<br />
This worked very well in Windows 7 without breaking the app for my XP clients.
I was looking at your profile. Congratulations on all the MVP awards over the years! I don't post much on Codeproject, just a couple questions and a few answers a year, but I believe you've probably answered most of my posts. I see you hit 9 years as of today, March 12th, Congratulations...
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
Last Visit: 31-Dec-99 18:00 Last Update: 31-Jul-21 11:49