|
Nick Parker wrote:
This is not inherently correct. While it maybe in the context of C++ (i.e.; no header files in C#), you can have a separate file that is part of the same namespace which simply defines interfaces. These interfaces can then be implemented throughout your application as a whole. This could be seen as a separation of declaration and implementation.
That's Wright.
Thank You
Bo Hunter
|
|
|
|
|
Has anybody attempted the following? If not, once I've done it, I'll submit the article!
I want to set up a class that holds a collection of arrays and lets you set up calculations on the arrays that are then run as a block. The calling code would then look something like:
ArrayContainer ac = new ArrayContainer(0, 250);
ContainedArray array1 = ac.NewArray();
ContainedArray array2 = ac.NewArray();
ContainedArray array3 = ac.NewArray();
ac.DefineCalculations();
array1.CurrentRow = array2.CurrentRow + array3.LastRow;
array2.CurrentRow = array2.LastRow - 3;
array3.CurrentRow = array1.LastRow * 2;
ac.DoCalculations();
The last line makes it go through all 251 rows of the three arrays iteratively carrying out the calculations.
Many thanks
Bernard
|
|
|
|
|
There's one major problem:
array1.CurrentRow = array2.CurrentRow + array3.LastRow;
array2.CurrentRow = array2.LastRow - 3;
array3.CurrentRow = array1.LastRow * 2; This will be executed as-is by the CLR because the expressions are compiled to IL as you see them. Instead, you should consider storing an expression string as you could with a ColumnHeader (for a DataGrid ). You would have to devise somewhere to parse this expression, thoug, perhaps using a string tokenizer like we've done in our app I architected at work. There is an article that includes source that was the basis for our string tokenizer: http://www.c-sharpcorner.com/Code/2003/June/JavaLikeStringTokenizer.asp[^]. This may help.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for this - I'll have a look at the article. I broadly had in mind that by overloading the operators, I could have them 'stack up' the commands in a buffer (I had Forth and Reverse Polish Notation in mind). The execute method would then run through the buffer, Emit it (perhaps), and then execute it repeatedly.
|
|
|
|
|
I think this wouldn't be too hard.
class ArrayContainer : CollectionBase (.. blah blah..)
And then just define operators on the ContainedArray class, but with one catch! Just store the actions (iow create a stack), and only invoke it on the DOCalc().
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Hi guys,
I have 2 newbies questions in C#:
- what is the equivalent of WM_NCHITTEST message in C#? I want to detect the movments of a window (Form) when the user moves it with the mouse. I tried the MouseUp and MouseDown events, but it works only in the client area of the form (like for C++)
- how to include a manifest resource in C# to apply the current theme in each forms of the application?
Thanks
Best regards.
bouli.
|
|
|
|
|
First question:
<br />
private int WM_NCHITTEST = 132;<br />
<br />
protected override void WndProc(ref Message m)<br />
{<br />
if(m.Msg == WM_NCHITTEST)<br />
Debug.WriteLine("WM_NCHITTEST");<br />
else<br />
base.WndProc(ref m);<br />
}<br />
Second question: No clue!
|
|
|
|
|
Second question: see my article at http://www.codeproject.com/csharp/dotnetvisualstyles.asp[^]. This works for application targeting the .NET 1.0 Framework on up, though .NET 1.1 added an Application.EnableVisualStyles method that you can call before executing Application.Run in your application's entry point. Note that many people have experienced odd problems with the latter method, though, while the method described in my article works because it's exactly what win32 applications do (also note that the .manifest file can stand alone from app as I mentioned, but then you have to worry about deploying that, too).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
Ok, thanks for your link. The EnableVisualStyles is simple
It's even more simple than in C++
|
|
|
|
|
How do you do that? Let's say you have the following code:
<br />
InternetExplorer ie = new InternetExplorer();<br />
IHTMLDocument2 doc = (IHTMLDocument2) ie.Document;
//NOTE: How do I know when or not the method returns a "new" object vs. using the new keyword? eg. WebRequest wr = WebRequest.Create("...") not = new WebRequest (but I only know that because it's in the documentation) ??
Back to InternetExplorer: the problem arises when I try to access any of it's interfaces. Example:
<br />
Object oNull = 0;<br />
Object oNullString = "";<br />
InternetExplorer ie = new InternetExplorer();<br />
ie.Navigate("http://www.google.com/", ref oNull, ref oNullString, ref oNullString, ref oNullString);<br />
System.Threading.Thread.Sleep(5000);<br />
IHTMLElementCollection ec = null;<br />
ec = (ie.Document as IHTMLDocument2).all;<br />
<br />
All the above works perfectly. Now:
ec.item(I don't even know how to use the params properly) or ec.tags("BODY") for example all give me one error: Referenced object does not exist in memory, or something of that sort that means you can't access it.
Help! Good book? Good article?
Sammy
"A good friend, is like a good book: the inside is better than the cover..."
|
|
|
|
|
First, an empty string ("") is not the same as null . For the null parameters, you should actually do something like this:
object missing = System.Reflection.Missing.Value;
object url = "http://www.google.com";
ie.Navigate2(ref url, ref missing, ref missing, ref missing, ref missing); As you can see above, too, I use Navigate2 . This is recommended by the IE Programming documentation.
As far as casting vs. new , you want to use casting. When you cast to an interface that is delcared as a RCW interface, this results in a QueryInterface of the object as you would do in C++ regarding COM. If null is returned, the object does not implement the interface.
There are several good articles about using the WebBrowser control. See the following search results for a few (especially the top ones): http://www.codeproject.com/info/search.asp?cats=3&cats=5&searchkw=WebBrowser[^].
Also, use the WebBrowser control by interop'ing shdocvw.dll to embed "Internet Explorer" in your application. Use the InternetExplorer object if you want to control a remote application instance through out-of-process automation.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Dear, Sir
How to display copyright sign (c in small circle,©) in Label control?
Thank You.
|
|
|
|
|
Well, you can copy it from somewhere, or hold down the alt key and type 0 1 6 9 on your keypad.
|
|
|
|
|
Sune Trudslev wrote:
you can copy it from somewhere
The trusted way I hate trying out ALT keycode combinations!
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Since strings in .NET are stored in Unicode, you can also use "\u00a9".
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
Since strings in .NET are stored in Unicode, you can also use "\u00a9".
Where can I find the resources for using the
'\u00a9' notation.
I have seen them used alot but have never
seen info on what codes mean what.
Thank You
Bo Hunter
|
|
|
|
|
It's just how you escape Unicode characters in a string. To see what the Unicode characters are, you can use the Character Map in the Start->Programs->Accessories->System Tools program group, or go to http://www.unicode.com[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Man all this time I have spent
looking for character codes.
Learn something every day.
Thank You
Bo Hunter
|
|
|
|
|
Hi,
Is there a limit to the number of rows (amount of data) a datagrid can display in a datagrid?
Is there any internal optimization in the datagrid which fetches data from the dataset only for those rows which are visible to the user? ( I saw someone say so in a NG)
Is there a limit similarly for datasets? ( I have read now and again it's only limited by the client's systems' memory...but wanted to make sure )
I am concerned since i need to display ALL the data (around 10K records).
Thanks
Rakesh
|
|
|
|
|
Rakesh Rajan wrote:
Is there a limit to the number of rows (amount of data) a datagrid can display in a datagrid?
See Process.MaxWorkingSet . This gets or sets the maximum amount of memory allowed in memory for the given Process .
Rakesh Rajan wrote:
Is there any internal optimization in the datagrid which fetches data from the dataset only for those rows which are visible to the user?
Not yet, at least in the .NET base class library. In .NET 2.0 they have introduced several new control classes, including a GridView[^] which supports virtual lists, which is to what you're referring.
There's nothing from stopping you now (there was a good article a LONG time ago about how to do this even in DHTML), but the burden is on you unless you want to buy a commercial solution like a couple from ComponentOne[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Is there a way to render html without using the SHDocVw control? The reason that I don't want to use that control is because I don't want the overhead of the control having internet access. I also want the control to be able to render dynamic html while the SHDocVw control seems to only render static web pages. I would really appreciate some advice or even just a point in the right direction. Thanks
|
|
|
|
|
|
I know I'm missing something obvious.
I'm writing a tool that does some dianostics on processes. I can't seem to figure out how to locate the name of the user running a process or the id of the parent process. Can someone please point me in the correct direction. Thanks
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
One way ( without digging into the debugging APIs ) is to P/Invoke the native functions in the following order: OpenProcessToken , GetTokenInformation , then LookupAccountName . You pass Process.Handle to OpenProcessToken to get an access token. You then get a TOKEN_USER struct by calling GetTokenInformation . Finally, use the SID parameter from TOKEN_USER and call LookupAccountName . This also seems to be partly what taskmgr.exe and tasklist.exe (in Windows XP) are doing. There is actually only tree functions you have to P/Invoke and only a couple structs you have to redefine.
I'm sorry that I couldn't find a way to get the parent process ID. In fact, I couldn't find anything common that does on Windows, not to say it isn't possible.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
If WMI is an option for your tool you can get all that information from it.
Just take a look to the class "Win32_Process". I remember some nice articles about WMI in codeproject.
If you don't find them let me know.
|
|
|
|