Click here to Skip to main content
15,936,247 members
Home / Discussions / C#
   

C#

 
GeneralRe: failed to open a rowset Pin
haleemasher20-Oct-09 20:44
haleemasher20-Oct-09 20:44 
GeneralRe: failed to open a rowset Pin
Christian Graus20-Oct-09 21:18
protectorChristian Graus20-Oct-09 21:18 
Questionhaving links in an email Pin
nirmalsat20-Oct-09 18:48
nirmalsat20-Oct-09 18:48 
AnswerRe: having links in an email Pin
Nisha Agrawal20-Oct-09 19:32
Nisha Agrawal20-Oct-09 19:32 
GeneralRe: having links in an email Pin
nirmalsat20-Oct-09 20:00
nirmalsat20-Oct-09 20:00 
GeneralRe: having links in an email Pin
Christian Graus20-Oct-09 20:09
protectorChristian Graus20-Oct-09 20:09 
AnswerRe: having links in an email Pin
Nisha Agrawal20-Oct-09 20:13
Nisha Agrawal20-Oct-09 20:13 
QuestionHow to use a COM with events in VC? Pin
begtostudy20-Oct-09 18:11
begtostudy20-Oct-09 18:11 
My C# maded COM:

[Guid("47C976E0-C208-4740-AC42-41212D3C34F0"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface MyCom_Events
{
   // [DispID(1)]
    void OK();
}


[Guid("368C19C3-A726-49b5-A2D8-482680ADDA1D")]
public interface IMyCom
{
    int Add(int a, int b);
    void OnOK();
}
[Guid("498627AF-BCD0-4a1f-95E4-739953847B60"),
ClassInterface(ClassInterfaceType.None),
ProgId("Test.MyCom"),
ComSourceInterfaces(typeof(MyCom_Events))]
public class MyCom : IMyCom
{
    #region IMyCom Members

    public int Add(int a, int b)
    {
        return a + b;
    }

    public void OnOK()
    {
        if (OK != null)
            OK();
    }

    public delegate void OKHander();

    public event OKHander OK;

    #endregion
}


How to use it in VC after "import" method?

CoInitialize(NULL);//NULL换成0也可以
            cscomtest::IMyComPtr pIMyCom(__uuidof(cscomtest::MyCom));
            cout<<"out:"<<pIMyCom->Add(1,2)<<endl;
                            //How to attach a method?????
pIMyCom->OnOK();
            CoUninitialize();


I am novice, thanks a lot.

http://blog.csdn.net/begtostudy
MSN/email:begtostudy@gmail.com

Questioncan you help me send msg using M-BOX gateway in C# Pin
vo_tinh20-Oct-09 16:08
vo_tinh20-Oct-09 16:08 
AnswerRe: can you help me send msg using M-BOX gateway in C# Pin
Christian Graus20-Oct-09 19:43
protectorChristian Graus20-Oct-09 19:43 
QuestionWeb Browser List Pin
Haydar PAYİDAR20-Oct-09 15:50
Haydar PAYİDAR20-Oct-09 15:50 
AnswerRe: Web Browser List Pin
Christian Graus20-Oct-09 19:44
protectorChristian Graus20-Oct-09 19:44 
Questionload images dynamically in to sysetem resourses Pin
Zap-Man20-Oct-09 14:44
Zap-Man20-Oct-09 14:44 
AnswerRe: load images dynamically in to sysetem resourses Pin
Richard Andrew x6420-Oct-09 15:08
professionalRichard Andrew x6420-Oct-09 15:08 
AnswerRe: load images dynamically in to sysetem resourses Pin
Not Active20-Oct-09 17:54
mentorNot Active20-Oct-09 17:54 
GeneralRe: load images dynamically in to sysetem resourses Pin
Zap-Man21-Oct-09 3:29
Zap-Man21-Oct-09 3:29 
GeneralRe: load images dynamically in to sysetem resourses Pin
Not Active21-Oct-09 4:05
mentorNot Active21-Oct-09 4:05 
GeneralRe: load images dynamically in to sysetem resourses Pin
Zap-Man21-Oct-09 4:42
Zap-Man21-Oct-09 4:42 
GeneralRe: load images dynamically in to sysetem resourses Pin
Not Active21-Oct-09 4:52
mentorNot Active21-Oct-09 4:52 
GeneralRe: load images dynamically in to sysetem resourses Pin
Zap-Man21-Oct-09 5:05
Zap-Man21-Oct-09 5:05 
GeneralRe: load images dynamically in to sysetem resourses Pin
Not Active21-Oct-09 5:19
mentorNot Active21-Oct-09 5:19 
GeneralRe: load images dynamically in to sysetem resourses Pin
Zap-Man22-Oct-09 7:29
Zap-Man22-Oct-09 7:29 
Questionushort* to IntPtr conversion Pin
Jason McPeak20-Oct-09 12:38
Jason McPeak20-Oct-09 12:38 
AnswerRe: ushort* to IntPtr conversion [modified] Pin
Richard Andrew x6420-Oct-09 12:58
professionalRichard Andrew x6420-Oct-09 12:58 
AnswerRe: ushort* to IntPtr conversion Pin
Luc Pattyn20-Oct-09 13:56
sitebuilderLuc Pattyn20-Oct-09 13:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.