|
Hi,
who is calling Init ? some constructor ?
is it a first time call ?
has MyObject class already been called (hence compiled by JIT) ?
Any chance MyObject can not be found at run-time (separate DLL maybe ?).
Please show code for MyObject (at least: members and constructor).
|
|
|
|
|
Init is being called by the Start event of the main class for the app.
It is a first time call.
MyObject has not been called before but I have left the app for 10 mins and it is still hung so I would think it unlikely it was the JIT compiler.
I would expect to see an exception if the class could not be found rather than the app hanging but the class is in a referenced DLL next to the app.
I cannot show the code for MyObject as it is a third-party .NET assembly.
|
|
|
|
|
Hi
did you try using a try / catch block in order to catch exception ???
|
|
|
|
|
I have a try...catch block inside the Init() function to catch the exception but the problem is that the execution does not enter the Init() functio if that line exists so therefore no exception is thrown.
|
|
|
|
|
use the try catch before the call to the init function
|
|
|
|
|
I should have mentioned, I have also wrapped the Init() in a try...catch but again, nothing, no exception, nothing, just a hung application.
|
|
|
|
|
OK sorry
Can you give more details about the MyObject class ????
and the environment that your application running ???
thanks
|
|
|
|
|
The environment is Visual Studio 2003, .NET 1.1, Windows XP.
The MyObject class is a third-party assembly containing lots of system calls, I understand that the problem could well be within the assembly and not my code and therefore out of my reach to fix but I would like to understand how a problem in a DLL assembly could stop the debugger entering the calling function, I could understand if it hung on the constructor of the MyObject class but I cannot see how it could hang on the calling function.
|
|
|
|
|
I run into some problems with the debugger (crushes,hangs and so on)
usually while doing some system programming, the solution to that in most cases was just restart.
you can try one of the following:
1.try to debug on another machine (check that you don't have problem in your environment)
2.use the System.Diagnostics.Debugger.Break(); command in order to force break.
3 use the sos debug extension in order to examine the runtime steps at execution
4 restart your computer and try again
|
|
|
|
|
turn MyObject class to a static one, if you cannot, i think i had the same problem with DirectX, where i tried to identify a class which contains a directX identifications. it threw me a bizzar exception. and what i did is putting a breakpoint and run the program pressing F10, at first, it threw me an exception but thenit ran normally. try that. it's so fool but you don't encounter this exception in *.exe file!
|
|
|
|
|
OK,
now what is MyObject class supposed to do ?
any idea what would be inside its constructor ?
have you other apps that use MyObject successfully ?
|
|
|
|
|
The MyObject implements a set of delegates which attach to system events allowing them to be handled by a .NET 1.1 application which they would otherwise not be able to do.
I have no idea what would be in the constructor unfortunately but on further testing I have found that a call to a static function within the class prodcues the same result so I am confident it is an issue with the assembly but that still doesn't get me any closer to why the entire function does not execute.
|
|
|
|
|
OK, sounds like there is a problem with a static initializer in MyObject. I can see
two ways forward now:
- contact the author
- try figuring out what is in the initializer using Reflector.
I assume you are on .NET 2.0 or 3.x; you might want to try MyObject inside a .NET 1.1
project, just to see if it works for you; the simplest invocation of MyObject should
be sufficient.
BTW I am not impressed by a "third party" that calls its stuff "MyObject".
Good luck !
|
|
|
|
|
It's not called MyObject, I just used that to demonstrate the problem I would be equally unimpressed if it were
It is currently in .NET 1.1, the assembly and my project are both 1.1.
I've contacted the author and waiting on a reply.
The question I was asking more than what could be wrong with the assembly as I realise it is the assembly causing the problem is how that problem could cause my function not to be executed even before any calls are made to the assembly, I would expect it to fail at the point of referencing the assembly but at least execute the function calls above it.
|
|
|
|
|
__DanC__ wrote: I would expect it to fail at the point of referencing the assembly but at least execute the function calls above it.
I understand that is what would be expected, but when you reach the Init() method, the
first thing that happens is the JIT compiles it; so it wonders about the
MyObject class, it must locate it, and at some point in time, also statically initialize it.
I am not sure exactly when that is supposed to happen; it must be deterministic of course,
and I know the exact order is surprisingly complex; long time ago I suffered from
a bug in that area, dont recall whether it was in 1.0 or 1.1 tho.
I think it is safe to assume static constructors get executed at the start of the
calling method (your Init), since the JIT in general must cope with a complex
flow graph and multiple references to the class, so it cannot always
(and hence does not even try to) predict which one will occur first, hence it will go
for early initialization.
You could proof this true or false by pushing the MyObject stuff and following code
inside Init() one level deeper...
|
|
|
|
|
hi,
i have a unmanaged c++ app that sends events to a managed wrapper, and then the wrapper sends it to my c# app. it works fine. but now i want to create custom controls that gets these events. the problem is i have no idea how. i can create basic custom controls and so.
it's for a touchscreen, so what i want to do is very similar to the click/mousedown events, except its more of a touchdown instead of mousedown.
eventually i want to be able to do Image.touchdown += (add event handler) and one the image is touched on screen, the event is raised. just like a mouse event.
can anyone please tell me where to start, or what article to read, or just give me a hint in the right direction?
thanks,
donovan
those that say it cannot be done shouldn't interrupt those doing it
|
|
|
|
|
With touch screens doesn't the touching equate to mouse stuff?
i.e. if you tap it's like doing a click.
|
|
|
|
|
it's for a multitouch screen, so pressing two fingers on an image does do quite different things than pressing two fingers on something else. so emulating the mouse is not quite a good solution
rather have something you don't need, than need something you don't have
|
|
|
|
|
No I mean don't the touch screen drivers interpret the touching as mouse stuff?
i.e. when you tap the monitor driver does a mouse click on that location
Edit:
Oh wait I reread what you were on about and I think I got confused.
The C++ app handles the touchside of things? It recieves the messages fro mthe touch screen and then tells the C# app.
What you want is then to make controls where the recieved messages fire events.
i.e.
Touch on the screen >> C++ app >> C# app >> fire event on control
|
|
|
|
|
Touch on the screen >> C++ app >> C# app >> fire event on control
exactly
rather have something you don't need, than need something you don't have
|
|
|
|
|
ahhhh got ya
Well you'll need to inherit each control in the framework and extend it with the new events you want. It'd probably be best to make an interface like ITouchableControl that defines the set of events you want and then have each new control impliment it.
The final bit is tell the control when it needs to fire the new events. You need some way of testing if the event from the touch screen is applicable to a cirtain control. You can do this using each controls location and seeing if it matches up with the event, if so then the control can fire its own event to notify anyone whos listening.
As to the exact implimentation of the final bit theres a few different routes you could go. You could have a central class that each control registers itself with, that singleton class would then handle all of the figuring out which controls are applicable and then inform each control as to what it needs to do. The other option is to have each control listen to the events and figure out for itself if it needs to fire its relivent events.
|
|
|
|
|
thanks. that is what i was looking for! the singleton will solve a lot of problems.
thanks again.
donovan
rather have something you don't need, than need something you don't have
|
|
|
|
|
|
donsolms wrote: so pressing two fingers on an image does do quite different things than pressing two fingers on something else
What the heck does that mean? "pressing two fingers"? What difference does it make how many fingers you use to press with? And why would you use more than one? Doesn't that make it more difficult to hit your target?
And what does "does do quite different things than pressing two fingers on something else" have to do with "how" you capture the "press" event? Are you confused... because I sure am.
|
|
|
|
|
ok. let me explain. it's a multitouch screen i built myself. it gets a videofeed from a camera of where you press your finger. the unmanaged c++ app does the tracking of the fingers. then i built a managed wrapper to get the 'events' raised by the unmanaged part. now that is working. now i need to add those touch events to a UIElement in wpf. now doing it with one object is no problem, but doing it with say Image and Button is a whole different story. because once i add a UIElement implemented to receive touches, the app runs but without allowing the other one for touches. so i want to build a framework that allows for more than one element to be touched. the basics should be the same as the normal mousedown event.
as for "doing different things" and "why whould you use more than one finger"?
google/youtube for 'microsoft surface', or 'jeff han ftir' and you'll see why more than one finger and why it does different things when you touch different objects.
@led mike - you're right : "And what does "does do quite different things than pressing two fingers on something else" have to do with "how" you capture the "press" event? " has nothing to do with it, it was just to better explain.
rather have something you don't need, than need something you don't have
|
|
|
|