|
Thanks,
There is no \ in c#
so i guess i should do:
public int GetHiWord( int lparam )
{
return lparam / (0x10000 & 0xFFFF); // or ? return lparam / 0x10000 & 0xFFFF;
}
public int GetLoWord( int lparam )
{
return lparam & 0xFFFF ;
}
|
|
|
|
|
You're right. Good catch.
As for whether or not to use parens, I'm not sure which operator will execute first. I would suggest using the parens for clarity, just to make sure the point gets across.
Michael Flanakin
Web Log
|
|
|
|
|
Hi.
I'm new to the Sharepoint portal server 2003 (or any other sharepoint for that matter) and I need to get to know how to develop stuff for it.
I've messed around a bit with building webparts and now I want to know how to make custom lists.
However i'm having trouble finding any good rescources on the subject.
Is there anyone here that can point me to some good forums/guides/tutorials/SDK's/etc. ?
p.s. I have been through MSDN and I don't seem to be able to find anything other than developing webparts there.
|
|
|
|
|
troels_sorensen wrote:
I have been through MSDN and I don't seem to be able to find anything other than developing webparts there.
And you won't...yet. There will be better WebPart support in .NET Framework 2.0 to be released in the beginning of 2005 (SQL Server "Yukon" is holding it up).
We've been working with it here and some associates upstairs in our complex use it as the base for their product as well. We all contend that the documentation - for what little there is - sucks for SharePoint.
For one, when you install SharePoint Services on your Windows Server 2003 box, you have to manually copy the Microsoft.SharePoint.dll assembly to your development box. Some SDK, huh? Examining that with ildasm.exe that comes with the .NET Framework SDK is definitely handy, or use a good decompiler like .NET Reflector[^].
You should also check out http://www.sharepointcustomization.com/[^]. It's not the greatest, but it does have examples.
Finally, get yourself a copy of FrontPage 2003. Now, I'm not big on WYSIWYG editors, but FP 2003 is a vast improvement - event for HTML editing capabilities - over previous versions. It also specifically targets SPS with a lot of great support. It's well worth it, IMO.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yeah... documentation.... guess I'll just have to guess then, since microsoft wants it that way.
Looking forward to the new version!
Thanks for the link.
|
|
|
|
|
I'm developping an application where I need to serialize objects. But the properties of these objects may change during the developpment as I could add new options.
For instance, I may have this
class Car
{
// version1
string ModelName;
int Speed_Mph;
}
And then I want to serialize an array of Car into a binary file (foo.sav)
Later, I add the color :
class Car
{
// version1
string ModelName;
int Speed_Mph;
// version 1.1
string Color;
}
Now, if I try to used the deserialization function with foo.sav, it won't work, because foo.sav didn't contain the Color properties for Car.
What is the easiest / msot efficient way to solve it?
I have several ideas in mind, but I don't know the better ones.
The most efficient one seems to be to write my own ISerializable interface, and start by reading the version. It works, but I'm afraid it's a lot of work, as I need to assign the keys one by one, needn't I?
|
|
|
|
|
One way would be to implement the ISerializable interface and take these things into account yourself. Another way - especially if your assemblies are versioned (or better yet, strongly named) - is to extend the SerializationBinder and override BindToType so that when an older Type (since a Type name includes not only the fully-qualified class name but also the assembly information) you bind it to your new Type. You'd still have to take into account any changes, but this is a common and pretty efficient way of solving the problem of versioning. See the documentation for the SerializationBinder method in the .NET Framework SDK for more information and an example.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
no i have nothing from what u say but i wanna the whole story of using the barecode if have a breif idea about the way to handle the barecode numder from the any kind of serial barecode scanner i dont know any thing about that stuff and i ask any one to help me by him self or by sending me any url to help me in that stuff
and i search and found all the code write in that is for the way to print the barecode but i wanna to input it and how to handle it
thank u and i hope i make my self more clearar
|
|
|
|
|
See your thread in the VB.NET forum. Please keep the cross-posting to minimum.
RageInTheMachine9532
|
|
|
|
|
Dear Guys:
I would like to build a GUI-Application(in BCB5) that can "simulate" behavior just like "DOS Prompt", it should also get vertical-scroll bar(can view history command) & Block-Marking for copy function.
>dir
edit.000 0 3-24-04 11:49
edit.001 0 3-24-04 11:49
edit.002 0 3-24-04 11:50
>asdf
Unknown command "asdf"
>x
^cursor blinking here~
Would you please hint me what component I should choose?(MEMO?...)
BR
JP Chou
|
|
|
|
|
And your asking a question about Borland C++ in a Microsoft C# forum why.....?
Your question is much better suited for a Borland Forum.
RageInTheMachine9532
|
|
|
|
|
I'm sorry!I thought the concept/algorithm is the same...
Anyway~Thanks for your remind...
|
|
|
|
|
The problem came in when you asked for components. The components that come with the Microsoft developement environments are different from those that come with Borland's.
But in your case, I don't think the components will be of much use, except for a TextBox anyway. How complex this gets depends on the command set you want your Shell to understand and what you want it to do.
If you want to just pass what is typed in your shell to a command prompt and get information back, that's not too hard for us Microsoft user because we can tap into the standard streams of a console window pretty easily in the .NET world. I don't know that is going to work in Borland's.
If you want to write a replacement for a Console window, you've got a lot of work ahead of you. Parsing command lines, executing other programs, any batch commands and scripting, ...
It all depends on what you want it to do...
RageInTheMachine9532
|
|
|
|
|
HI,
I can't find out the end of line in C#. It's like chr(13) in VB. Anybody helps me?
My project is: I want to display a text file in RichTextBox. Then, I want to capture all the text to fill in a text box. And I want to replace the end of like by ";".
Thank a lots
Don't smile at me if silly question, 'cos I'm a beginner to C#
|
|
|
|
|
Are you looking for the "\n" or System.Environment.NewLine ?
----------------------------------------------------------------------
T Manjaly
C# Tutorials and samples : http://www.dotnetspider.com
|
|
|
|
|
Thank you!That's right.
txtString=txtString.Replace("\n",";");
|
|
|
|
|
i am doing my final year project on remote desktop control.Till now i have captured the image of remote desktop.Now i want to control it remotely.tell me some functions to do this.I want to do this in C#. As I am doing my hole project in C#
mughalali
|
|
|
|
|
Simply capture the screen coordinates of the mouse click and translate those through to the remote desktop.
Honestly, though, .NET is far too high-level at this point for an effective remote desktop application. Terminal services - which RDP uses - actually uses a virtual frame buffer that "intercepts" the output destined for the graphics card and displays that in your remote client. So if a program were to draw a simple line, that line would be drawn to the virtual frame buffer instead of having to grab an entire screenshot in a loop. Using this much more efficient approach requires low-level code and a lot of functionality in the Microsoft DDK. While it may be possible to P/Invoke what you need, there would be a LOT to do. If you're serious about carrying this project through, you should take a look at this approach that the major commercial solutions use.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Please if u can tell me some functions in Microsoft DDK to achieve my goal,or tell me some book for this article.
|
|
|
|
|
Sorry, but this is not an area I venture into. Just download the DDK and look over the docs. You might also check-out some open source implementations of similar protocols at http://freshmeat.net[^] or something along those lines.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi All,
Does anybody of you know how to get distinct rows from DataView or DataTable.
Thanks
Ruchi
|
|
|
|
|
The best way is to use the DISTINCT keyword in your SQL statement that fills the DataSet (which contains the DataTable ) or the DataTable , but if for some reason you can't you could try a couple different ways.
The default implementation does support getting distinct values as a simple method call, but you could either sort the DataView , enumerate it and skip adjacent duplicates; or keep a look-up table of what you've already enumerated and compare that as you enumerate your DataTable . In most cases, the former method would be faster and would consume less space.
If you use a look-up table, consider a Hashtable with the distinct field as the key and a reference to your DataRow as the value (it'll be a reference, not a copy, making retrieval faster...unless you clone).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
HI,
Similar to what you suggested, I got an article on Microsoft website. It works but the limitation is what if DISTINCT is to be applied on multiple columns
http://support.microsoft.com/default.aspx?scid=kb;en-us;326176
Add the following Private method to the class definition. This method is the same as the method that is used in other DataSetHelper articles. It is used to compare field values (including NULL).
private bool ColumnEqual(object A, object B)<br />
{<br />
<br />
<br />
if ( A == DBNull.Value && B == DBNull.Value )
return true; <br />
if ( A == DBNull.Value || B == DBNull.Value )
return false; <br />
return ( A.Equals(B) );
}
Add the following Public method to the class definition. This method copies unique values of the field that you select into a new DataTable. If the field contains NULL values, a record in the destination table will also contain NULL values.
public DataTable SelectDistinct(string TableName, DataTable SourceTable, string FieldName)<br />
{ <br />
DataTable dt = new DataTable(TableName);<br />
dt.Columns.Add(FieldName, SourceTable.Columns[FieldName].DataType);<br />
<br />
object LastValue = null; <br />
foreach (DataRow dr in SourceTable.Select("", FieldName))<br />
{<br />
if ( LastValue == null || !(ColumnEqual(LastValue, dr[FieldName])) ) <br />
{<br />
LastValue = dr[FieldName]; <br />
dt.Rows.Add(new object[]{LastValue});<br />
}<br />
}<br />
if (ds != null) <br />
ds.Tables.Add(dt);<br />
return dt;<br />
}
|
|
|
|
|
Yes, all they're doing here is implementing a custom IComparer with which to sort (not really necessary in most cases since two columns with DBNull.Value would still have the same value, but whatever).
The only good way to do this is to use the DISTINCT keyword in your SQL statement. What's wrong with that?
It's either that, or use look-up tables which could be very expensive, especially with large data sets.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
the following are my classes
Class Students.cs
<br />
using System;<br />
using System.Collections;<br />
using System.IO;<br />
using System.Runtime.Serialization;<br />
using System.Xml.Serialization;<br />
namespace WindowsApplication1<br />
{<br />
[Serializable]<br />
public class Students<br />
{<br />
int index = 1;<br />
ArrayList students = new ArrayList();<br />
public Students()<br />
{<br />
}<br />
<br />
<br />
public void AddStudent( string name, string add)<br />
{<br />
Student t = new Student(index++, name, add);<br />
students.Add(t);<br />
}<br />
public void RemoveStudent(int sID)<br />
{<br />
foreach(Student s in students)<br />
{<br />
if (s.StudentID == sID)<br />
{<br />
students.Remove(s);<br />
return;<br />
}<br />
}<br />
return;<br />
}<br />
<br />
public ArrayList Items<br />
{ get {return students;} }<br />
<br />
public Student this[int index]<br />
{<br />
get<br />
{<br />
foreach(Student s in students)<br />
{<br />
if(s.StudentID == index)<br />
return s;<br />
}<br />
return null; <br />
}<br />
}<br />
}<br />
}<br />
<br />
<br />
Class Student.cs
using System;<br />
using System.IO;<br />
using System.Runtime.Serialization;<br />
using System.Xml.Serialization;<br />
namespace WindowsApplication1<br />
{<br />
[Serializable]<br />
public class Student<br />
{<br />
private int intStudentID = 0;<br />
private string strName = "";<br />
private string strAddress = "";<br />
<br />
public Student(){}<br />
public Student(int sID, string n, string a)<br />
{<br />
StudentID = sID;<br />
Name = n;<br />
Address = a;<br />
}<br />
public int StudentID<br />
{<br />
get{return intStudentID;}<br />
set{intStudentID = value;}<br />
}<br />
public string Name<br />
{<br />
get{return strName;}<br />
set{strName = value;}<br />
}<br />
public string Address<br />
{<br />
get{return strAddress;}<br />
set{strAddress = value;}<br />
}<br />
}<br />
}<br />
The following is the code that I have used to attempt to serialize the class.
StreamWriter w = null;<br />
try<br />
{<br />
XmlSerializer ser = new XmlSerializer(typeof(Students));<br />
w = new StreamWriter("class.xml");<br />
ser.Serialize(w, Hstudents);<br />
}
catch (Exception ex)<br />
{<br />
string strErr = String.Format("Unable to serialize class, error '{0}'",<br />
ex.Message);<br />
MessageBox.Show(strErr,"Serialize Error",MessageBoxButtons.OK,<br />
MessageBoxIcon.Error);<br />
}
finally<br />
{<br />
if (w != null) w.Close();<br />
w = null;<br />
}
If i change it to work with binary serialization, the serialization works fine. Is there somethign special that i have to do to the classes to get it to serialize correctly?
|
|
|
|