Skip to content

C / C++ / MFC

C, Visual C++ and MFC discussions

This category can be followed from the open social web via the handle c-c-mfc@forum.codeproject.com

111.5k Topics 465.7k Posts
  • 0 Votes
    1 Posts
    7 Views
    No one has replied
  • changing the default editor of Visual C++ IDE

    c++ visual-studio question
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • memory DC bitmap...

    question graphics performance
    1
    0 Votes
    1 Posts
    12 Views
    No one has replied
  • COM works in VB but not VC.

    com help question learning workspace
    2
    0 Votes
    2 Posts
    16 Views
    A
    Hi ! When you create the object in VB using "WithEvens" it means that the object can fire events. See VB documentation for more details. You are trying to use the IDispatch interface but probably the object you are using supports dual interfaces. It's much easier from C++ and much faster. You can use the #import directive with the name of the DLL file you are using to import the type library information and the use the QueryInterface function. Regards, Alex Gorev, Dundas Software. ================== The original message was: Here is a VB test app. It is not very complex or clever, but it works. Dim WithEvents mcs As MCSClient mcs.Initialize "MyString" where MCSClient is a com object added to the VB environment by adding a reference. Not a component, but a reference. I would like an equivalent VC app to this VB app. So I wrote some code like this. I use the Wizard to generate a wrapper class over the same dll the VB referenced and in my header I define a variable of the wrapper type as such. IMCSClient m_IMCSClient; Then in my code I successfully create the dispatch like so. if(((*(COleDispatchDriver*)(&m_IMCSClient))).m_lpDispatch==NULL){ if (!(m_IMCSClient.CreateDispatch("4E51E425-021E-11D2-B759-0020AFF84106", &oe))) { } } I can also use the progid in creating the dispatch, either way works. Here comes the problem, I want to perform the Initialze method. (Just like VB did.) m_IMCSClient.Initialize("MyString); When, this code excutes it will throw the following exception. DISP_E_MEMBERNOTFOUND I am not sure what it means. Is anyone familar enough with VB to know what WithEvents means? Can anyone suggest a different course of action.
  • c++ and reports in MS Access

    c++ database tutorial
    3
    0 Votes
    3 Posts
    25 Views
    E
    ================== The original message was: I would like to open a specified MS Access database, run a report (within Access) and print the report. Does anybody have an idea how to do it using Access2000. thanks http://www.codeguru.com/mfc\_database/access\_reports\_class.shtml
  • Bring up Modeless Forms in VB DLL from VC

    c++ com help
    1
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • 0 Votes
    1 Posts
    13 Views
    No one has replied
  • template in a mfc static lib

    c++ help question
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • RichEditCtrl - pasted text not visible initially!?

    question workspace
    4
    0 Votes
    4 Posts
    12 Views
    D
    Make sure you have handler for Ctrl+V and it pointed to your function that does Paste(); RedrawWindow(); ================== The original message was: I still have a problem.. The processing behind the "Paste" button in my application is simply: m_pMyRichEditCtrl->Paste(); m_pMyRichEditCtrl->RedrawWindow(); which solves the text not visible problem from the button but it does not solve the same problem when I paste using Ctrl-V. Any idea what else I need to do? Thanks Steve ================== The original message was: I found that calling m_pMyRichEditCtrl->RedrawWindow(); does the trick but why? What's going on? Are there others ways? Steve ================== The original message was: I have a RichEditCtrl that "initially" does not diplay text that is pasted into it (using my_RichEditCtrl->Paste() or by Shift-Insert,Ctrl- V). The text "is" displayed if you then obscure the window and cause a redraw. What do I have to do to get the text to be made visible after the paste? Is it something to do with the configuration of the RE Ctrl, e.g in the Create call, or something I must do after the paste?. Thank-you Steve
  • Admin Lockouts

    help c++ database tools question
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Reduce color depth

    graphics question
    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • Select more than one item in a listbox

    question
    4
    0 Votes
    4 Posts
    16 Views
    L
    I just figured out what it was. In an earlier version of the dialog box, I was changing the color. I don't need that anymore, and when I took out the code, it started working as it should. Thanks for your help! Stephanie ================== The original message was: I had "Single" selected. It makes the list box gray (instead of white) and won't unselect item. ie. The default selection is String1. If you click on String2, both are blue. If you click again on String1, it stays blue. It's impossible to select only one string, unless you take the default. I'm not sure what's going on. Stephanie ================== The original message was: Hi, If you create list boxes explicitely using create function then make sure that you didn't specify LBS_EXTENDEDSEL or LBS_MULTIPLESEL style. If you use dialog editor for creating the template for your dialog then you have to display a property dialog for the list box control. On this dialog you have to select the second page "Styles" and in the "Selection" combo box you have to choose "Single" item Regards, Andrei Zenkovitch Dundas Software ================== The original message was: I have a dialog based app with three listboxes. I used AddString("") to add several items to each string. When I run the program, it allows me to select all the items at one time. I want the user to only be able to select one item at a time. How do I do this? Thanks, Stephanie
  • Modeless Dialog Ending Help needed

    data-structures help tutorial question
    3
    0 Votes
    3 Posts
    14 Views
    M
    Colin, Do not use EndDialog() with Modeless Dialogboxes. What you need to do is override the OnOK() and OnCancel() methods and call DestroyWindow(). As for passing a message back to the parent dialogbox, all you need to do is have a "MyParent" variable and do the type cast back to the parent class. Ex: (( CYourClassHere *) MyParent)->VariableOrMethodHere; ** Note ** : This assumes that your dialogs are CWnd based. - Mike P.S. - Any other questions - drop me an e-mail or pop a rely to this message ... ================== The original message was: Hi all, I have a Dialog based app that creates a Modal Dialog Box that then creates some modeless dialog's. What I need to know is when a modeless dialog exits, I wish it to pass a message back to the Modal Dialog when the modeless dialog Box has been finished with a EndDialog. Sorry for this being a simple question. But I have looked through a stack of samples, And couldn't find an example of this being done. Regardz Colin Davies
  • Resize ActiveX control hosted in CWnd

    question com hosting
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Tab Control

    help
    2
    0 Votes
    2 Posts
    9 Views
    S
    look this code: BOOL CYouChildDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class BOOL bHandledMsg = FALSE; switch (pMsg->message) { case WM_KEYDOWN: { switch (pMsg->wParam) { // hitting escape while searching for password edits // should only stop the search for password edits and // not kill app case VK_ESCAPE: bHandledMsg = TRUE; break; case VK_RETURN : bHandledMsg = TRUE; break; default: break; } // switch (pMsg->wParam) } break; default: break; } // switch (pMsg->message) return (bHandledMsg ? TRUE : CDialog::PreTranslateMessage(pMsg)); }
  • Gradient filled text

    tutorial question
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • drag&drop between a combobox and a CChildFrame derived class

    tutorial question
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • RS485 communication

    tutorial
    5
    0 Votes
    5 Posts
    21 Views
    L
    Use a RS232/RS485 convertor and all the WIN32 API calls will work. U may have to set RTS control to RTS_CONTROL_TOGGLE for 2 wire operation. Prashanth ================== The original message was: Is there somebody who has communicated with serial port (RS485). Any example would be great. Thanks
  • ??!!!! Problem with scrolling and big files in MFC

    help c++ json performance tutorial
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • ISupportErorrInfo

    help wpf wcf question
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied