|
That doesn't work though. Another work around might be the following:
string loc = @"C:\image1.gif";
using(Bitmap bmp = new Bitmap(loc))
{
using(Graphics g = Graphics.FromHwnd(this.Handle))
{
g.DrawImage(bmp, 5, 5);
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
When I set the user account to be disabled or change password at next logon Properties["userAccountControl"].Value always returned ADS_UF_NORMAL_ACCOUNT (512).
Any ideas?
|
|
|
|
|
And this has to do with C# how?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
If you want to disable the account set your userAccountControl value to 514 (0x202).
- Nick Parker My Blog | My Articles
|
|
|
|
|
I want to see which accounts are locked out.
|
|
|
|
|
If you want to check a particular account, the following will work:
string path = "LDAP://Blah=blah,Blah=blah";
DirectoryEntry de = new DirectoryEntry(path);
int val = Convert.ToInt32(de.Properties["userAccountControl"][0];
if((val & 0x202) == 0)
MessageBox.Show("Account is disabled");
- Nick Parker My Blog | My Articles
|
|
|
|
|
It works if user account is disabled, but does not work if account is locked out ((Convert.ToInt32(de.Properties["userAccountControl"].Value & ADS_UF_LOCKOUT) == ADS_UF_LOCKOUT)
|
|
|
|
|
Zackmac wrote:
but does not work if account is locked out ((Convert.ToInt32(de.Properties["userAccountControl"].Value & ADS_UF_LOCKOUT) == ADS_UF_LOCKOUT)
You need to check if your add operation equals 0, not 0x0010 - 16 (ADS_UF_LOCKOUT). Try this for a lockout checking:
string path = "LDAP://Blah=blah,Blah=blah";
DirectoryEntry de = new DirectoryEntry(path);
int val = Convert.ToInt32(de.Properties["userAccountControl"][0];
if((val & 0x210) == 0)
MessageBox.Show("Account is locked out");
- Nick Parker My Blog | My Articles
|
|
|
|
|
You don't understand me. Problem is userAccountControl value is not reflected when account is locked, but the userAccountControl value changes when the user account is disabled.
|
|
|
|
|
Anyone know of any samples for writing a streaming audio server?
|
|
|
|
|
Hello
I have been tryin to customize the Code appear for iEtoolbar
www.codeproject.com/csharp/dotnetbandobjects.asp
Instead of Click,I am willing to Implement DocumentComplete Event,guide me please
Thanks
|
|
|
|
|
If you have questions about a particular article, ask at the bottom of the article in the article message board: that's what it's there for. This forum is for C#-related and typically general .NET questions 1) not related to a specific article, 2) not related to a specific product or library, and 3) isn't about ASP.NET (there is a forum more specific to that topic here on CodeProject).
There are answers to that question already. In fact, the first question is what you want and I went ahead and posted a reply. Be sure to read it. If you don't understand, don't come back here; continue the thread in the article's message board.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I am sorry,you are right,infact i had to post there but did here without noticing the rules
but it could be good if you gave the link of the post you made on that article..
right now i am searching it in archieve..
Thanks
|
|
|
|
|
|
Not sure if this is in the correct forum or not.. but I had to rant
Does anyone else HATE writing reports that MUST be printable?
Life would be so much easier if our Admin would let us use
SqlServer Reporting Services or Crystal Reports... but nooo
ok.. sorry had to get that out
Will
|
|
|
|
|
> Not sure if this is in the correct forum
The soapbox dude.
If your admin has an issue with Crystal Report running over the network you can run it on the local machine.
Alex Korchemniy
|
|
|
|
|
|
OMalleyW wrote:
Life would be so much easier if our Admin would let us use
SqlServer Reporting Services or Crystal Reports... but nooo
Sounds like you need a new Admin.
In this situation. I'd cost up the project costs of developing reports without SQL RS or Crystal Reports and cost up developing with reporting software. Then go above the admins head and talk to somebody who can make a better choice.
Michael
CP Blog [^]
|
|
|
|
|
Hello friends
I am newbie in C#,been working on it for few weeks and very excited after working on it,things ve become easier with it which were difficult in past(coding in VC++)
i want to ask that is there anyway to use MSN API for the development of MSN Plugin?any help regarding that? beside this is it possible to customize "TOAST"?
Thanks
|
|
|
|
|
kadnan wrote:
i want to ask that is there anyway to use MSN API for the development of MSN Plugin?
If you simply want to hook into MSN Messenger, you can use tlbimp.exe[^] to generate an interop assembly which will give you access to their exposed classes and interfaces to program against. Are you looking to attach your "plugin" into the MSN Messenger client UI or just use some of their exposed API's?
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks for quick reply Nick
I don`t want to use MSN Features in my OWN seprate application..what i am willing to make a Plugin which can cuztomize MSN`s TOAST and i can give my own message alert by using some Toast Class in API
is it Possible?
Thanks
|
|
|
|
|
Hi there!
I have two functions with one variable of type bool.
The mouse leave function do the following...
private void OnLeaveClip(object sender, System.EventArgs e)
{
picXMLmovie = false;
if(PBOrigem != null)
pictureBoxXML.Image = PBOrigem.Image;
}
And the mouse hover has this cycle
for(int i = 1; i <= jogadaslist.LastIndex(); i++)
{
if(picXMLmovie)
{
posinit = jogadaslist.GetTagAtPosition(i).start;
posend = jogadaslist.GetTagAtPosition(i).end;
for(int j = posinit; j <= posend; j++)
{
if(picXMLmovie)
{
pictureBoxXML.Image = analvideo.GetFrame(aviStream, j);
Refresh();
}
else
break;
}
}
else
break;
}
The problem is when I do the Leave Event, the cycle that is occouring in the Mouvehover event don´t STOP.
How can I do to STOP it, is it possible?!!
Thanks you very much
|
|
|
|
|
The MouseHover event won't be fired when your mouse leaves the client area, but that doesn't mean the code inside your MouseHover event won't continue to run. It will run until it completes. If you want to stop it, you should consider using a state variable (like a bool field called stop or something) that your MouseLeave event handler sets (i.e., set to true ) and your MouseHover event checks, conditionally exits its loop, and resets (i.e., set to false ).
The real problem I see with your code, however, is what you're doing within MouseHover . If you read the documentation (always a good thing), it states that the MouseHover event is fired continuously (several times a second) - even when you're mouse is not moving. You should not be performing exhaustive routines like you are now. Not only are you hogging up CPU cycles but you're most likely exhausting memory (especially if you're not disposing objects that require it, like the original Image that was assigned to the PictureBox.Image property).
You should consider using a timer that you enable once (don't enable it again if it's already enabled and use state variables like I mentioned in the first paragraph) and lets it run - don't execute your code continuously if you don't need to, and always dispose objects that implement IDisposable (like the Image and Bitmap classes, among many others) if you need to free memory immediately (for classes that follow the disposable pattern, they will eventually be released but only when the GC decides to clean-up that generation).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
thanks for your help...
But I´m using a variable bool to stop the cycle that is running in MouveHover...
If you take a look, the only thing that mouseleave do is to put this variable bool to false in order to make that the if condition inside the cycles don´t execute.
The problem is that the mousehover continues to execute when I make the mouse leave the pictureBox.
I am usign the Visual Studio in DEbug mode and I put a breakpoint in the first instruction of mouseleave and this instruction is only executed when the cycle for in mouvehover ends =/
I think it´s a problem of two much memory occupied.
Your advice is to make a Dispose of the Image after the Refresh statement, isn´t it?!
I made that, you are right my program now occupies less memory, but the problem with the mousehover/leave persits =/
Thanks a lot
|
|
|
|
|
Sorry, I missed that the first time. It really helps if you post code correctly on this site. Use <PRE> tags (or the "pre" toolbar button below) for code blocks (that way you can tabify your code and use a fixed-width font) and <CODE> tags for inline code (like variables, methods, and even the tag names I mentioned, which are HTML-encoded).
As I mentioned before, the code inside MouseHover will continue to execute. The event will not fire anymore, but that doesn't stop the implementation from continuing. Unless you stop the code somehow it will continue.
The problem you're facing is because your handlers for both the MouseLeave and MouseHover events are running in the same thread. Your MouseLeave event handler won't execute until your MouseHover event handler completes.
There are many ways to solving this, but you really should read about threading applications if you're not familiar with it already. You can start by reading Threading[^] in the .NET Framework SDK on MSDN Online.
You execute your MouseHover event handler implement in a separate thread (move it into a new method). What you absolutely must do is use Control.Invoke to actually set the PictureBox.Image - you must make modifications - and most often, even read properties - from within the thread on which the control to be modified was created. If you don't, undefined problems may - and most often do - occur.
This way, since that code is executing in a separate thread your MouseLeave event handler is called at the proper time and your variable is set. When your MouseHover implementation loop reads that variable (that you don't need to invoke to get; only properties and methods that interop with the Win32 APIs for the control class, since every Windows Forms control encapsulates Win32 APIs and most encapsulate the Windows Common Controls) can stop and everything happens in the right order.
Another way is to start the MouseHover implementation in a separate thread, which you keep a reference to. In your MouseLeave event handler, call Abort on that thread reference, but make sure you handle any ThreadAbortException s that will be thrown.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|