Complex Threading - 3-rd Party DLL Which Require Hardware Components And Special Software Installs

Apr 13, 2011

The problem I have is very complex and relates to an 3-rd party DLL which require hardware components and special software installs, so unfortunately, I can't post any code so the problem can be replicated. What I can do is provide a very detailed text description and ask for some opinions...

So, here goes...I'm doing a project that uses an old DLL that exposes functions that communicate with a specialized program and call these all the time. I've imported the functions using <DLLImport> tags. The functions themselves return a int > 0 if it run ok and <= 0 if it failed. Part of the problem is that only one function can be performed at a time and if several commands are activated in short amount of time, the connection to the DLL stops working and all function calls return fails. Initially I've had problems using threading with this DLL until I removed it all (some functions would not perform at all, others returned fails, etc.).

My program communicates with the DLL with no problem... All calls are normally returned and executed and everything works perfect... UNTIL the user clicks a little too fast.

So, the user has a form on which he activates these function calls, and if he doesn't wait long enough for the first call to the functions to end, the DLL connection 'fails', after which the program has to be restarted (reinstancing the class containing the <DLLImports> doesn't help for some reason?).

After a week of testing and GoogleFixing, I've tried almost everything:

1) I've made the functions calling DLLs store a bool variable Working and then wait for that to be free - this didn't help as apparently the connection breaks before even coming to the code, which suggests a threading problem (explained further down)

2) I've tried adding <STAThread> to DLL function declarations

3) I've tried messing around with <DLLImport> attributes

4) I've added SyncLock to function calls

5) I've added a loop with sleep on the calling code to make it to 'wait' for the work to end

All of these didn't help, just showed that the DLL connection fails even WITHOUT repeated calls to the DLL... So, the only thing that did help is disabling the controls starting the calling process on the form...

For example:

CODE:

This is of course a stupid way to treat the problem's symptoms (the source eludes me) and inpractical since the calls are made from about 40 different places in the code and I'd have to disable ALL forms/controls starting this calls to be fully safe, which is nearly impossible in practice.

So, entering any code already causes a problem, which is why I've came to the conclusion that this is a threading problem...

I execute all the function calls from the Main Thread (like I said, all past threading was removed due to problems communicating with DLL), yet for some reason the form keeps the focus and the user can click away (most likely because the DLL is working at the time and the form keeps the focus?), either messing around with the Main Thread or creating a new one which seems to break the DLL.

So, assuming that no one comes up with a magical one-line solution at least answering these questions would be very helpful:

1) Is there a way to fully disable control over the program to the user in a simple way while the code is executing (something like Application.enabled = false)?

2) Can Main Thread be disabled from reacting at other points in the program in some way until a code finishes?

3) How can <DLLImport> lines be restarted if reinstancing the class containing them doesn't help (I'm seeing this as a memory/cache problem of some sort, since after program restart, everything works fine)?

View 2 Replies


ADVERTISEMENT

Create A Program That Installs Required?

Jun 3, 2010

I'm trying to create a program that installs required .dll's for a program due to a clean install.What I need to do is Get a value in the registry and use it for the program files path.. but I've noticed some pc's don't have the same configuration because of the version the user is using. Anyway This is what I have so far:

[Code]...

What I'm trying to do is find a registry key called "SoftInstallPath", if found I need the end of the path to goto the new directory(new_dll) not the old one (dll).. and if "SoftInstallPath" cannot be found.. I need it to find "ProgInstallPath" and use it instead and do the same thing.

View 7 Replies

VS Setup Project Installs For Each User?

Feb 13, 2009

We're in the process of releasing software and i've noticed that our standalone version (Windows forms) reinstalls for each users, the issue for this is that we sell to colleges and generally they install of network shares. When the software tries installing for a user it can't find the network share (e.g. permission denied).

How can i stop the installer from launching when the user launches the software.

Reminds me of how Microsoft Office use to be back in the days of 2000.

View 9 Replies

2008 : Keep Project Settings Through Uninstall And Installs?

Apr 4, 2011

I use Project Setting in visual studio 2008 and everything works correctly and save my information when the application is closed. However the information it lost when the application is Uninstalled. The information is not available with my new install.how to keep Project Settings through uninstall and installs!

View 4 Replies

Can't Produce A .exe File That Includes And Installs The .net Framework

Jan 6, 2011

I've been working creating a few programs in visual studio 10. These work fine on my own PC because I have the .net framework installed. However I need to be able to distribute these programs as a single .exe file download from our website and also as a single .exe file via CD.

Most of the PCs which will be installing my programs won't have .net framework installed and I don't want to force people to have to download the files from the internet (it just seems like so much hassle and I can't guarantee that everyone who wants to install my programs will even have access to the internet).I know that I can set pre-requisites in the publish tab and I have done this whilst setting "Download prerequisites from the same location as my application". I've already downloaded the redistributable files WindowsInstaller-KB893803-v2-x86.exe and dotNetFx40_Full_x86_x64 and I've put the files in the same folder as my project.I then go into the publish wizard and select that users will install the application from a CD-ROM or DVD-ROM. Unfortunately I then get the following errors:

Error 2 The install location for prerequisites has not been set to 'component vendor's web site' and the file 'WindowsInstaller3_1WindowsInstaller-KB893803-v2-x86.exe' in item 'Windows Installer 3.1' can not be located on disk. See Help for more information.ConsumptionCalculatorDraft1

Error 3 The install location for prerequisites has not been set to 'component vendor's web site' and the file 'DotNetFX40dotNetFx40_Full_x86_x64.exe' in item 'Microsoft .NET Framework 4 (x86 and x64)' can not be located on disk. See Help for more information.
ConsumptionCalculatorDraft1

View 5 Replies

Setup And Deployment Project That Installs My Application ?

Jan 21, 2009

I have a setup and deployment project that installs my application. During installation, I create a hierarchy of folders under the C: drive.

However, when I use add/remove programs to uninstall my application, I do NOT want this hierarchy of folders to be removed. How is this possible?

Also, when creating the folders, I set "AlwaysCreate" to True. If one of the folders already exists, will it be replaced with my new empty folder? If so, how can I prevent this.

View 8 Replies

User Installs The Application From The ClickOnce Location?

Jul 20, 2011

When a user installs the application from the ClickOnce location there is a noticeable delay after the install runs to when the program loads. Is there a way to put in a progress screen in this instance to instructed the user that there is still more to come?

There is also another instance when an email is being priocessed, there is a delay between the button click and when the email box displays. Need some sort of motion happening during that time.How is this done and what do I look for? Can I make a module that handles this and then just call it during certain activities?

View 13 Replies

.net - Create Setup, Which Installs Microsoft SQL Server 2005, If Not Installed (with VS2008)

Feb 23, 2011

I want to create a setup which requires Microsoft SQL Server 2005 and .NET Framework 3.5. If this software isn't installed, the Setup should offer the user to install them now.

View 2 Replies

VS 2008 - Program That Creates And Installs A Registry Key Which Changes Default Drive Icons?

Jan 16, 2011

Basically the problem i have is i have made a program that creates and installs a registry key which changes default drive icons etc.

But registry key directories need double backward slashes in the directories, e.g.

What i recieve;
C:exampleicon.ico

What i need;
C:\example\icon.ico


I was thinking sending the directory i recieve to another textbox and replacing '' with '\'. Is this possible?

View 3 Replies

Programs Works Great In The Environment - Installs The Way It Should - But Will Not Start Up When You Double-click Its Icon

Jul 29, 2009

From the exception it throws, it cannot find a critical database file called cakecreationdb.accdb. I am at my wits end over this problem and have been up all night trying to solve it. I am quickly running out of time to do so.

The copy to output is set at copy if newer. I have also tried copy always and still get the same result.

View 3 Replies

Forms :: Listbox - Program That Takes Common Applications And Installs Them Silently Using Batch Files

Aug 21, 2010

I'm making a program that takes common applications and installs them silently using batch files. Someone would select the programs they would want to install and my program will write a giant batch file and execute it to install whatever they want. Heres the problem, After the user selects the programs they go into either one or two lists. Non Silent Installer List Or Silent installer list.

Some programs I have simply won't go silently so from there they can choose in what order they want to install these programs. Then there is a combo box that tells weather you want to install non silent programs first or last. From there you hit add to batch file and it would add everything in listbox1 and listbox2 in order. Listbox1 would contain just the text "MalwareBytes" for example. Along with Novell Groupwise and Firefox. How do I get that to add to the Batch List as a code and in order? So the user wants Malware bytes added first to the batch file. How do I add that to my batch list as a completely different code?

[CODE]..............

View 8 Replies

.net Equivilant To Php's Require()

Dec 22, 2010

I have a list of functions that I'm using throughout my .net application. Is there a way that I can include a file into the pages that require the functions without having to copy and paste the functions to each individual page?

The large majority of pages I've found on MSDN are either toward people who are already familiar with .net to those who have never programmed before and just starting. I haven't been able to find one for people who are versed in programming and just need a list of functions and methods.

View 15 Replies

Does An AddHandler Require Parameters

Oct 31, 2011

I'm trying to add a handler, but as soon as I'm targetting a method that has parameters, the handler fails. This is the simple code:

AddHandler App.Current.RootVisual.MouseLeftButtonUp, RootVisual_MouseLeftButtonUp
Private Sub RootVisual_MouseLeftButtonUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs)

[code]....

View 1 Replies

Why Does Application Require UAC Rights

May 20, 2011

Never before did i realize the neccessity to scrap the User Account Control, other than for reasons it was simply annoying, until i became a developer. I have an application that does nothing more than remove and create files within its own directory. Are you telling me every application that creates local files require admin rights? Surely something is wrong here. Can this not be circumvented? How do other developers overcome this issue?

[Code]...

View 1 Replies

Does Software Require An Access Database

Dec 19, 2009

If I wrote some software that used an access database to store data. If I then gave the code to a third party, who ran this sofware on his Pc. Would the code work , if his Pc did not have the access database installed.I read in some article that this would still work? If this is true, how could this work? If the above software had an form which required the client to input details of an order. When the order details were being processed by the code where would it store them if no access database was installed on that pc.

View 17 Replies

Internet Require Word To Be Installed?

Dec 29, 2010

I'm trying to code a spelling checker into VB.NET 2010.It'll check the RichTextBoxFindandPrint (my version of RTB) control.However the solutions on the internet require Word to be installed. [URl]..

View 26 Replies

SMTP Servers That Require Authentication

Mar 18, 2010

i need to send e-mail's from the iis 6 via smtp server that are 2 diferent machines

i have this exampel but is not working

Public Sub SendMail(ByVal from As String, ByVal [to] As String, ByVal subject As String, ByVal body As String)
Dim mailClient As New SmtpClient(test.MailServer)

[Code]....

View 4 Replies

String.Contains Doesn't Require Parameters In C#?

May 9, 2012

I've stumbled upon this code:

var knownSeparators = new[] { "\", "/", "|", "." };
return knownSeparators.FirstOrDefault(path.Contains);

where path is a string and the return value should be a string as well.

Allthough path.Contains' intellisense suggests a parameter, it works fine without one.

How does this work exactly? Is there any way to copy this behavior in vb.net?

View 1 Replies

VS 2010 .net 4 - Application Seems To Require .net Framework 4 To Run?

Nov 1, 2010

My application seems to require .net framework 4 to run. Hence not working on standard XP installations until .net 4 is installed. How do I make it so that it only needs 3.5, or whatever XP uses natively?

View 5 Replies

Deployment :: Dll Files Require Dependencies To Be Identified?

Nov 22, 2009

I am trying to create a setup deployment file, but some dll files require dependencies to be identified.

View 1 Replies

Make Program Require A Registration Number To Run?

Dec 21, 2009

Make program require a registration number to run?

View 4 Replies

Require Each User To Have A Unique Id - Adding New Users ?

Aug 15, 2011

For my user system, I require each user to have a unique id. The reading in and saving of the user data is all done, but now I'm focusing on adding new users. In my add user dialog, I have the information fields required to create a new user, one of which is the ID (which must be unique). For this I have created a function that I thought would always give a unique id but it does not. paste the code below:

Function getnextuserid()
Dim id As String
Dim unique As Boolean

[CODE]...

View 2 Replies

Use VB 2008 To Create An App To Work On A Computer That Does Not Require .NET 2.0+?

Jul 9, 2009

Is there any way to use VB 2008 to create an app to work on a computer that does not require .NET 2.0+? If there is no way to install .NET on the target computer, is there any way to write the app in such a way that it works on the computer?

View 12 Replies

English IDE Setup Project Installs English .NET Framework Even Though Localization = German?

Apr 30, 2009

I'm facing a major problem with a Deployment Project I created to install one of my applications.I am using the ENGLISH IDE of the Visual Studio 2008 - even though my end users will have German environments. This is why I set the

Localization = German

Property in the Deployment Project's Properties. The UI of the generated setup is German, so all's fine there. However, the setup installs the ENGLISH .Net Framework. I have not found any way around this.The problem are at least twofold:

1. An English Framework on a German PC might cause instabilities.

2. It's a big flaw to see UI inconsistencies (i.e. the UI and Setup of the application is German while the NET Framework shows certain elements in English, e.g. the DisplayName property of cultures)how can I get the project to install the localized .NET Framework?

View 4 Replies

Asp.net - ASP.VB Complex IF Statement?

Jan 20, 2012

I'm getting an intellisenxe error saying that the statement below is expecting a ')' and is positioning the correction ater the parenthesis following "Approved". I'm not familiar with this IF syntax and I can't seem to make the correction; trial and error isn't working ;o)) If (reader.Item("Approved"), True, False) = 0), (reader.Item("DoNotDisplay"), False, False) = 0)) Then

View 2 Replies

Application Targetting FW2 Appears To Require FW2SP2 Occasionally?

Mar 13, 2012

I have an application written in VS2010 that targets FW2.0..It has no dependencies other than the framework.The application runs fine on the local drive.But one user tells me that he already had FW2.0 installed but had to install FW2.0 SP2 in order to get the exe to run if it was placed on a network/shared folder? Why would running from a server/shared folder make the application crash if Sp2 wasn't installed? some network/path error that was was fixed in SP2 that doesn't affect the app when running off the local C drive ?

View 1 Replies

Create A Executable File Which Did Not Require The User To Install?

Jun 20, 2011

how I can deploy my .NET applicationwithout the user having to install the program.i.e. In VB6, I could just create a executable file which did not require the user to install anything, they would simple run the program.

View 6 Replies

Documentation :: FxCop Or Other Util To Require Inline Docs?

Dec 11, 2009

I'm starting a new project; trying to be more strict than previous ones. I've set warnings as errors in the build I've added FxCop to PostBuild. The one last thing on my list os require people to add inline docs for all classes/non-private methods/properties.

View 2 Replies

Require Source Files To Exactly Match The Original Version

Dec 7, 2009

I have the code

[Code]....

Then while the box pop up I click No button, the program should exit sub but actually it is not. The code looks stick somewhere else. hat I found is that PHP

[Code]....

View 2 Replies

VS 2010 Cannot Get The Source Code Of Sites Require Login

Dec 28, 2010

Almost every site have to login to see more the pages of the sites Now my problem is I can not get the source code of sites require login... So my question is how can I connect to site and get the source code (link requires login)

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved