Hi! I'm trying to use WIA Automation component to use a web cam (a standard Logitech USB) in a .Net app. The API makes it very straightforward to grab one picture from the camera or to get a video preview (OCX) automatically embedded in a window. Neat. Now my problem is that I actually want to get a video stream -- that is images, possibly between 1 and 10 frames per second. The "TakePicture" command is the only command support by the device, it cannot work at the same time than the VideoPreview and anyway taking one snapshot takes between 3 and 10 seconds (it seems to reinitialize the camera each time!) So... how am I supposed to use this API to do anything useful with a video device besides automatic preview?
ralfoide
Posts
-
WIA Automation: how to get video stream? -
Mobile Developer competition: results?Hi! Is there a list of the winners of the Mobile Developer competition?
-
How to create an "Open With" list?Hi! I need to be able to launch a viewer for a given file from my application (Win32/MFC/C++). Ideally I'd like to present the user with choices similar to the "Open With..." feature of the explorer shell. I tried SHGetFileInfo but it keeps returning 0 for the flag SHGFI_TYPENAME (failure). So I assume there's two part in my quest: 1- Find the type (mime type?) a given extension (I don't necessarily have the file created yet -- i.e. I'd like the user to be able to choose before creating the file) 2- Find a list of suitable applications (path, "user friendly" name) that can open that mime type. I seems like I could just go and fish the info from the registry, but would that work on any windows version? Regards R/
-
How to blit a System.Drawing.Image into DirectDraw.Surface ?Thanks, I'm going to try this approach too. In the meantime, I found out that a DirectDraw.Surface can be created directly out of a Bitmap: SurfaceDescription desc = new SurfaceDescription(); desc.SurfaceCaps.OffScreenPlain = true; desc.Width = width; desc.Height = height; Surface surf = new Surface(bitmap, desc, localDevice); It's then easy to use Surface.Draw to blit the surface into another. Your method would let me reuse the same surface always though, so it seems better. Regards -- Ralf
-
how to speed up GDI+ without using pointerYour class is very helpful, thank you! I was wondering myself how to do that in C# Best regards -- Ralf
-
How to blit a System.Drawing.Image into DirectDraw.Surface ?Hi! Naive question 101: what is the easier method (not necesarily the most performant) to blit a System.Drawing.Image into a DirectDraw.Surface? Thanks in advance, -- Ralf
-
How to extend System.Int32?Funny, I could not find any reference to Stephen Toub in GotDotNet, yet I found a nice team page for Eric and his article on MSDN regarding operator overloading :-) Anyway, I am in the right direction when I say that: - it's a C++-programmer reflex of mine to expect to be able to overload operator=() - in the case above, I actually don't need such an operator=, what I need is an operator from int to MyId, such as: public static implicit operator MyId(int id) { MyId v = new MyId; v.mId = id; return v; } R/
-
How to extend System.Int32?I understand how to write an implicit conversion to in32, but I don't get how to write an implicit conversion from int32 to my class. Currently I came up with something like that: public struct MyId { public const int kServer = 0; public const int kBroadcast = -1; public override bool Equals(object obj) { return mId.Equals(obj); } public override string ToString() { return mId.ToString(); } public override int GetHashCode() { return mId.GetHashCode(); } public static implicit operator int(MyId id) { return id.mId; } private int mId; } The C# reference says operator = cannot be overloaded. What I my missing so far? Is it useful to overload GetHashCode/ToString/Equal? TIA R/
-
How to extend System.Int32?Hi! I'd like to create an "id" class, i.e. a class which could hold any positive non-null integer, yet somehow semantically generated ids would be > 0, but 0 and -1 would have special meanings. Basically something like that: public class MyId: System.Int32 { public const int kServer = 0; public const int kBroadcast = -1; } Unfortunately that is not possible since System.Int32 is a struct and thus equivalent to a sealed class: I can't derive it. Can anyone suggest another approach to this? Maybe the class could just not derive from Int32 and just contain an Int32, generated to be unique from the constructor. Thanks in advance, all ideas welcome. R/
-
How to expose an [out] parameter in a Managed C++ class library?I beg to differ, but my understanding is that a "ref" is used when the called function will modify the value. An "out" seems preferable if the called function is just returning parameters. My sample prototype was of course simplified. My function returns several parameters, and rather than returning a struct I prefer to use out parameters. Example of C# prototype I want: MyClass.MyMethod(string inValue, out int Param1, out int Param2, out int Param3); So far I got it to work using "ref" if I declare the Param1..3 above using int __gc * in MC++: This MC++ real prototype in the class library: MyClass::MyMethod(System::String __gc* inValue, int __gc* Param1, int __gc* Param2, int __gc* Param3); is seen like this from the C# client: MyClass.MyMethod(string inValue, ref int Param1, ref int Param2, ref int Param3); Ideally I'd like out parameters. If not possible, well too bad :-D R/
-
Delayed initialization of a System.Window.Forms.Form?Interesting approach but 2 questions come to mind: - Isn't Show() suppose to display the dialog modeless? What's the impact of the caller using ShowModal() later on? - I naively assumed this.Refresh() would do the equivalent of the foreach(Controls)...Refresh() loop, doesn't it? Definitely worth trying anyway, thanks! R/
-
Deploying a WinForm applicationThanks, exactly what I needed! I love MSDN, there's a lot of material there, yet I fear it because there's too much interesting stuff to read :-)
-
How to expose an [out] parameter in a Managed C++ class library?Hi! I'm writing a Managed C++ class library to be used by a C# client, and I have a method which prototype should look like that from C#: MyClass.Method(string Param1, out int Param2); Problem is, I do not clearly understand how to declare an "out" parameter in Managed C++. I tried a pointer-on-int, as I used to do in COM with the [out] attribute, but it doesn't work (IntelliSense on the C# side wants an int* too!) I could use a reference of course, like that: public __gc class MyClass { public: void Method(System::String __gc *Param1, int &Param2) {... } } Not sure it works though and then the C# prototype would probably become "ref int Param2". Is there any clever solution to this? R/
-
Deploying a WinForm applicationHi! I created a "thin client" for a web service -- basically a simple C# Windows Form that connects to the web service and let the user interact with it. Now I'd like to deploy that, but to make it easy for the client, I would prefer if they could simply download and execute the exec from a web page instead of having to install it using a Windows Installer (I used to create one using VS7 before). Basically I'd like to have an ActiveX-like or Java applet-like deployment style for my windows form. Does anybody think that is possible at all? R/
-
Migrating VC++6 Dialog classesUnder VS6, I simply used to open both RC files (the current project and the one to import from), then simply Control-C the dialog template and Control-V it into the new RC. Then copyied the .cpp/.h manually and inserted in the project manually. I believe that may work with VS7 too but I haven't tried in a while.
-
Delayed initialization of a System.Window.Forms.Form?I think so too. I ended up placing the initialization call in the Activated event of the form. Experience shows that the form starts displaying, some items are partially visible and some are not (sounds like the message pump not having time to finish redrawing everything). It's not ideal but it's a better user experience -- the classical Windows Application not refreshing because of some heavy computation is of course not the desirable effect but something end-users can understand :-) R/
-
Good Enum QuestionCould not the end-developper ideally control that using a compiler attribute? my 2 cents R/
-
Delayed initialization of a System.Window.Forms.Form?Hi! I'm creating a WinForm to display data from an XML Web Service. Typically in the WinForm constructor, after the call to the VS designer's InitializeComponent(), I initialize the controls of my form. Problem is, that takes quite a while and because the form is not yet visible when the constructor is called, the end-user feels like the app is not working. So instead, I'd like to delay my initialization till after the form has been fully displayed, but I have yet to find an event for that in the Form class. OnLoad explicitly says it is generated befor the form is displayed. OnActivate doesn't seem to go thru... As a last resort, I could have the form post itself an event, and hope the app gets it once the window is finished displaying. Any better non-hack solution? TIA R/