|
sorry Iam in the wrong forum Please fogive me
|
|
|
|
|
Hi,
I have Nikon coolpix s7c camera.I wrote a C# program using Windows Image Acquisition. In that program, when camera is connected to the computer, Program takes picture on Button events which I set up using the API WIA.dll.
When the camera is connected to the computer, the shutter release button is totally unresponsive.
I want to give the users both options for taking picture, either programmatically or physically. Programmatic way is working fine, but I don't know how to take picture from camera when it is connected to the computer. I have the respective camera driver installed.
Is there any way I can achieve this using digital camera?
Any help will be greately appreciated.
Veena
|
|
|
|
|
You're going to have to talk to Nikon Support about that one. But, using this as a small thought exercise, I doubt you can do it once the camera is connected to the machine.
|
|
|
|
|
Thanks Dave!!!
I did contact Nikon support. This feature is in D-SLRs. I downloaded the SDKs from NIkon.But
I did not find any working example in C#. If someone could send me a link to C# example, It will be a great help.
Veena
|
|
|
|
|
I've derived a PictureBox class to handle some drawing and mouse handling functionality. Now I'm trying to add some key press event handling, but the events never appear to be fired.
The OnMouseDown override was straightforward. Is the OnKeyDown for the PictureBox somehow different?
In the derived PictureBox constructor I set ControlStyles.Selectable to true, but that
didn't help.
As a test, I tried overriding ProcessKeyMessage, but that didn't appear to work either.
The derived PictureBox's parent form had an OnKeyDown event handler, but I commented that out to be sure it wasn't intervening, but that didn't make a difference.
Thanks for any help.
|
|
|
|
|
Is there a particular reason that you are using a PictureBox ?
The reason I ask is that you can draw on almost all .NET controls, and keyboard handling is well documented for them.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I actually need to load an image file into the control and I use the mouse to control mark-up on the image. I wanted to use the keys to toggle properties of the control (e.g., how this mark-up is displayed).
I can catch the key presses in the parent form and change the derived PictureBox properties there, but since there are multiple instances of this derived control on the form, this would be cumbersome.
Thanks for the reply.
|
|
|
|
|
Hi,
a PictureBox is a bag of problems as soon as you want it to do more than just show a picture.
It is a Control, and knows about Keyboard events, but these only work when the Control has focus; maybe you never focused it, or it refuses to focus (would make some sense).
I see two solutions:
1. in your derived Control, add a transparant Panel on top of the PB, and let that handle all the user interaction and markup. May be somewhat tricky.
2. drop the PB, just use a Panel, give it a Paint handler and draw the image yourself. That is a matter of a few lines of code and gets rid of all the trouble once and for all.
|
|
|
|
|
Hi, I would like to use NGen to pre-compile my application (during the installation process). I already read a lot about that. But there are some questions left.
After I have installed the native image of my assembly in the cache - the image will be executed when I start the app.
But what happens if the native image becomes invalid for some reason?
#1: How can my program find out it is not running as native in the assembly cache?
#2: Is it possible to start "ngen update <myApp>" while <myApp> is running? (Will that work?)
I hope someone knows the answers to this questions and hopefully that person is so kind to share his knowledge.
Thanks, Morris
|
|
|
|
|
dyonik wrote: #1: How can my program find out it is not running as native in the assembly cache?
It is ALWAYS running as native. There isn't a processor on this planet that can run MSIL code natively. The JIT compiler detects if the native image is no longer valid for the platform it's running on and will automatically recompile the code and cache a new native image. Your code will never know this happened.
dyonik wrote: #2: Is it possible to start "ngen update <myapp>" while <myapp> is running? (Will that work?)
No, not while the .EXE is running. You'd have to use a seperate update app to do the download and launch the NGEN.
|
|
|
|
|
Hi Dave - Thanks for answering.
Ok point #2 is clear but I think I dit not express my self right in point #1.
What I meant was: How do I find out that the native image is invalid? (Without using Fusion Log Viewer but in a .Net program)
This is necessary so I can update the image if required.
|
|
|
|
|
dyonik wrote: What I meant was: How do I find out that the native image is invalid? (Without using Fusion Log Viewer but in a .Net program)
I'm not convinced you need to deal with this but have you tried renaming the file while it's being used in a process?
|
|
|
|
|
You're not getting it. When your code is running, the native image is ALWAYS valid. If it wasn't, you're code wouldn't be running.
|
|
|
|
|
Dave Kreskowiak wrote: When your code is running, the native image is ALWAYS valid. If it wasn't, you're code wouldn't be running.
Are you sure about that?
If those dependencies change, it invalidates the code in the native image
and the runtime will fail to use the native image, instead reverting to JIT compilation.
link[^]
|
|
|
|
|
led mike wrote: If those dependencies change, it invalidates the code in the native image and the runtime will fail to use the native image, instead reverting to JIT compilation.
Which, a little further down the road, replaces the bad native image with the new one, after the JIT does it's job, of course. He's trying to pre-JIT to native to avoid the delay that happens the first time the JIT has to compile new code.
In his updater .EXE, he can download a new installer and run that, which should be coded to replace the old application and NGEN new images. Other than that, all he has to do to accomplish approximately the same thing is launch the new .EXE and the JIT will compile the parts it needs on the fly, updating the native cache as it goes.
|
|
|
|
|
Dave Kreskowiak wrote: He's trying to pre-JIT to native to avoid the delay that happens the first time the JIT has to compile new code.
Ah, I was missing that completely. I'm not even sure I know what to think of that. Here where I work we would have like 50k problems that would be a higher priority than that one.
|
|
|
|
|
Sure there other problems out there but the tool I wrote needs 15 seconds to startup.
(You might ask what takes so long. It's mostly Windows Forms inits and updates .)
I am talking about warm start - which means the app has been run before. Cold start takes even longer.
That is not acceptable for a repeatedly used tool. Using NGEN the startup time was reduced to under 5 seconds.
That means a much better user experience.
|
|
|
|
|
No, JIT-compiling does not replace or update the native image if it got invalid.
If I start the app and the image is invalid the app is jit-compiled. But that does not update the image.
Thus the app will always be jit compiled till someone updates the native image.
A launcher app is not possible because it would cost additional time - which I want to save.
I thought about automatically updating the image when closing the app.
Because:
* This will not add to my startup time.
* The exe-file CAN be installed by NGEN while it is running. (I tried it.)
* If the native image is invalid the application will still run (but startup slower).
|
|
|
|
|
When parsing a string that contains a date with DateTime.Parse, how can you get the custom DateTime format string that describes the format the string was in? (i.e. "M/d/yyyy" or "M/d/yy", etc.)
|
|
|
|
|
Are you saying that you want to get the format string from an already existing date, like "03/05/2009"??
First, there is no method you can call that will return this. Second, the reason being is in the example I just gave? Is that date March 5th or is it May 3rd?? It's impossible to tell unless the source of the date can be interrogated somehow.
|
|
|
|
|
Yes, but you can assume that the string has already "succesfully" been parsed with DateTime.Parse.
Supposedly DateTime.Parse decides which value is the month by using the culture-specific format information in the IFormatProvider argument. (Of course you can never be sure that that same month-day order was actually intended in the string).
Anyway, if Parse can return a DateTime then the format string is also known. It would be useful to have for instance for later calls to DateTime.ParseExact to see if other strings also follow that same format.
|
|
|
|
|
Like Luc said, it's in the CultureInfo. I thought you're original post said that you wanted to derive the format string from the Date string itself.
|
|
|
|
|
Maybe CultureInfo.DateTimeFormat can help you?
|
|
|
|
|
By default when you add output to Application folder, it copies exe and dependencies (DLLs) in the same folder. I want to copy DLLs in separate folder named "Bin". I was unable to find any solution on this. Can anyone help me...?
|
|
|
|
|
Considering your code has to be modified to allow it to find .DLL files outside of the folder the .EXE was launched from or other than any folder in the PATH, this isn't a good idea.
The Setup and Deployment Wizard does not account for this type of setup. You'd have to customize one by hand in order to do what you want. Personally, I don't use the Setup and Deployment projects in Visual Studio. I use external third party tools, like InnoSetup and Wise Package Studio to create my installers.
|
|
|
|