|
Did you ever get a response?
I need to port an application from C++ to C# that used CWinThread too
|
|
|
|
|
I cann't understand how I should check for user in Active Directory.Evry time when I try to check for somethink in Active Directory thete rise this kind of exeption.
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://CN=Alabala");
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("objectClass=user");
foreach(System.DirectoryServices.SearchResult resEnt in
mySearcher.FindAll())
{
Console.WriteLine( resEnt.Path );
}
}
catch(System.Runtime.InteropServices.COMException ex)
{
Console.WriteLine(ex.Message);
}
|
|
|
|
|
Before you say it, yes I'm using the default DoubleBuffer Method of a control.
My problem is this. I'm writing a custom drawn 3D progress bar. I've made the control and it all works swell, i'll eventually write an article about it etc...
But it flickers really bad. Peterchen has tested it and has the same problem.
I think i've narrowed it down to the fact that I'm refreshing the whole control, wait, hear me out.
The graph is Pseudo 3D, it is made up of three 'panels' which are constructed using 7 points. these points are inter related and depend on each other to work. I've tried other methods and this worked the best in my head.
Now, if the tick step is a long interval,then the problem is solved, because its not trying to refresh itself as much and the CPU can cope.
How can I get it to draw just the updated bit of the graph. Below are links to the binaries and the source as it stands now.
http://www.nonny.com/CP/SetiBar.zip[^]
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "But a fresh install - it's like having clean sheets" - C. Maunder Lounge 3 Mar '03
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
As you code is right now there isn't much you can do to stop the flicker. But if you make the control smarter then you can eliminate most of it.
The causes of flicker are pretty basic: You take a picture, erase it, then draw over it again.
If you can skip the erase step or instead just draw over it, then you can eliminate the majority of flicker in an application. That is why the "use DoubleBuffer is said often" because you do both steps.
After looking at your source you have enabled the DoubleBuffer style bit but you missed the other two that need to be set with it, AllPaintingInWmPaint and UserPaint . That may do the trick for you, because the first one tells it to skip the drawing of the background and the second one tells the framework you are doing the drawing and not the OS.
If that doesn't do it, then you'll need to add some more intelligence to your repainting by calling Invalidate and passing in a rectangle or region which contains the area of the control that has changed. This will make the only part of the control to change be the part that was updated. As an optimization you can make the OnPaint handler paint only what it needs to by inspecting the ClipRectangle property of the PaintEventArgs.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
James T. Johnson wrote:
AllPaintingInWmPaint and UserPaint
I said it before and I'll say it again here, you are a genius. OK it was simple, and I was stupid. But thank you!
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "But a fresh install - it's like having clean sheets" - C. Maunder Lounge 3 Mar '03
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
When user press DELETE button on datagrid ,it delete the row in datagrid.I want ask user before delete and add that row again if he/she does not confirm it.Something like what happend in MSAccess when you delete a row in datagrid.
I did some research and found RowUpdating event and I can cansel deleteing row from dataset and prevent updating dataset(with UpdateStatus.SkipCurrentRow ),but datagrid does not refreshed and deleted row in datagrid does not come back again until I close application and open it again.So if I know how to refresh datagrid correctly I can solve it too.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Ignore that suggestion (message deleted, but I know you'll be notified). I thought I was in the ASP.NET forum.
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Well,I found it,I have to FIll DataAdapter again but I don't know if it is good way.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Well I found better one:
DataSet.RejectChanges()
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Okay, im really a bit baffled here. I am putting together some code from two different samples on here, to make a WinZip-compatible CRC32 ColumnHandler for explorer, to make my work go easier.
The code uses a bit-field for a WinAPI call. Now, i was always taught that if you have a bit-field, and you want to set one of the flags in it on, then you OR them together, and if you want to check if a field has a particular flag on, then you AND them.
So i tried this, and it crashed my devenv process. So, just for kicks, i tried reversing them, and low-and-behold, it works!
C#:OR apparently is equal to the rest of the world's, AND.
C#:AND apparently is equal to the rest of the world's, OR.
at least bitwise.
Did Microsoft actually get so bold as to decide to rewrite the laws of logic? This is absolutely bizarre.
|
|
|
|
|
Whosit wrote:
This is absolutely bizarre.
It certainly is. If I were to take a guess I would say there is some greater problem somewhere else in your code, because bitwise-or and bitwise-and work the same as they do in C/C++.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Well, i dont think so, but its not mostly my code. To make my CRC32 ColumnHandler i took the ColumnH code from the first project below, and just dropped in the CRC32 class from the second one in place of the MD5 code. The only other changes i made (which is where i had the & vs. | problem) Is below...
http://www.codeproject.com/csharp/ColumnHandler.asp
http://www.codeproject.com/csharp/crc32_dotnet.asp
In the implementation of GetColumnInfo i changed the column title and description and then:
psci.fmt=LVCFMT.RIGHT;<br />
psci.cChars=40;<br />
<br />
psci.csFlags=SHCOLSTATE.TYPE_STR;
to
psci.fmt=LVCFMT.LEFT;<br />
psci.cChars=40;<br />
<br />
psci.csFlags=SHCOLSTATE.TYPE_STR & SHCOLSTATE.ONBYDEFAULT & SHCOLSTATE.SLOW;
The last line setting csFlags is where i had problems. When i tried to use the OR (|) it consistently hung. But when i use the AND (&) it works just beautifully with the right results and all.
Then what threw me off even more was a line (unchanged) in GetItemData which reads:
if(((FileAttributes)pscd.dwFileAttributes|FileAttributes.Directory)==FileAttributes.Directory)
Where the original author is checking the flag with an OR.
This is all quite backwards from what i know of bit-wise logic.
Any explanations or ideas why this is?
|
|
|
|
|
whosit wrote:
Any explanations or ideas why this is?
I can't think of any reasons, but a quick test shows that what we know of as bitwise logic is what C# uses.
[Flags()]
public enum Enum
{
A = 1,
B = 2,
C = 4,
D = A | B,
E = 8,
F = 64
}
[STAThread]
static void Main(string[] args)
{
Enum e = Enum.A;
Console.WriteLine("e = {0}", e);
e = Enum.A | Enum.C;
Console.WriteLine("e should equal (A): e = {0}", e);
if( (e & Enum.A) == Enum.A )
Console.WriteLine("Enum.A is set");
else
Console.WriteLine("Enum.A isn't set");
e = (e | Enum.B);
Console.WriteLine("e should (A, B, C) or (D, C): e = {0}", e);
if( (e & Enum.C) == Enum.C )
Console.WriteLine("Enum.C is set");
if( (e & Enum.B) == Enum.B )
Console.WriteLine("Enum.B is set");
if( (e & Enum.A) == Enum.A)
Console.WriteLine("Enum.A is set");
e = e | Enum.E;
if( (e & Enum.E) == Enum.E)
Console.WriteLine("Enum.E is set - correct usage");
if( (e | Enum.E) == Enum.E)
Console.WriteLine("Enum.E is set - incorrect usage");
e = e & (~Enum.E);
Console.WriteLine("e should be (A, B, C) or (D, C)...e was unset: e = {0}", e);
Console.ReadLine();
} The output should be:
e = A
e should equal (A): e = A, C
Enum.A is set
e should (A, B, C) or (D, C): e = D, C
Enum.C is set
Enum.B is set
Enum.A is set
Enum.E is set - correct usage
e should be (A, B, C) or (D, C)...E was unset: e = D, C Now as to the next part...
whosit wrote:
Then what threw me off even more was a line (unchanged) in GetItemData which reads:
if(((FileAttributes)pscd.dwFileAttributes|FileAttributes.Directory)==FileAttributes.Directory)
Where the original author is checking the flag with an OR.
The code above would work, so long as pscd.dwFileAttributes had either no flags set or just the FileAttributes.Directory flag set, in which case the bitwise-or effectively does nothing and the check continues to work.
Doing a quick test if I change the | to the proper & it still works as expected, and taking a look at some directories I can't find any that don't report to contain some read-only files, even dirs with no files in them. Trying to change that (by unchecking readonly in the dir properties box) has no effect.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Oh well, must be some 'feature' to make logic easier for..... someone. *shrug*
Thanks anyway. At least it works, even if it IS backwards (in my case).
By the way, which epsidoe is your Data quote from in your sig?
|
|
|
|
|
whosit wrote:
if(((FileAttributes)pscd.dwFileAttributes|FileAttributes.Directory)==FileAttributes.Directory)
I played around a bit more with the sample and indeed the code above doesn't work like the author intended, but because he wrote exception-safe code you never know it.
I through in some System.Diagnositc.Trace.WriteLine calls through out the function, the first was in the if statement where I told it to print the FileAttributes of the item that caused it to trigger the return. Interesting, as I thought only those that are have Directory get printed.
Then I added some code in the exception handlers to print out the exceptions and the FileAttributes of the item that had the exception. Each of the exceptions was Access to the path "C:\path" is denied. and the FileAttributes was Directory and ReadOnly or Directory and System.
whosit wrote:
psci.csFlags=SHCOLSTATE.TYPE_STR & SHCOLSTATE.ONBYDEFAULT & SHCOLSTATE.SLOW;
As to why you had to use & for it to work, I assume it deals with the stuff above. That is my next thing to try
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Ahh..... so the directory check then in fact actually *SHOULD* be an AND and i dont just have some messed up compiler? Thats Very good to know.... now i can feel safer about my sanity
|
|
|
|
|
bitwise operators work just fine in c#
1 | 1 gives 1
0 | 1 gives 1
1 | 0 gives 1
0 | 0 gives 0
just as it should
1 & 1 gives 1
0 & 1 gives 0
1 & 0 gives 0
0 & 0 gives 0
just as it should to ..
//Roger
|
|
|
|
|
Hi All,
I'm having a problem with (as you could probably tell from the title) javascript in the webbrowser control. On the page I'm trying to get working there are some text boxes that should automatically fill in when you type a few characters, but for some reason they're not working. If I try the page in IE they work fine. I didn't create the page I'm just using it. Any ideas as to why the javascript wouldn't be working with the browser control? Is there a setting I need to make?
Many thanks in advance.
|
|
|
|
|
monrobot13 wrote:
Is there a setting I need to make?
No. However some functions do not work in a web browser control. There is no documented list of such unsupported functions.
monrobot13 wrote:
why the javascript wouldn't be working with the browser control?
Do you see any error message box ?
And while you are in a stand-alone Internet Explorer instance, where it seems to work fine, do you have a yellow icon in the status bar (which signals javascript errors) ?
|
|
|
|
|
First, thanks for the reply.
.S.Rod. wrote:
Do you see any error message box ?
No, there is no error box that pops up.
.S.Rod. wrote:
And while you are in a stand-alone Internet Explorer instance, where it seems to work fine, do you have a yellow icon in the status bar
I just checked an no there is no error icon. Something strange that I noticed last night though. On the site, if you type something incorrect into the box, when it loses focus it deletes the text. Now, in my program that part works (I assume it's done in javascript as well) the only thing that doesn't appear to be working in the autocomplete thing that it does.
It's really baffling and grating on my nerves. Any ideas or help would be very much appreciated.
|
|
|
|
|
It looks like an issue originated by a rather specific combination of javascript source code. I am afraid you'll have to post portions of it.
monrobot13 wrote:
Any ideas or help would be very much appreciated.
The best idea I can come across is to tell you to post on the right forum. The issue is not related to C#.
|
|
|
|
|
Here's a good one ...
Assembly C (.DLL) exposes (among other things) a number of type converters.
Assembly B (.DLL) exposes a derived form containing a PropertyGrid that 'uses' C's type converters.
Assembly B therefore has a static project reference to C.
Assembly A (.EXE) dynamically loads assembly B and displays B's form as a child of A's main form.
The problem is, the PropertyGrid 'loses' the type converters and the associated properties appear as greyed out text (the namespace qualified type name to be exact). I assume that internally PropertyGrid uses reflection to create C's type converter instances but C is 'invisible'.
The problem is fixed by adding a reference to C in project A but this is undesirable since C may not actually exist for a particular installation.
Loading C dynamically from A (tried both Assembly.LoadFrom and AppDomain.Load) is successful - AppDomain.GetAssemblies reports C as loaded but the PropertyGrid still falls down.
Any ideas ?
Thanks in advance
Anders
|
|
|
|
|
try to use attributes
<br />
[Designer( "UtilityLibrary.Designers.WizardFormDesigner, UtilityLibrary.Designers, Version=1.0.4.0, Culture=neutral, PublicKeyToken=fe06e967d3cf723d" )]<br />
In bold is a sumbolic name of assembly. By such name Framework can find and load needed assembly. In your case look for Convert attributes:
<br />
[ Category( "Appearance" ), <br />
DefaultValue( -1 ),<br />
Description( "GET/SET toolbar item image from Image List" ),<br />
Editor("System.Windows.Forms.Design.ImageIndexEditor, System.Design, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor)),<br />
TypeConverter( "System.Windows.Forms.ImageIndexConverter" ) ]<br />
Such knowladge can help
Good Luck
Alex Kucherenko
|
|
|
|
|
Hi , when and how are .net attribs activated?
is it at compiletime?
if i create my own attrib and apply it to a class like this:
[MyAttrib("tjoflöjt")]
public class{
}
is the text "tjoflöjt" injected into the assembly somehow when compiling ,
or is an instance of my "MyAttrib" class created once the assembly is loaded into memmory?
attribs like "AssemblyXXX" can stop the compiler and notify the user on various things like ".snk file not found" , is it possible to do the same thing with my own attribs?
//Roger
|
|
|
|
|