How can I get printers icons in c# - c#

Can anybody tell me how can i get the icon of PrintQueue object (like in explorer) in C#.
I get the list of all printers with this code :
LocalPrintServer PrintServer = new LocalPrintServer();
PrintQueueCollection PrintQueuesOnLocalServer = PrintServer.GetPrintQueues(new[] { EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Connections });
Thanks in advance
NeoKript

If you want an operating system icon you should try open shell32.dll ( or try with other dll in system ) as a resource file with Visual Studio, you should find the icons there, but I don't know if you can use in your application.
Here a screenshot on opening a dll as a resources:
and here what you obtain:
Of course you have to try open the icon one by one to look for the one you need, maybe you want the one called 17 ?

Here you go: http://msdn.microsoft.com/en-us/library/ms247035.aspx
(Visual Studio Image Library collection of icons freely usable in your app).
'The Visual Studio 2010 Image Library contains application images that appear in Microsoft Windows, the Office system, Microsoft Visual Studio, and other Microsoft software. You can use this set of over 1,000 images to create applications that look visually consistent with Microsoft software'.

Most of the system icons are embedded resources in the system dll files.
Try looking in shell32.dll.
You can use the list here to find the icons that you want to use.

Related

Using VLC Activex Plugin in WinForms

I am trying to use AxVLCPlugin1/AxVLCPlugin2 in my WinForm. After some research, I've downloaded VideoLan 2.00, registered the axvlc.dll in my system, copied the plugins as well as dll's into project's output folder and added the control to my WinForm. If I try to run the code, I get:
"Unable to get the window handle for the 'AxVLCPlugin2' control.
Windowless ActiveX controls are not supported."
The environment is under Windows 7 32bit, Visual Studio 2008 and its all running on .NET 3.5.
I've read that the problem might be due to VLC library not supporting the newer Windows 7, but that shouldn't be a problem with VLC 2+ versions. I have also tried older/newer versions of VLC but still no luck.
My sample code to start the video (using 2nd plugin):
this.vlcMediaPlayer.Volume = 50;
this.vlcMediaPlayer.playlist.add(#"file:///C:\Users\Public\Videos\Sample Videos\Wildlife.wmv", "wildlife", " ");
this.vlcMediaPlayer.playlist.play();
The problem can be related to security feature of Windows called DEP (Data Execution Prevention), see link.
You can control its setting from here:
This explains the problem fairly well, see link.
It is not necessary to copy dll files to your project dir. Simply add reference to AXVLC and AxAXVLC. Search for a video instruction on Youtube.

Visual C# icon issue

I have recently finished a Visual c# project. During the process I tried multiple icons for the form and for the icon you see on your desktop. I found one that I was gonna use for both, but for some reason the icon that you see on your desktop is the old one that I used previously even though I changed it in Properties -> Application -> Icon and Manifest
Windows File Explorer uses an icon cache. You may need to clear this cache to get it to refresh.

Using embedded resource icon as app icon in C#

I'm trying to figure a way to specify my C# application to use an embedded resource (icon) as my application icon (the one displayed for taskbar, task switch, etc).
Yet, as I already embedded my icon in a resource, I can manage to use it in my forms but not with my application yet.
In fact, if someone could first tell me where I'll be able to set this (which file) by hand instead of using the VS2010 GUI to specify it, that'd be a great start!
Yet, my icon is available in these 2 ways :
{{Namespace}}.Properties.Resources.c_name.ico and in {{Namespace}}.Refs.c_name.ico (as a property of a public static class inside a class library).
Windows is an unmanaged operating system that doesn't know beans about managed resources. The only icon it can display is one that's embedded as an unmanaged resource. You can see what unmanaged resources look like in Visual Studio. Use File + Open + File and pick a .NET exe file (won't work in Express). A .NET program should have three of them, an icon, a manifest that declares the program compatible with UAC and a Version resource. This is all done automatically by the compiler, note for example how the Version resource properties match the attributes you set in AssemblyInfo.cs
The IDE makes it simple to set the icon for a program, you use Project + Properties, Application tab, Icon setting. Just pick the same .ico file as you embedded as a managed resource. Forget about trying to share, it cannot work by design.
Simply set
Icon=yourNamespace.Properties.Resources.yourEmbeddedIconName;
System.Drawing.Icon.FromHandle(Properties.Resources.EliminarNota.GetHicon());

Touchless Vision C# webcam wrapper, can't run without VS installed

So I've been hunting around for a good way to utilize a webcam from within a C# application. I tried a p/invoke dll which turned out to be inexplicably and irreproduceably buggy. After tinkering with a few others that either weren't suitable or were utterly archaic, I was referred to this:
http://jakemdrew.wordpress.com/2012/01/10/controlling-your-web-camera-using-c/#comment-15
It's the Touchless Vision code with a C# wrapper updated to work in VS 2010. It works wonderfully...as long as VS is installed on the machine. Download and run that release build on anything that doesn't and it will throw an error claiming that it can't find WebCamLib.dll or one of its dependencies. The fun part is that I've already integrated this into the project. It works great, but I'd like to be able to distribute this without additional installers or requiring VS 2010 to be installed on everything. What gives here?
I am using Aforge.net libraries(Aforge.net) without any problems on multiple computers even without VS installed.
But are you sure WebCamLib.dll is copied in the app directory? Aforge.Net also needs some dlls copied to computers, but if you have set Copy Local property to true, it should be inside the Debug/Release directory, also it will be in the directory when you release your app using Publish.
Sample:
Add Aforge.Controls.dll to your toolbox items
In designer put VideoSourcePlayer control in your form
Add private FilterInfoCollection videoDevices; in form class
Add into form initializer (or in function that you want to start your camera)
videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
foreach (FilterInfo fi in videoDevices)
{
this.videoSourcePlayer1.VideoSource = new VideoCaptureDevice(MonikerString);
this.videoSourcePlayer1.Start();
break;
}
Now you should be getting image from webcam in VideoSourcePlayer control. You can use NewFrame event of VideoSourcePlayer control to get access to each frame camera is sending and to save or change image.
well some time has passed since the question but, just for the sake of solving it I´ll say this:
Supposing that you have the references to the dlls and the files where they should be the only thing left to do is check the dll dependencies, in this case
the programmer of the touchless and webcamlib dlls didn´t care much for "versioning" so, find the c++ vs2012 redistribution for x64 and x86 and install them, then run your App and carry on with your Project.

View DWG files in a browser

I have an application developed with Asp.Net and C#. I have to display DWG - CAD files(stored in a server) in a client side browser. I cannot install Auto CAD or any other software or activeX control in my client side machines and it can be installed only on the server. Is there a way to achieve it?
I have tried the DWGViewX, but it was not able to display the image when accessed from a client. But when accessed from the server itself, am able to view the DWG file. I have just tried the trial version of DWGViewX. Is this issue because of the licensing issue?
ANy help in this regard will be greatly apprecited.
Regards
Vignesh
Have a look at CadLib. It has an ASP.NET example solution in the evaluation download. There's also a beta version for a Silverlight 4 edition (see the forum).
First, download the free DWG TrueView from Adobe and install it.
After that open Visual Studio (I use 2008) and open a new Windows Form Project.
Then switch to the form-designer.
There you open the toolbox and add a new tab "TrueView" or so.
After that rightclick and "Choose Items..."
--> wait a couple of seconds
--> then choose the tab "COM Components"
--> there you should find "Autodesk AcCtrl" mark it.
Now you have a component "Autodesk AcCtrl" in your "TrueView" Toolbox --> use it on the form.
and now, very simple, you need only one line of code in the Form1_Load function (generated through Visual Source) and put the following code in it:
axAcCtrl1.PutSourcePath(#"C:\WHERE\EVER\YOUR\DWG\FILE\IS\example.dwg");
Thats all!
Hope it helped!
If you want your end users, without having autocad or any compatable viewer for dwg files, then you need to convert dwg drawings to pdf or jpg. There are some libraries available in web to accomplish that. See the below url:
http://www.codeproject.com/Questions/103830/convert-from-dwg-to-pdf

Categories