|
When you say "It doesn't work" Do you mean it gives an error?
If so, what error message does it give?
If not, what does it do / not do?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Yes, It shows error.
Error is:
"MapiSendMail failed! General Mapi failure [2]"
|
|
|
|
|
Throw people a bone here. There is a lot of code. Which line throws the error?
BTW: You should have added this to your previous thread, below. Not started a new one.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
MAPI and CDO 1.21 are not supported in .NET. See this[^]. Yes, I know the code seems to be right, and it mignt seem to be working fine, but problems will arise when your solution is in production and under a little stress.
|
|
|
|
|
Given these interfaces:
interface IThing {
void Initialize(int value1, int value2);
int Result { get; }
}
interface IThingManager {
void AddThing(string groupName, IThing thingToAdd);
int Sum(string groupName);
int TotalSum();
void Print();
}
Write an implementation of the interfaces in these concrete classes:
class MultiplierThing : IThing { ... }
class AdderThing : IThing { ... }
class ThingManager : IThingManager {
...
void Print() { ... }
}
Example Ouput
Given a main program like this:
IThingManager manager = new VerboseThingManager();
IThing t;
t = new MultiplierThing();
t.Initialize(1, 2);
manager.AddThing("Group A", t);
t = new MultiplierThing();
t.Initialize(3, 4);
manager.AddThing("Group B", t);
t = new AdderThing();
t.Initialize(5, 6);
manager.AddThing("Group A", t);
t = new AdderThing();
t.Initialize(7, 8);
manager.AddThing("Group B", t);
manager.Print();
The corresponding output should be:
Group A:
- 2
- 11
Group B:
- 12
- 15
Sum of Group A = 13
Sum of Group B = 27
Total sum = 40
Please Help me
i made the classes of adderthing & MultiplierThing that inherits from interface IThing and stop
|
|
|
|
|
You just need to implement the interface methods as you have defined them. Thus in each class your Initialize() method should store your variables (this could be done in a base class) and your Result() method should return the sum, product, difference etc as appropriate.
I must get a clever new signature for 2011.
|
|
|
|
|
i konw but i can't do the implementation of
second interface
interface IThingManager
|
|
|
|
|
please i want the implementation of IThingManager Please
|
|
|
|
|
I'll give you a partial implementation. Since it's you homework, do the rest yourself.
public class ThingManager : IThingManager
{
Dictionary<string, List<IThing>> things = new Dictionary<string, List<IThing>>();
public void AddThing(string groupName, IThing thingToAdd)
{
if (!things.ContainsKey(groupName))
{
things.Add(groupName, new List<IThing>());
}
things[groupName].Add(thingToAdd);
}
}
Cheers
If you can read this, you don't have Papyrus installed
|
|
|
|
|
thaaaaanx alot Estys
but i can't complete because i didn`t deal with collections before
and don`t know how to implement the method sum
how to add items in gruopname
and how to read from user to add in groupname
sorry
|
|
|
|
|
Collections are dead easy
The example I gave you already adds things to your group.
To iterate over a collection use foreach :
public int Sum(string groupName)
{
int retValue = 0;
foreach (IThing ithing in things[groupName])
{
retValue += ithing.Result;
}
return retValue;
}
You can do the same for TotalSum. The only difference is to iterate over the things groupNames with KeyValues
Cheers
If you can read this, you don't have Papyrus installed
|
|
|
|
|
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Estys wrote: If you can read this, you don't have Papyrus installed
I DO have Papyrus installed and can still read it. Now what?
|
|
|
|
|
You're just being flippant
If you can read this, you don't have Papyrus installed
|
|
|
|
|
See my answer above.
Cheers
If you can read this, you don't have Papyrus installed
|
|
|
|
|
First of all,I have wrote a programm named "ManageSever.dll".It's the sever for Management software writen by C#language.I hope the IIS can automatic load the file when the IIS runs.Then the Sever for management will start.If it can realize,how should I do?
|
|
|
|
|
You're not really giving sufficient information to be able to deduce what it is you need. What does your program do? How/why does it interact with IIS?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hi,
I want to develop C# application using Windows Live Mail "MAPI".
kindly give me method / samples link
Thank you
(Riaz)
|
|
|
|
|
This is something I had written (or may be copied) long ago. Not even sure if this works but surely gives something to you to start with:
class SendMail
{
#region Constants
private const string sSubject = "You got spammed!";
#endregion
#region Variables
List<MapiRecipDesc> aoRecipients = new List<MapiRecipDesc>();
#endregion
#region Classes
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class MapiMessage
{
public int iReserved;
public string sSubject;
public string sNoteText;
public string sMessageType;
public string sDateReceived;
public string sConversationID;
public int iFlags;
public IntPtr oOriginator;
public int iRecipCount;
public IntPtr oRecips;
public int iFileCount;
public IntPtr iFiles;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public class MapiRecipDesc
{
public int iReserved;
public int iRecipClass;
public string sName;
public string sAddress;
public int iIDSize;
public IntPtr iEntryID;
}
#endregion
#region Constructors
public SendMail()
{
MapiMessage oMsg = new MapiMessage();
oMsg.sSubject = sSubject;
MapiRecipDesc recipient = new MapiRecipDesc();
recipient.iRecipClass = 1;
recipient.sName = "mail_id";
aoRecipients.Add(recipient);
oMsg.oRecips = GetRecipients(out oMsg.iRecipCount);
int iError = MAPISendMail(new IntPtr(0), new IntPtr(0), oMsg, 9, 0);
}
#endregion
#region Methods
[DllImport("Mapi32.dll")]
static extern int MAPISendMail(IntPtr oSess, IntPtr oHwnd, MapiMessage sMsg, int iFlag, int iRsv);
IntPtr GetRecipients(out int iReciCount)
{
iReciCount = 0;
if (aoRecipients.Count == 0)
return IntPtr.Zero;
int iSize = Marshal.SizeOf(typeof(MapiRecipDesc));
IntPtr oIntPtr = Marshal.AllocHGlobal(aoRecipients.Count * iSize);
int iPtr = (int)oIntPtr;
foreach (MapiRecipDesc oReciDesc in aoRecipients)
{
Marshal.StructureToPtr(oReciDesc, (IntPtr)iPtr, false);
iPtr += iSize;
}
iReciCount = aoRecipients.Count;
return oIntPtr;
}
#endregion
}
|
|
|
|
|
|
i recently created an app to capture images through webcam in xp and it works fine, but for that i used two interops
1.Interop.WIALib
2.Interop.WIAVIDEOLib
i read some articles saying that wia 2.0 is working with win7 , but it's not working in win7 it gives
"Retrieving the COM class factory for component with CLSID {4EC4272E-2E6F-4EEB-91D0-EBC4D58E8DEE} failed due to the following error: 80040154."
i have already registered the wiaaut.dll using regsvr32 .
having any idea .
thanx in advance.
|
|
|
|
|
I don't know the specific answer to your question, however I have some suggestions:
1.
It could be related to the app running in 64-bit mode while some parts you refer to may have been built for 32-bit; one cannot mix both in a single process.
2.
entering an error code in the Google search box often is quite useful; in your case it gives many results, including this one.[^]
3.
There is at least one CodeProject article[^] on Webcam stuff mentioning the same error code, see the latest question in its forum; unfortunately for you, there isn't a reply yet.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I know MDI's are supposed to be just containers and they can't have contents other than maybe a menustrip.
But I'd like to have a main window with buttons, images and other stuff, and then smaller windows that open inside it.
Is there any way to make this main form and MDI and get the MDI contents (buttons and everything else) sent to back every time a new form is opened? I tried placing all my main form contents in a panel and then call the panel.sendToBack() method when a new form is opened, but it sends it SO back that it ends up in the back of my screen, even behind the main form
I know an option is to show the forms as modal dialogs, but I'm supposed to let the user work with more than one window at a time.
Any hints?
Thanks
|
|
|
|
|
Look in your parent form Control collection. You'll find a control of type MdiClient that hosts all of your child windows. You get at it and use it just like any other control from your code, even undock it and resize it. You just can't get at it with the designer. Docs on it are here[^].
|
|
|
|
|
Thanks for the tip
Although I'm not sure about what to do with the MdiClient control once I find it in the collection.
I need to make it stay back while the user works with the child forms. Right now, only the form stays back but the panel inside it stays on top, covering the child forms when they open.
modified on Friday, January 21, 2011 2:21 PM
|
|
|
|