|
Hi everyone,
I am hoping to build a C# application that would interact with Outlook Express 6 and xtract attatchments under my identity to a specific folder. In between this process it would have to check if the attatchment is already saved in the folder, but those tasks would be possible with the IO classes of the .NET framewrk. But how about getting into the Outlook program ? How do I handle that ? Is there a COM object that ships with OE6 or are there free .NET libraries to access OE's object model ?
I searched the web and all i could find was code snippets and articles relating to the office version of Outlook.
Please explain how i should handle this solution or give me some links to any web resources.
Thanx a lot !
|
|
|
|
|
erajsri wrote:
there free .NET libraries to access OE's object model ?
They could only access it if the COM objects exist. My guess is that they don't.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all
My Error is " Cannot implicitly convert type 'object' to'CIODMLib.CatAdmClass' "
The code segment is as follows;
public class Indexing
{
protected CIODMLib.AdminIndexServerClass admNew;
protected CIODMLib.CatAdmClass catNew;
public Indexing()
{
admNew = new CIODMLib.AdminIndexServerClass();
catNew = new CIODMLib.CatAdmClass();
}
public object InitializeCatalog(string strName, string strLoc)
{
admNew.AddCatalog(strName, strLoc);
return admNew.GetCatalog();
}
public void AddNewScope(string strName)
{
catNew = admNew.GetCatalogByName(strName);
}
}
public class IndexingAp
{
public static void Main(String[] args)
{
Indexing newAdm = new Indexing();
Indexing newCat = new Indexing();
newAdm.InitializeCatalog("myCat","C:\\myCatalogFolder");
newCat.AddNewScope("myCat");
}
}
I even tried
"catNew = (CIODMLib.CatAdmClass)admNew.GetCatalogByName(strName);"
Then error "'System.InvalidCastException' occurred Specified cast is not valid." occurs
Can some one please help me???
|
|
|
|
|
try object o = admNew.GetCatalogByName(strName);, then step through in the debugger to see what you're getting back. Perhaps it's null.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I guess GetCatalogByName is not returning a type that can be cast to CIODMLib.CatAdmClass . As CG said, try running it under the debugger or add a
System.Diagnostics.Debug.WriteLine((admNew.GetCatalogByName(strName)).GetType().ToString());
to see what exactly it is returning.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hi all,
I want to synchronize client and server databases using C# application..
How do i do it?
any answers will be appreciated.
thanks in advance..
|
|
|
|
|
What is the state of the databases before hand ? Do you know the schema ? Do both databases exist ? Can you write whatever stored procedures you like on these databases ? The easiest thing would be to drop all foreign keys and so on, then copy the data across, a table at a time, and finally readd the constraints. But I'm also assuming you only need to syncronise data.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a richtextbox with the following event handler for the ContentsResized event. The richtextbox Multiline property is set to true and the Scrollbars property is set to none.
The problem I have is when typing in lines of text. The first line dissappears (scrolls) above the top of the richtextbox. Other than that the richtextbox resizes itself accordingly.
Can anyone please help me rectify this problem? Am I using the correct method? Is there a better way to do it?
The code for the event handler:
private void ContentsResized(object sender, System.Windows.Forms.ContentsResizedEventArgs e)
{
// Create a new object that refers to the control that fired the event
RichTextBox richBox = (RichTextBox)sender;
Font stringFont = richBox.Font;
string queString = richBox.Text;
System.Drawing.Graphics objGraphics;
objGraphics = CreateGraphics();
SizeF layoutSize = new SizeF(richBox.Width, ClientRectangle.Height);
SizeF stringSize = new SizeF();
stringSize = objGraphics.MeasureString(queString, stringFont, layoutSize);
richBox.Height = Convert.ToInt32(stringSize.Height);
objGraphics.Dispose();
resetPositions();
}
|
|
|
|
|
Hello, guys
I got a problem of calling class methods from C++ dll in my C# program.
My old dll is standard C++ dll. For non-class methods, I decorate the method with:
extern "C" _declspec(dllexport)double myMethod(double b, double h);
Then I can use the following to call the method foo in C#.
[DllImport("my.dll")]
public static extern int foo();
But if it is a class, I use the following syntax to decorate it:
class __declspec(dllexport) myClass{
... ...
}
But this time, I don't know how to it and .NET throws exception of "Additional information: Unable to find an entry point named fndllclasstest1 in DLL my.dll".
Could anyone help me figure out how to call class method from a standard dll in C# applications?
Many thanks
Ivyhill
|
|
|
|
|
go to command prompt where your dll is located.
type: dumpbin -exports xxx.dll
you might get something like this
1 0 00001B60 ?Foo@@YAXXZ
with some other data. The data above is your exported function from your c++ dll.
Next step is to get the function.First, you need this line to interoperate between your c++ dll and c#
using System.Runtime.InteropServices;
Then this is how you call your function by setting the entry point to the information given.
[DllImport(@"cntr.dll", EntryPoint="?Foo@@YAXXZ", CallingConvention=CallingConvention.StdCall, SetLastError=true)]
public extern void Foo();
that's all you need.
|
|
|
|
|
Thanks Mervick. It works.
|
|
|
|
|
I have the following two chunks of code:
1)
NetworkStream networkStream = new NetworkStream(member.socket);
System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(networkStream);
...
2)
NetworkStream networkStream = new NetworkStream(s);
System.IO.BinaryWriter bw = new System.IO.BinaryWriter(networkStream);
...
What would be the order for closing the streams and flushing? And do I need to do both on both the client and server side?
IE:
1)
streamWriter.Flush();
streamWriter.Close();
networkStream.Flush();
networkStream.Close();
2)
bw.Flush();
bw.Close();
networkStream.Flush();
networkStream.Close();
Thanks
|
|
|
|
|
You don't need to close the NetworkStream after closing the StreamWriter , the StreamWriter does it for you. MSDN says "Closes the current StreamWriter and the underlying stream". And closing the StreamWriter flushes it, so you don't need to Flush<code> before <code>Close
In short, all you need is
streamWriter.Close();
And you must close it both on the client and the server, each end creates some resources that must be released by calling Close .
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks.
|
|
|
|
|
I've 2 forms i want set a text inside the second form by the first one.
If i try i get a compiler error about permissing, the object (textbox is private).
What i heve to do?
|
|
|
|
|
hi,
can you change class where is your textbox private ? If so you can change textbox's modifier to public (not recommended) or internal (better) or you can write property for setting/getting value of textbox (recommended).
public means that everybody can directly change textbox's value - that's not good idea. internal means that everybody (classes) in same assembly can change textbox's value - that can be useful in some scenarios. By writing (public) property, you gain control over how and when can value change... e.g. you can have test for valid format of string or something and change actual value only if it's format is ok...
hope it helps
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
i've tried to set on modifier the value public but i get not permissing yet. why?
[quote]
you can write property for setting/getting value of textboxt
[/quote]
can you show me how?
|
|
|
|
|
Anonymous wrote:
you can write property for setting/getting value of textboxt
Anonymous wrote:
can you show me how?
public string TextBoxText<br />
{<br />
set(this.textBox1.Text = value;)<br />
get{return this.textBox.Text;}<br />
}
|
|
|
|
|
KEF
|
|
|
|
|
|
Is that a new code in c 2.0 ?
|
|
|
|
|
Is there a good way to debug Client/Server code, or rather, code in general? I have not familiarized myself with the Debugging options and therefore have noticed some odd behaviors IE: in debug mode, the program acts a certain way, which is wholly different from the way it acts during regular execution. Any good articles regarding .NET debugging that could aid me? Thanks.
|
|
|
|
|
In Visual Studio, you can go into the properties of your solution that contains both client and server projects, and set the start-up project to include both client and server projects. That way, when you start debugging, both client and server will be launched under the debugger.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: The Secular Left, the Religious Right, and Prejudice
Judah Himango
|
|
|
|
|
You are running into the classic problem with these client-server systems. The Client and the Server are operating in different application domains that occationally overlap and communicate with each other. Trying to debug these types of systems requires a level of understand that goes beyond what is normally done in "regular execution". Objects are not automatically available to either domain. Paths as well as context sensitive information are not the same in either domain. So on and so forth.
It is almost always easier to debug the Client application domain. The development tools are often available as well as the process so you can just attach the debugger and go. The Server application domain is often unavailable especially when on another machine that might not even be on the same network. It is also often a very bad idea to stop the server application domain in mid processing since whatever resource is still waiting for it to complete, like IIS. Defer processing or delay too many of these and your server can start acting weird.
One trick I always like to do especially if IIS is available is to report right to the HttpContext which can be inspected by "Trace.axd". Another trick I've learned to use is to have extensive log files that are coded into the server portion.
|
|
|
|
|