Click here to Skip to main content
15,881,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dears,

i am working on ocx file for Excella Magteck machine.I have to call a method OpenDevice inside the ocx file that takes machine full name as parameter and returns int as return type if return 0 this means that machine is connected successfully and the machine name exists but while the machine name doesn't exists instead of return another number the application not responding i wait for it about 3 minute with no response so the question is:

how can i set timeout for calling the OpenDevice method that is inside the ocx file


C#
returnValue = excella.OpenDevice(strCurrentDeviceName);


thanks...
Posted
Comments
Johnny J. 16-May-13 9:36am    
OCX? In .NET? Are you sure you're not talking about VB6?
Sergey Alexandrovich Kryukov 16-May-13 11:03am    
Even though OCX is old trash, it's possible to use with .NET. I'm not sure it it makes sense...
—SA
Johnny J. 16-May-13 11:06am    
USE, yes. But the OP was writing that he has CREATED an OCX in .NET ("i am working on..." rather than "i am working with..."), and THAT sounds quite unbelievable unless he's actually using C++ rather than C#
Sergey Alexandrovich Kryukov 16-May-13 11:29am    
All I can see is "working on", which might mean anything. Creation of OCX would sound quite weird, indeed.
Please see my comment below...
—SA
youssef.obeid 16-May-13 10:46am    
no it is C# windows (framework 4.0) but because the dll is not COM so i can't add reference to it so with the machine they support us with the dll and the OCX so i have added the OCX to the components instead of adding the dll using (invoke the dll) because if i invoked the dll i should invoke every method inside it so OCX way is easiest...thaks ??Johnny..

1 solution

If I understand you correctly, you simply want to timeout your call to the method in the OCX? ... use System.Timers.Timer

ATG
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900