 |
|
 |
Hi John,
Thanks for the article. I was just working on popping up the toaster winodow in a scheduled manner. I was able to use Timercallback function and initiated the toast pop up function. However, it didnt worked for me. Can you give me some ideas regarding the same.
Hai This is Yesh
|
|
|
|
 |
|
 |
This is a very nice example. However, I think you will want to do some significant cleanup here. You are using many disposable objects without properly managing them. As a rule of thumb, if you create a disposable object, you are responsible for cleaning it up.
Also might want to consider running fxcop on this as well. Fxcop will help you in learning the langauage and the best uses of it.
|
|
|
|
 |
|
 |
This is great. A certain co-worker's been bugging me for this for months, and thanks to your code I was able to bang this in quickly! Kudos!
-- Jamie
|
|
|
|
 |
|
 |
please help i am getting this message Additional information: Resource 'skin.bmp' could not be found in class 'filecopy.frmBackup'. the resources(bmp files) are in the project
|
|
|
|
 |
|
 |
Would it be possible to apply the same principle in asp.net application, if so please advise of the solution
siphiwe.khuzwayo@standardbank.co.za
|
|
|
|
 |
|
 |
i have a problem "An error occurred creating the form. See Exception.InnerException for details. The error is: Resource 'skin.bmp' cannot be found in class 'task.Form1'" I tray save images in bin/debug (when in debug modE) and bin/release (when in release mode) but nothing
|
|
|
|
 |
|
 |
Try this: in "solution view" right click on the bmp -> properties -> in build action dropdown select "Embedded resource" then rebuild
KlemMax
|
|
|
|
 |
|
 |
thanks gracias!!!!!!!!, that was
|
|
|
|
 |
|
 |
Generally, the notifier works as advertised and does not steal focus. However, if I set CloseClickable to true and add a CloseClicked event which calls Hide(), the next time I display a new notifier it does steal focus from whatever window is active (system-wide). If I let the focus-stealing popup disappear on its own then the next one to come up won't steal focus - it only happens on the next one, following one that is closed through the CloseClicked handler. This is driving me crazy, I can't figure out why it's doing this!
|
|
|
|
 |
|
 |
Ah, I've got it solved! I removed TopMost from the constructor, P/Invoked SetWindowPos(), and modified the switch (taskbarState) block in Show() as follows:
int left, top, width, height;
switch (taskbarState)
{
case TaskbarStates.hidden:
taskbarState = TaskbarStates.appearing;
this.Opacity = 0.0;
left = WorkAreaRectangle.Right - BackgroundBitmap.Width - nPadding - nBaseWindowRight;
top = WorkAreaRectangle.Bottom - BackgroundBitmap.Height - nPadding - nBaseWindowBottom;
width = BackgroundBitmap.Width;
height = BackgroundBitmap.Height;
SetWindowPos(this.Handle, -1, left, top, width, height, 0x0010);
timer.Interval = nShowEvents;
timer.Start();
ShowWindow(this.Handle, 4);
break;
case TaskbarStates.appearing:
Refresh();
break;
case TaskbarStates.visible:
timer.Stop();
timer.Interval = nVisibleEvents;
timer.Start();
Refresh();
break;
case TaskbarStates.disappearing:
timer.Stop();
taskbarState = TaskbarStates.visible;
left = WorkAreaRectangle.Right - BackgroundBitmap.Width - nPadding - nBaseWindowRight;
top = WorkAreaRectangle.Bottom - nPadding - nBaseWindowBottom;
width = BackgroundBitmap.Width;
height = 0;
SetWindowPos(this.Handle, -1, left, top, width, height, 0x0010);
timer.Interval = nVisibleEvents;
timer.Start();
Refresh();
break;
}
I'm still not sure why the notifier was taking focus in such a limited way, but at least this made it stop. Now if only we had a 100% managed way to do this in WinForms, that would be excellent!
modified on Wednesday, February 25, 2009 10:34 PM
|
|
|
|
 |
|
 |
I am having the same problem you were but when i try to impliment what you stated above I just get nothing. Any chance you could post a more complete code listing of your changes? Also where did the nPadding and nBaseWindowRight variables come from, the version I have doesnt have those variables.
|
|
|
|
 |
|
 |
nPadding and nBaseWindowRight are part of Crusty Applesniffer's modification, which you can find by browsing the comments here. As for my code changes, they are as follows:
The modified constructor:
#region TaskbarNotifier Constructor
...the P/Invoke signature for SetWindowPos():
[DllImport("user32.dll")]
protected static extern bool SetWindowPos(IntPtr hWnd,
Int32 hWndInsertAfter, Int32 X, Int32 Y, Int32 cx, Int32 cy, uint uFlags);
...and the entire Show() method (modified from the stock code, without any of Crusty Applesniffer's or my own modifications previously applied):
{
nEvents = Math.Min((nTimeToShow / 10), BackgroundBitmap.Height);
nShowEvents = nTimeToShow / nEvents;
nIncrementShow = BackgroundBitmap.Height / nEvents;
}
else
{
nShowEvents = 10;
nIncrementShow = BackgroundBitmap.Height;
}
if( nTimeToHide > 10)
{
nEvents = Math.Min((nTimeToHide / 10), BackgroundBitmap.Height);
nHideEvents = nTimeToHide / nEvents;
nIncrementHide = BackgroundBitmap.Height / nEvents;
}
else
{
nHideEvents = 10;
nIncrementHide = BackgroundBitmap.Height;
}
switch (taskbarState)
{
case TaskbarStates.hidden:
taskbarState = TaskbarStates.appearing;
SetWindowPos(
this.Handle,
-1,
WorkAreaRectangle.Right - BackgroundBitmap.Width,
WorkAreaRectangle.Bottom - BackgroundBitmap.Height,
BackgroundBitmap.Width,
BackgroundBitmap.Height,
0x0010
);
timer.Interval = nShowEvents;
timer.Start();
ShowWindow(this.Handle, 4);
break;
case TaskbarStates.appearing:
Refresh();
break;
case TaskbarStates.visible:
timer.Stop();
timer.Interval = nVisibleEvents;
timer.Start();
Refresh();
break;
case TaskbarStates.disappearing:
timer.Stop();
taskbarState = TaskbarStates.visible;
SetWindowPos(
this.Handle,
-1,
WorkAreaRectangle.Right - BackgroundBitmap.Width,
WorkAreaRectangle.Bottom,
BackgroundBitmap.Width,
0,
0x0010
);
timer.Interval = nVisibleEvents;
timer.Start();
Refresh();
break;
}
}
Hope this helps!
modified on Saturday, February 28, 2009 10:45 PM
|
|
|
|
 |
|
 |
Try turning off TopMost=true (in the Constructor)
and in the Show() method, add a BringToFront() when taskbar is appearing.
E.g.
case TaskbarStates.appearing:
BringToFront();
Refresh();
break;
Then it all works beautifully. I can post my modified class if anyone needs it.
|
|
|
|
 |
|
 |
I tried using the VB.NET code in a VB.NET project and got a whole bunch of errors. For starters, TaskbarNotifier.ContentRectangle was not recognized.
Has anyone got this to work with VB.NET and VS 2008?
|
|
|
|
 |
|
 |
Has anyone modified the code to display HTML content? Wondering if it's possible to do, say with the WebBrowser control and maintaining the skin?
|
|
|
|
 |
|
 |
Hi Sir,
I am going to use that Notifier in my school project. That's pretty good.
Now i am facing with the skin problem.
I am using VS2008(C#). When I am add that TaskBarNotifier form into my project and "skin2.bmp" and "close2.bmp" to my project>images, no error in compilation. But when i run, the error comes out like
">>>Resource 'images\skin2.bmp' cannot be found in class 'MyProject.MyForm'.<<<<"
in this following line
>>> TaskBarNotifier.SetBackgroundBitmap(new Bitmap(GetType(), "images\\skin2.bmp"), Color.FromArgb(255, 0, 255));<<
I have tried to add image again and chage the Build property to "Embedded resources". But same error.
Please help me how to fix it.
Thanks
|
|
|
|
 |
|
 |
Write
string skinIamge = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\skin2.bmp";
string closeImage = Path.GetDirectoryName(Application.ExecutablePath) + @"\Images\close2.bmp";
And Insted of this
TaskBarNotifier.SetBackgroundBitmap(new Bitmap(GetType(), "images\\skin2.bmp"), Color.FromArgb(255, 0, 255));
Write
TaskBarNotifier.SetBackgroundBitmap(Image.FromFile(skinIamge), Color.FromArgb(255, 0, 255));
TaskBarNotifier.SetCloseBitmap(Image.FromFile(closeImage), Color.FromArgb(255, 0, 255), new Point(220, 8));
|
|
|
|
 |
|
 |
how to spread on multiple lines...on the text ?, help..
|
|
|
|
 |
|
 |
Hi all!
I just first want to thanks for a good tutorial.
And second i offer a small change if you all want to put some transparence/opacity on your layers, i guess you would
first:
in TaskbarNotifier.cs
Go directly to this section "TaskbarNotifier Public Methods"
#region TaskbarNotifier Public Methods
//// include here this lines ///
[DllImport("user32.dll")]
private static extern Boolean SetLayeredWindowAttributes(IntPtr hWnd, uint crkey, Byte bAlpha, Int32 dwFlags);
[DllImport("user32.dll")]
private static extern uint SetWindowLong(IntPtr hWnd , int nIndex, uint dwNewLong);
[DllImport("user32.dll")]
private static extern uint GetWindowLong(IntPtr hWnd, int nIndex);
static readonly int GWL_EXSTYLE = (-20);
public const int WS_EX_LAYERED = 0x80000;
public const int LWA_ALPHA = 0x2;
#endregion
right?
now in the function Show(....) little below you only write like this...
public void Show(string strTitle, string strContent, int nTimeToShow, int nTimeToStay, int nTimeToHide)
{
//
// This is the color, but its not to be used anyway, so put a value here.
uint c = 0x00FF00FF;
// Set WS_EX_LAYERED on this window
SetWindowLong(this.Handle,GWL_EXSTYLE, GetWindowLong(this.Handle, GWL_EXSTYLE) | WS_EX_LAYERED);
// Make this windows have the alpha value 125 from (0-255)
SetLayeredWindowAttributes(this.Handle, c, 125, LWA_ALPHA);
... more codes here, but let it be...
}
And thats it
Good luck!
Cheers
Betzie
|
|
|
|
 |
|
 |
Can any one tell what are disadvantages if I use window form as pop up notification. I have set formborderstyle as none and button overlapping the close image, and had set the button back color as transparent.
|
|
|
|
 |
|
 |
hi
i got struck doing this while add my own .bmp file, how to add new bmp file in the project?
i am working in vb.net 2.0
urgent
please reply soon
|
|
|
|
 |
|
 |
just import the bmp and change the property "Build action" to embedded resource
That works fine!
|
|
|
|
 |
|
 |
Hello Schuege
Thanks a lot, it is working fine.........
Thanks & Regards
Hima
|
|
|
|
 |
|
 |
Hello,
is it possible to drop a shadow around the image that pops up?
It is not possible to show a transparant png image.
Does anyone have a solutions for this question?
Kind regards
|
|
|
|
 |
|
 |
Hi
I am gettings this error when trying to run it
An unhandled exception of type 'System.NullReferenceException' occurred in DumpFileHandlerGUI.exe
Additional information: Object reference not set to an instance of an object.
in this line
nEvents = Math.Min((nTimeToShow / 10), BackgroundBitmap.Height);
Does anyone know how to fix this?
|
|
|
|
 |