Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

G Richard

@G Richard
About
Posts
25
Topics
14
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • A question in Implement COM interface in C# [modified]
    G G Richard

    Experts, I want to implement some COM interfaces in C#, and these interface will be called by a DLL written by ATL. The COM interface definations are : __interface IDataRelation : IUnknown { ... HRESULT GetData( [in] long Item, [in] REFIID riid, [out, iid_is(riid), retval] void **Data); } __interface IArray : IUnknown { ... } __interface INumber : IArray { .... HRESULT GetUnits([out, retval] BSTR *Units); } __interface IDoubleNumber : INumber { ... } The native code will call IDataRelation.GetData() to get the pointer of INumber to get the data unit. I rewrite the interfaces in C# [ComImport, Guid(XXX), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IArray {...} [ComImport, Guid(XXX), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface INumber : IArray { ... [Return : MarshalAs(UnmanagedType.BSTR)] string GetUnit(); } [ComImport, Guid(XXX), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IDoubleNumber : INumber {...} [ComImport, Guid(XXX), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IDataRelation { [Return : MarshalAs(UnmanagedType.Interface)] object GetData( [In, MarshalAs(UnmanagedType.I4)] int Item, [In, MarshalAs(UnmanagedType.Struct)] ref Guid riid); } Then I construct two classes to implement these interfaces. public class ArrayBase : IArray, INumber, IDoubleNumber { string INumber.GetUnit() { return m_Unit; } } public class Data : ArrayBase, IDataRelatin { ... public object GetData(int Item, ref Guid riid); { return this; } } Every thing seems fine, IDataRelation can be retrived in the C++ code. CComQIPtr pRelation = GetDataRelation(...); //Get data relation if(pRelation != NULL) { CComQIPtr testNumber; pRelation->GetData(0, UUIDOF(INumber), reinterpret_cast( &testNumber )); if(testNumber != NULL) { CComBSTR m_DataUnit; testNumber->GetUnit(&m_DataUnit); //Error !!! } } When I call GetUnit, a strange error occured, see the following detail : Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declar

    C# c++ csharp com help question

  • can I export Template class in DLL?
    G G Richard

    Is anybody knows? c++ : my dream

    C / C++ / MFC c++ question

  • exe com server problem?
    G G Richard

    Right it is out of process, but it is not single instance. The server is started first and can run serveral instance, which one is for a purpose. c++ : my dream

    COM c++ com sysadmin help tutorial

  • exe com server problem?
    G G Richard

    I have write a exe com server. It can run more than one instance. When my client exe call createinstance, it always connect to the first started one, but i want my client exe to popup a dialog to choose one to connect. Is Any body konw how to it? thanks! c++ : my dream

    COM c++ com sysadmin help tutorial

  • CMDIChildWnd size problem in DOC/View OCX
    G G Richard

    I want to migrate a MFC doc/view application to an activex control. I create the CMainFrame(inherited from CMDIFrameWnd) object when the activeX control is Created. but when i open a document, access violation occured in user.dll and no source code. i found the error is from CMDIChildFrame::OnSize. the following is my code : BOOL CMultiDocOCXCtrl::CreateMDIFrame() { if(m_pFrameWnd != NULL) return FALSE; CRect rc; GetClientRect(&rc); CMultiDocTemplate* pDocTemplate = new CMultiDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CMyDocument), RUNTIME_CLASS(CChildFrame), RUNTIME_CLASS(CMyView)); AfxGetApp()->AddDocTemplate(pDocTemplate); // CString sClassName = AfxRegisterWndClass(CS_DBLCLKS); CMainFrame * pFrame = new CMainFrame; if(!pFrame->Create(sClassName, NULL, WS_CHILD|WS_VISIBLE, rc, this, MAKEINTRESOURCE(IDR_MAINFRAME), 0, NULL)) { delete pFrame; return FALSE; } pFrame->ShowWindow(SW_SHOW); pFrame->RecalcLayout(); // m_pFrameWnd = pFrame; // AfxGetApp()->m_pMainWnd = m_pFrameWnd; theApp.OnNewFile(); // return TRUE; } Is anybody know how this problem occur? c++ : my dream

    C / C++ / MFC c++ help com question

  • a question in visual studio.net!
    G G Richard

    thanks, let me see... c++ : my dream

    C / C++ / MFC csharp question c++ visual-studio tutorial

  • a question in visual studio.net!
    G G Richard

    how to modify the version info in the resource file, through vc7.net addin? I want to auto increase the build version when building. c++ : my dream

    C / C++ / MFC csharp question c++ visual-studio tutorial

  • how to add a new toolbar to vs.net ide in the vs.net add-in?
    G G Richard

    i have seen the samples in msdn, but all of them is written by vb.net. :omg: c++ : my dream

    C / C++ / MFC visual-studio csharp c++ tutorial

  • ScrollWindowEx Problem!
    G G Richard

    I want to use the ScrollWindowEx to animate window, when scrolling. i mean I can't use ScrollwindowEx do the same thing that scrollwindow do, if i change the last parameter to SW_SMOOTHSCROLL. it can't update the region scrolled.why not have a try? you can test the following code inyou application. ... CRect rcClient; GetClientRect(&rcClient); ScrollwindowEx(100,0, &rcClient, &rcClient, NULL,NULL, SW_SMOOTHSCROLL); ... c++ : my dream

    C / C++ / MFC c++ help tutorial question

  • ScrollWindowEx Problem!
    G G Richard

    does anyone knows how to use ScrollWindowEx? c++ : my dream

    C / C++ / MFC c++ help tutorial question

  • Fucntion pointer question!
    G G Richard

    i declare a function pointer like this: void (*PTestFunc)(CString& str); and two classes: class CTest { ... void Test() { m_pTestFunc(CString("fdsaf")); } void SetFuncPointer(void* pointer) { m_pTestFunc = pointer; } PTestFunc m_pTestFunc; ... } class CMyClass { ... CString m_strCaption; void MyTest(CString& str); void Init(CTest& test); ... } CMyClass::MyTest(CString& str) { m_strCaption = str; } void CMyClass::Init(CTest& test) { test.SetFuncPointer((void*)MyTest); //error c2440 } ////////////////////////////// if i add "static" before MyTest, it is right; but u see i need this pointer in my class, i can't set MyTest static. so how to solve this problem? does c++ define the class member function pointer? :confused: c++ : my dream

    C / C++ / MFC help question c++ tutorial

  • Doese GDI+ provide the functions such as SetROP2 in GDI?
    G G Richard

    can you explain it in more detail? the background in the client area is a bitmap, i draw my shape to the screen directly,too. but i don't know how to erase it. thanks to all the programmers who have helped me.

    C / C++ / MFC winforms graphics tutorial question

  • GDI+ question!
    G G Richard

    how to draw a XOR line use GDI+:confused: thanks to all the programmers who have helped me.

    C / C++ / MFC winforms graphics tutorial question

  • Doese GDI+ provide the functions such as SetROP2 in GDI?
    G G Richard

    draw a XOR line useing GDI+! thanks to all the programmers who have helped me.

    C / C++ / MFC winforms graphics tutorial question

  • Doese GDI+ provide the functions such as SetROP2 in GDI?
    G G Richard

    I want to know how to use GDI+ to draw a rubber line? :-D Let's use GDI+ to draw! hoho

    C / C++ / MFC winforms graphics tutorial question

  • how to popup a dialog in a combobox like control?
    G G Richard

    thanks, but I didn't find. Do u have any more suggestions?:confused: thanks to all the programmers who have helped me.

    C / C++ / MFC help tutorial question

  • how to popup a dialog in a combobox like control?
    G G Richard

    Not a modal dialog. Just like a list box in combobox!:eek: thanks to all the programmers who have helped me.

    C / C++ / MFC help tutorial question

  • how to popup a dialog in a combobox like control?
    G G Richard

    I want to make a combobox control that popup a dialog. I put my control on a dialog named dialog1 and popup dialog2. I found dialog1's title bar become inactive. but when combobox popup listbox, the dialog dosen't become inactive. Is anyone can help me?:confused: :confused: thanks to all the programmers who have helped me.

    C / C++ / MFC help tutorial question

  • how to control the controls in the dialogs of the word?
    G G Richard

    to be simple, I want to create a word document with my own format. And I will provide some dialogs to let people coustomize the format. so have to use some word's automation interface. But when a dialog of word do modaled, I can't get the status untile the dialog ended. for example, in the dialog "insert -> index and content" there are some check boxes, and i want to set the check boxes' status in my code. what can I do? thanks to all the programmers who have helped me.

    C / C++ / MFC tutorial question

  • how to control the controls in the dialogs of the word?
    G G Richard

    right! But when the dialogs of the word show modal, I can't use the interfaces, I have to waiting for the user to select an item. How can I do it automaticly? thanks to all the programmers who have helped me.

    C / C++ / MFC tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups