I am in process of developing a C# application to do some printing operations.For this i am using macros that was used previuosly in the VB version.
Basically, this app will look for the docs to be printed in every 10 seconds.The logic is being implemented in a Timer_Tick event. In this event i am changing the app icon to show the status(Red or Green). This app will be running continously. I am destroying the icon to avoid memory issues.
The problem i am facing is the app is getting stuck or hung in between,that point of time the Task manager will not show any application that are being opened in the system. The moment i restore or maximise the app it will start working as exepcted.
Any help???Here is the code i am using to destroy the icon in the tick event:
Expand|Select|Wrap|Line Numbers
- using (Bitmap bmp2 = new Bitmap(picGreenLight.Image))
- {
- using (Icon ico = System.Drawing.Icon.FromHandle(bmp2.GetHicon()))
- {
- this.Icon = ico;
- System.Windows.Forms.Application.DoEvents();
- bmp2.Dispose();
- DestroyIcon(ico.Handle); // API to destroy the icon
- }
- }
Regards
Biju