|
Ok that finaly works.
Thx for pointing me again on the right things.
Regards.
|
|
|
|
|
Hi
I used NetApi32.dll; NetUserEnum() to retreive the users from Domain.
NetworkAPI.NetUserEnum(strDomain, 0, 2, out bufPtr, -1, out EntriesRead, out TotalEntries, out Resume);
The above one is working fine if I have one server.
But if I have One Domain and in that Two or more Servers, then when I gave domain name and try to retreive the users from domain it is returning only one server users. Why?
When I try to add the users to a folder/file from windows explorer when I select the domain name it is displaying the users from both the servers.
How can I overcome this problem?
Thanks in Advance.
Amar
|
|
|
|
|
Why is it necessary to re-write a whole new control to put a checkbox in a listview column header. It seems that a select all functionality is so standard now that adding a little checkbox should not require 200000 lines of code . The standard controls in .net seem to have no drastic improvement over the vc 6 controls. (Except for docking and panels) Is there an easy way to do this or do i have to write my own listview?
Thanks
|
|
|
|
|
I don't believe that u should write a new ListView control. The ColumnHeader is a seperate control: "System.Windows.Forms.ColumnHeader". I don't know if this will help u but just a thought.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
Maybe i will give that a try. Can i write a new column header control and assign it to an existing listview??
Thanks
|
|
|
|
|
Noone said that the .NET Controls were any better than the VC6 controls. Actually they're just wrappers around the controls that come with Windows! As is just about the entire .NET Framework is nothing but a bunch of wrappers around the Win32 API.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
"As is just about the entire .NET Framework is nothing but a bunch of wrappers around the Win32 API."
That I think is a gross oversimplification. The .NET Framework has its own services too, like CAS, GC..
Regards
Senthil
|
|
|
|
|
Hi All,
This ones a stumper....
The thread gets started that loops indefinately. It checks a database for a new message and displays it in the taskbar popup window. In the thread class i created there is a block of code initializing the popup window. When you call the show function:
taskbarNotifier1.Show("Chatter",what,500,5000,200);
You get a small line on top of the taskbar. If I change the code to this..
taskbarNotifier1.Show("Chatter",what,500,5000,200);
MessageBox.Show(what);
The popup window shows as long as the messagebox is open. When I close the messagebox the popup disapears.
This is very strange almost bug like.
Does anyone have any suggestions or thoughts on this.. Please help!!!
Thanks,
Mark
|
|
|
|
|
What's this TaskBarNotifier you're writing about?
It seems to be the component causing troubles but without further information (code!) we won't be able to help you.
mav
|
|
|
|
|
Hi Mav,
The TaskBarNotifier is as follows. The code works fine in a non-thread environment. Thanks alot for your time!!!
I have a main routine create a thread that polls a sql server and calls the show method in the following code snip. When you call the show method it displays a small line above the taskbar. If you add a messageBox.show() right after you call the taskbarnotifier.show() it works fine.
I got the taskbar notification code from an article on this site.
<snip>
// C# TaskbarNotifier Class v1.0
// by John O'Byrne - 02 december 2002
// 01 april 2003 : Small fix in the OnMouseUp handler
// 11 january 2003 : Patrick Vanden Driessche <pvdd@devbrains.be> added a few enhancements
// Small Enhancements/Bugfix
// Small bugfix: When Content text measures larger than the corresponding ContentRectangle
// the focus rectangle was not correctly drawn. This has been solved.
// Added KeepVisibleOnMouseOver
// Added ReShowOnMouseOver
// Added If the Title or Content are too long to fit in the corresponding Rectangles,
// the text is truncateed and the ellipses are appended (StringTrimming).
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace CustomUIControls
{
///
/// TaskbarNotifier allows to display MSN style/Skinned instant messaging popups
///
public class TaskbarNotifier : System.Windows.Forms.Form
{
#region TaskbarNotifier Protected Members
protected Bitmap BackgroundBitmap = null;
protected Bitmap CloseBitmap = null;
protected Point CloseBitmapLocation;
protected Size CloseBitmapSize;
protected Rectangle RealTitleRectangle;
protected Rectangle RealContentRectangle;
protected Rectangle WorkAreaRectangle;
protected Timer timer = new Timer();
protected TaskbarStates taskbarState = TaskbarStates.hidden;
protected string titleText;
protected string contentText;
protected Color normalTitleColor = Color.FromArgb(255,0,0);
protected Color hoverTitleColor = Color.FromArgb(255,0,0);
protected Color normalContentColor = Color.FromArgb(0,0,0);
protected Color hoverContentColor = Color.FromArgb(0,0,0x66);
protected Font normalTitleFont = new Font("Arial",12,FontStyle.Regular,GraphicsUnit.Pixel);
protected Font hoverTitleFont = new Font("Arial",12,FontStyle.Bold,GraphicsUnit.Pixel);
protected Font normalContentFont = new Font("Arial",11,FontStyle.Regular,GraphicsUnit.Pixel);
protected Font hoverContentFont = new Font("Arial",11,FontStyle.Regular,GraphicsUnit.Pixel);
protected int nShowEvents;
protected int nHideEvents;
protected int nVisibleEvents;
protected int nIncrementShow;
protected int nIncrementHide;
protected bool bIsMouseOverPopup = false;
protected bool bIsMouseOverClose = false;
protected bool bIsMouseOverContent = false;
protected bool bIsMouseOverTitle = false;
protected bool bIsMouseDown = false;
protected bool bKeepVisibleOnMouseOver = true; // Added Rev 002
protected bool bReShowOnMouseOver = false; // Added Rev 002
#endregion
#region TaskbarNotifier Public Members
public Rectangle TitleRectangle;
public Rectangle ContentRectangle;
public bool TitleClickable = false;
public bool ContentClickable = true;
public bool CloseClickable = true;
public bool EnableSelectionRectangle = true;
public event EventHandler CloseClick = null;
public event EventHandler TitleClick = null;
public event EventHandler ContentClick = null;
#endregion
#region TaskbarNotifier Enums
///
/// List of the different popup animation status
///
public enum TaskbarStates
{
hidden = 0,
appearing = 1,
visible = 2,
disappearing = 3
}
#endregion
#region TaskbarNotifier Constructor
///
/// The Constructor for TaskbarNotifier
///
public TaskbarNotifier()
{
// Window Style
FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Minimized;
base.Show();
base.Hide();
WindowState = FormWindowState.Normal;
ShowInTaskbar = false;
TopMost = true;
MaximizeBox = false;
MinimizeBox = false;
ControlBox = false;
timer.Enabled = true;
timer.Tick += new EventHandler(OnTimer);
}
#endregion
#region TaskbarNotifier Properties
///
/// Get the current TaskbarState (hidden, showing, visible, hiding)
///
public TaskbarStates TaskbarState
{
get
{
return taskbarState;
}
}
///
/// Get/Set the popup Title Text
///
public string TitleText
{
get
{
return titleText;
}
set
{
titleText=value;
this.Parent.Refresh();
}
}
///
/// Get/Set the popup Content Text
///
public string ContentText
{
get
{
return contentText;
}
set
{
contentText=value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Normal Title Color
///
public Color NormalTitleColor
{
get
{
return normalTitleColor;
}
set
{
normalTitleColor = value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Hover Title Color
///
public Color HoverTitleColor
{
get
{
return hoverTitleColor;
}
set
{
hoverTitleColor = value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Normal Content Color
///
public Color NormalContentColor
{
get
{
return normalContentColor;
}
set
{
normalContentColor = value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Hover Content Color
///
public Color HoverContentColor
{
get
{
return hoverContentColor;
}
set
{
hoverContentColor = value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Normal Title Font
///
public Font NormalTitleFont
{
get
{
return normalTitleFont;
}
set
{
normalTitleFont = value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Hover Title Font
///
public Font HoverTitleFont
{
get
{
return hoverTitleFont;
}
set
{
hoverTitleFont = value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Normal Content Font
///
public Font NormalContentFont
{
get
{
return normalContentFont;
}
set
{
normalContentFont = value;
this.Parent.Refresh();
}
}
///
/// Get/Set the Hover Content Font
///
public Font HoverContentFont
{
get
{
return hoverContentFont;
}
set
{
hoverContentFont = value;
this.Parent.Refresh();
}
}
///
/// Indicates if the popup should remain visible when the mouse pointer is over it.
/// Added Rev 002
///
public bool KeepVisibleOnMousOver
{
get
{
return bKeepVisibleOnMouseOver;
}
set
{
bKeepVisibleOnMouseOver=value;
}
}
///
/// Indicates if the popup should appear again when mouse moves over it while it's disappearing.
/// Added Rev 002
///
public bool ReShowOnMouseOver
{
get
{
return bReShowOnMouseOver;
}
set
{
bReShowOnMouseOver=value;
}
}
#endregion
#region TaskbarNotifier Public Methods
[DllImport("user32.dll")]
private static extern Boolean ShowWindow(IntPtr hWnd,Int32 nCmdShow);
///
/// Displays the popup for a certain amount of time
///
/// <param name="strTitle" />The string which will be shown as the title of the popup
/// <param name="strContent" />The string which will be shown as the content of the popup
/// <param name="nTimeToShow" />Duration of the showing animation (in milliseconds)
/// <param name="nTimeToStay" />Duration of the visible state before collapsing (in milliseconds)
/// <param name="nTimeToHide" />Duration of the hiding animation (in milliseconds)
/// <returns>Nothing
public void Show(string strTitle, string strContent, int nTimeToShow, int nTimeToStay, int nTimeToHide)
{
MessageBox.Show("Show called");
WorkAreaRectangle = Screen.GetWorkingArea(WorkAreaRectangle);
titleText = strTitle;
contentText = strContent;
nVisibleEvents = nTimeToStay;
CalculateMouseRectangles();
// We calculate the pixel increment and the timer value for the showing animation
int nEvents;
if (nTimeToShow > 10)
{
nEvents = Math.Min((nTimeToShow / 10), BackgroundBitmap.Height);
nShowEvents = nTimeToShow / nEvents;
nIncrementShow = BackgroundBitmap.Height / nEvents;
}
else
{
nShowEvents = 10;
nIncrementShow = BackgroundBitmap.Height;
}
// We calculate the pixel increment and the timer value for the hiding animation
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;
SetBounds(WorkAreaRectangle.Right-BackgroundBitmap.Width-17, WorkAreaRectangle.Bottom-1, BackgroundBitmap.Width, 0);
timer.Interval = nShowEvents;
timer.Start();
// We Show the popup without stealing focus
//ShowWindow(this.Handle, 4);
ShowWindow(this.Handle,4);
break;
case TaskbarStates.appearing:
this.Parent.Refresh();
// MessageBox.Show("appeared");
break;
case TaskbarStates.visible:
timer.Stop();
timer.Interval = nVisibleEvents;
timer.Start();
this.Parent.Refresh();
break;
case TaskbarStates.disappearing:
timer.Stop();
taskbarState = TaskbarStates.visible;
SetBounds(WorkAreaRectangle.Right-BackgroundBitmap.Width-17, WorkAreaRectangle.Bottom-BackgroundBitmap.Height-1, BackgroundBitmap.Width, BackgroundBitmap.Height);
timer.Interval = nVisibleEvents;
timer.Start();
this.Parent.Refresh();
break;
}
}
///
/// Hides the popup
///
/// <returns>Nothing
public new void Hide()
{
if (taskbarState != TaskbarStates.hidden)
{
timer.Stop();
taskbarState = TaskbarStates.hidden;
base.Hide();
}
}
///
/// Sets the background bitmap and its transparency color
///
/// <param name="strFilename" />Path of the Background Bitmap on the disk
/// <param name="transparencyColor" />Color of the Bitmap which won't be visible
/// <returns>Nothing
public void SetBackgroundBitmap(string strFilename, Color transparencyColor)
{
BackgroundBitmap = new Bitmap(strFilename);
Width = BackgroundBitmap.Width;
Height = BackgroundBitmap.Height;
Region = BitmapToRegion(BackgroundBitmap, transparencyColor);
}
///
/// Sets the background bitmap and its transparency color
///
/// <param name="image" />Image/Bitmap object which represents the Background Bitmap
/// <param name="transparencyColor" />Color of the Bitmap which won't be visible
/// <returns>Nothing
public void SetBackgroundBitmap(Image image, Color transparencyColor)
{
//Image itest=new Bitmap(GetType(),"skin.bmp");
BackgroundBitmap = new Bitmap(image);
Width = BackgroundBitmap.Width;
Height = BackgroundBitmap.Height;
Region = BitmapToRegion(BackgroundBitmap, transparencyColor);
}
///
/// Sets the 3-State Close Button bitmap, its transparency color and its coordinates
///
/// <param name="strFilename" />Path of the 3-state Close button Bitmap on the disk (width must a multiple of 3)
/// <param name="transparencyColor" />Color of the Bitmap which won't be visible
/// <param name="position" />Location of the close button on the popup
/// <returns>Nothing
public void SetCloseBitmap(string strFilename, Color transparencyColor, Point position)
{
CloseBitmap = new Bitmap(strFilename);
CloseBitmap.MakeTransparent(transparencyColor);
CloseBitmapSize = new Size(CloseBitmap.Width/3, CloseBitmap.Height);
CloseBitmapLocation = position;
}
///
/// Sets the 3-State Close Button bitmap, its transparency color and its coordinates
///
/// <param name="image" />Image/Bitmap object which represents the 3-state Close button Bitmap (width must be a multiple of 3)
/// <param name="transparencyColor" />Color of the Bitmap which won't be visible
/// /// <param name="position" />Location of the close button on the popup
/// <returns>Nothing
public void SetCloseBitmap(Image image, Color transparencyColor, Point position)
{
CloseBitmap = new Bitmap(image);
CloseBitmap.MakeTransparent(transparencyColor);
CloseBitmapSize = new Size(CloseBitmap.Width/3, CloseBitmap.Height);
CloseBitmapLocation = position;
}
#endregion
#region TaskbarNotifier Protected Methods
protected void DrawCloseButton(Graphics grfx)
{
if (CloseBitmap != null)
{
Rectangle rectDest = new Rectangle(CloseBitmapLocation, CloseBitmapSize);
Rectangle rectSrc;
if (bIsMouseOverClose)
{
if (bIsMouseDown)
rectSrc = new Rectangle(new Point(CloseBitmapSize.Width*2, 0), CloseBitmapSize);
else
rectSrc = new Rectangle(new Point(CloseBitmapSize.Width, 0), CloseBitmapSize);
}
else
rectSrc = new Rectangle(new Point(0, 0), CloseBitmapSize);
grfx.DrawImage(CloseBitmap, rectDest, rectSrc, GraphicsUnit.Pixel);
}
}
protected void DrawText(Graphics grfx)
{
if (titleText != null && titleText.Length != 0)
{
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Near;
sf.LineAlignment = StringAlignment.Center;
sf.FormatFlags = StringFormatFlags.NoWrap;
sf.Trimming = StringTrimming.EllipsisCharacter; // Added Rev 002
if (bIsMouseOverTitle)
grfx.DrawString(titleText, hoverTitleFont, new SolidBrush(hoverTitleColor), TitleRectangle, sf);
else
grfx.DrawString(titleText, normalTitleFont, new SolidBrush(normalTitleColor), TitleRectangle, sf);
}
if (contentText != null && contentText.Length != 0)
{
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
sf.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
sf.Trimming = StringTrimming.Word; // Added Rev 002
if (bIsMouseOverContent)
{
grfx.DrawString(contentText, hoverContentFont, new SolidBrush(hoverContentColor), ContentRectangle, sf);
if (EnableSelectionRectangle)
ControlPaint.DrawBorder3D(grfx, RealContentRectangle, Border3DStyle.Etched, Border3DSide.Top | Border3DSide.Bottom | Border3DSide.Left | Border3DSide.Right);
}
else
grfx.DrawString(contentText, normalContentFont, new SolidBrush(normalContentColor), ContentRectangle, sf);
}
}
protected void CalculateMouseRectangles()
{
Graphics grfx = CreateGraphics();
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
sf.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
SizeF sizefTitle = grfx.MeasureString(titleText, hoverTitleFont, TitleRectangle.Width, sf);
SizeF sizefContent = grfx.MeasureString(contentText, hoverContentFont, ContentRectangle.Width, sf);
grfx.Dispose();
// Added Rev 002
//We should check if the title size really fits inside the pre-defined title rectangle
if (sizefTitle.Height > TitleRectangle.Height)
{
RealTitleRectangle = new Rectangle(TitleRectangle.Left, TitleRectangle.Top, TitleRectangle.Width , TitleRectangle.Height );
}
else
{
RealTitleRectangle = new Rectangle(TitleRectangle.Left, TitleRectangle.Top, (int)sizefTitle.Width, (int)sizefTitle.Height);
}
RealTitleRectangle.Inflate(0,2);
// Added Rev 002
//We should check if the Content size really fits inside the pre-defined Content rectangle
if (sizefContent.Height > ContentRectangle.Height)
{
RealContentRectangle = new Rectangle((ContentRectangle.Width-(int)sizefContent.Width)/2+ContentRectangle.Left, ContentRectangle.Top, (int)sizefContent.Width, ContentRectangle.Height );
}
else
{
RealContentRectangle = new Rectangle((ContentRectangle.Width-(int)sizefContent.Width)/2+ContentRectangle.Left, (ContentRectangle.Height-(int)sizefContent.Height)/2+ContentRectangle.Top, (int)sizefContent.Width, (int)sizefContent.Height);
}
RealContentRectangle.Inflate(0,2);
}
protected Region BitmapToRegion(Bitmap bitmap, Color transparencyColor)
{
if (bitmap == null)
throw new ArgumentNullException("Bitmap", "Bitmap cannot be null!");
int height = bitmap.Height;
int width = bitmap.Width;
GraphicsPath path = new GraphicsPath();
for (int j=0; j<height; j++="" )
="" for="" (int="" i="0;" i<width;="" i++)
="" {
="" if="" (bitmap.getpixel(i,="" j)="=" transparencycolor)
="" continue;
="" int="" x0="i;
" while="" ((i="" <="" width)="" &&="" !="transparencyColor))
" i++;
="" path.addrectangle(new="" rectangle(x0,="" j,="" i-x0,="" 1));
="" }
="" region="" region(path);
="" path.dispose();
="" return="" region;
="" }
="" #endregion
="" #region="" taskbarnotifier="" events="" overrides
="" protected="" void="" ontimer(object="" obj,="" eventargs="" ea)
="" switch="" (taskbarstate)
="" case="" taskbarstates.appearing:
="" (height="" backgroundbitmap.height)
="" setbounds(left,="" top-nincrementshow="" ,width,="" height="" +="" nincrementshow);
="" else
="" timer.stop();
="" timer.interval="nVisibleEvents;
" taskbarstate="TaskbarStates.visible;
" timer.start();
="" break;
="" taskbarstates.visible:
="" added="" rev="" 002
="" ((bkeepvisibleonmouseover="" !bismouseoverpopup="" )="" ||="" (!bkeepvisibleonmouseover))
="" }=""
="" taskbarstates.disappearing:
="" (breshowonmouseover="" bismouseoverpopup)="" else="" (top="" workarearectangle.bottom)
="" top="" nincrementhide,="" width,="" -="" nincrementhide);
="" hide();
="" break;
="" override="" onmouseenter(eventargs="" base.onmouseenter(ea);
="" bismouseoverpopup="true;
" this.parent.refresh();
="" onmouseleave(eventargs="" base.onmouseleave(ea);
="" bismouseoverclose="false;
" bismouseovertitle="false;
" bismouseovercontent="false;
" onmousemove(mouseeventargs="" mea)
="" base.onmousemove(mea);
="" bool="" bcontentmodified="false;
" (="" (mea.x=""> CloseBitmapLocation.X) && (mea.X < CloseBitmapLocation.X + CloseBitmapSize.Width) && (mea.Y > CloseBitmapLocation.Y) && (mea.Y < CloseBitmapLocation.Y + CloseBitmapSize.Height) && CloseClickable )
{
if (!bIsMouseOverClose)
{
bIsMouseOverClose = true;
bIsMouseOverTitle = false;
bIsMouseOverContent = false;
Cursor = Cursors.Hand;
bContentModified = true;
}
}
else if (RealContentRectangle.Contains(new Point(mea.X, mea.Y)) && ContentClickable)
{
if (!bIsMouseOverContent)
{
bIsMouseOverClose = false;
bIsMouseOverTitle = false;
bIsMouseOverContent = true;
Cursor = Cursors.Hand;
bContentModified = true;
}
}
else if (RealTitleRectangle.Contains(new Point(mea.X, mea.Y)) && TitleClickable)
{
if (!bIsMouseOverTitle)
{
bIsMouseOverClose = false;
bIsMouseOverTitle = true;
bIsMouseOverContent = false;
Cursor = Cursors.Hand;
bContentModified = true;
}
}
else
{
if (bIsMouseOverClose || bIsMouseOverTitle || bIsMouseOverContent)
bContentModified = true;
bIsMouseOverClose = false;
bIsMouseOverTitle = false;
bIsMouseOverContent = false;
Cursor = Cursors.Default;
}
if (bContentModified)
this.Parent.Refresh();
}
protected override void OnMouseDown(MouseEventArgs mea)
{
base.OnMouseDown(mea);
bIsMouseDown = true;
if (bIsMouseOverClose)
this.Parent.Refresh();
}
protected override void OnMouseUp(MouseEventArgs mea)
{
base.OnMouseUp(mea);
bIsMouseDown = false;
if (bIsMouseOverClose)
{
Hide();
if (CloseClick != null)
CloseClick(this, new EventArgs());
}
else if (bIsMouseOverTitle)
{
if (TitleClick != null)
TitleClick(this, new EventArgs());
}
else if (bIsMouseOverContent)
{
if (ContentClick != null)
ContentClick(this, new EventArgs());
}
}
protected override void OnPaintBackground(PaintEventArgs pea)
{
Graphics grfx = pea.Graphics;
grfx.PageUnit = GraphicsUnit.Pixel;
Graphics offScreenGraphics;
Bitmap offscreenBitmap;
offscreenBitmap = new Bitmap(BackgroundBitmap.Width, BackgroundBitmap.Height);
offScreenGraphics = Graphics.FromImage(offscreenBitmap);
if (BackgroundBitmap != null)
{
// offScreenGraphics.DrawImage(BackgroundBitmap, 0, 0, BackgroundBitmap.Width, BackgroundBitmap.Height);
offScreenGraphics.DrawImage(BackgroundBitmap, 0, 0, 50, 100);
}
DrawCloseButton(offScreenGraphics);
DrawText(offScreenGraphics);
grfx.DrawImage(offscreenBitmap, 0, 0);
}
#endregion
}
}
|
|
|
|
|
If ur calling the Show method of ur TaskBarNotifier in a different thread to the one where the control was created u have to use Invoke.
taskbarNotifier1.Invoke(new myShowDelegate(taskbarNotifier.Show),new object[] ({"Chatter",what,500,5000,200})
|
|
|
|
|
Hi Skynyrd,
Thanks for you time on this. I tried creating a delegate and using the Invoke method and the same thing happends.
The way the code works is as follows:
Main App---> thread -->taskbarNotification.show()
Main app creates a thread that loops checking the server for new messages. When there is a new message the thread calls the taskbarNotification1.Invoke...
This is when the line appears at the bottom of my screen. The line looks like a border and is the same width as the bitmap background specified for the popup window. Like I said previously if I call MessageBox.Show("anything") after I call the taskbarNotification1.Invoke the program works perfectly with an annoying messagebox every time.
Thanks again for your time!!!
Mark
|
|
|
|
|
Well, after a lot of testing trying to duplicate your error… I think I found your problem. Any normal class belongs to the thread that new(ed) it. However, form and control classes are a different story because they are not actually initialized until they are used, thus the show function takes part… I repeated your error by initializing (Constructor) the taskbarNotifier in one thread and then invoking the show function. When I used the constructor on the interface thread and invoked the Show function from another thread, the problem disappeared. So move taskbarNotifier1 = new taskbarNotifier();
|
|
|
|
|
Hi ACorbs,
That was it.. I had the taskbarNotifier1 instance of the TaskbarNotifier() constructor created in the Thread1() of my new thread. I moved the taskbarNotifier1 and as you said the problem went away. Awesome!!!! Thanks!!!!
Time to move on.....
Thanks alot ACorbs,Skynard and Mav for your kind help!!!!
Mark
|
|
|
|
|
Hi all,
We are developing a web farm project using .Net, we need to make our sessions available across multiple servers. We planed to keep the sessions in outproc mode and kept the sessions in SQL server. We tried to put some session data into SQL server through one web server and tried to retrieve the same data from another web server, but we didn't get required result. Instead different session id's were generated by servers for the same session variable. Session id's are not mapped.
We have also configured the application path and machine key to be same on both servers still no result. How to make sessions available across servers irrespective of NLB support? Even if we go for NLB is there any possible way without any sticky mechanism?
|
|
|
|
|
Your question has nothing to do with C#. You might be better served if you posted your question in the ASP.NET Forum[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all, i'm trying to copy a file to a location but i'm getting the above error. Basically i'm copying an exe but it's being used at the time, how do i stop the exe from running so i can overwrite it with the new one?
Cheers
Kev
|
|
|
|
|
Kev:
If the .exe is running then you are definetly not going to be able to copy it.
One thing you might do is use some code like this:
System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcesses();
foreach(Process p in processes)
{
if(p.ProcessName == "ProcessName")
{
p.Kill();
}
}
That would kill the process (you should also consider p.close(); and then killing if that fails).
I hope this helps,
Jim
|
|
|
|
|
A modal form is called. It's parent form has a textbox.
I want access it from the modal one, but it's impossible.
My first try was to make a new constructor, which sends the parent form object.
FrmMain (Parent)
FrmConfiguration (Child)
Child's constructor
Public FrmConfiguration(FrmMain frmMain)
When I am trying to access frmMain, the Intellisense tool doesn't show me the textbox object.
Second try with "parent" doesn't work too.
Is there a way to access the parent form and all its objects ?
|
|
|
|
|
Seraphin wrote:
When I am trying to access frmMain, the Intellisense tool doesn't show me the textbox object.
Sounds like your textbox is declared private in the FrmMain class (default accessor when created with Form Designer). Changing its access modifier to internal or public should solve the problem.
www.troschuetz.de
|
|
|
|
|
Hello gurus,
I would like to know how I can use in C# a DLL that contains C code?
The set of functions is this one:
UINT PASCAL foo1( int argc, char **argv )
UINT PASCAL foo2( int argc, char **argv )
UINT PASCAL foo4( int argc, char **argv )
UINT PASCAL foo5( int argc, char **argv )
Can anyone tell me how I can call these functions in C# while these functions are in a DLL written in C?
Best regards to all.
There is no spoon.
|
|
|
|
|
Hi there. Im doing a project on this and was wondering if ne1 out there can point me in the right direction? an excellent site? code examples are always good too! =)
thanks!
|
|
|
|
|
I think you should determine which protocols, codecs you'll use. H323? SIP? Is it a mobile network? LAN? WAN?..
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
Dont know much about this.. but done message sending over Lan TCP/ip..
I want to do this over LAN.
wat would be the difference between:
1) this and WAN?
2) this and VoIP??
Can this be extended to be used over internet(the LAN one)
How do i choose a protocol?
Thanks so much!
|
|
|
|
|
If this is an office/work project, you'll probably only use LAN and you will have a faster connection between peers like 100Mbps so sending packets to each other can be handled easier respectively. No voice-data compressing might be needed, but you'll see it when you test it.
If this system will have a few clients (and/or voice conferance), you'll definetely need to write a server application too.
And if this project will run on WAN, you'll need codecs to compress the data to improve upstream/downstream quality.
Choosing the protocol depends on your needs and abilities. For example, if you'll consider a system that talks to any cell or land phone from a desktop application, H323 can be a choice. (www.h323.org[^]) This is an open source project designed for C++ mostly but I don't know if they implemented the .NET version. You can have the server app in C++ and clients in C# (or else) with an ActiveX H323 control for the server comm.
VOIP (Voice Over Internet Protocol) enables telephone calls via a broadband internet connection. High-speed connection is a must for clear conversations. You'll need a provider like AT&T to distribute your calls internationally, if this is a professional VOIP project. (VOIP may have many different network-phonesys setups)
But through a LAN, you don't need VOIP and your local connection is all you need if it's not a telephone you're calling.
You can use sockets for voice communication between PC clients.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|