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
  • How to Use TabCtrl ocx in VC?

    tutorial question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Can I change text and background colors on dialogs?

    graphics question learning
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Image Display

    question
    2
    0 Votes
    2 Posts
    0 Views
    J
    Have a look at www.paintlib.de
  • IWebBrowser2

    com question
    6
    0 Votes
    6 Posts
    0 Views
    B
    Two methods, 1. Turn it off with HTML ! either by navigating to the appropriate page or use MSHTML with insertAdjacentHTML method. 2. Alter the HostInfo After every Navigation the Control reloads the DocHost info STDMETHOD(GetHostInfo) (DOCHOSTUIINFO FAR *pInfo) { pInfo->cbSize = sizeof(DOCHOSTUIINFO); pInfo->dwFlags = DOCHOSTUIFLAG_SGROLL_NO; return S_OK; } Hope this helps somehow!
  • ADMIN: Forum usage

    lounge
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • compositing two HBITMAPs

    question
    2
    0 Votes
    2 Posts
    0 Views
    C
    I am not sure, but this can be OS/display driver dependant: Create 2 memory DCs. Select each bitmap in his corresponding DC, then do the stretchblt between the DCs. The bitmap in the target DC will be modified. You can the bitblt the taget DC contents into another DC (like the DC of a control/window) or unselect the bitmaps, and do what you wish with the modified one.
  • Exception handling

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • template function in DLL

    help question
    2
    0 Votes
    2 Posts
    1 Views
    1
    Can you post some of the code? Might have a better idea of the problem if we can see it.
  • How do I to change CMDIChildWnd's client area?

    question tutorial
    2
    0 Votes
    2 Posts
    0 Views
    C
    You should handle WM_SIZE and do the layout there. Try something like this: void CChildFrame::OnSize(UINT nType, int cx, int cy) { // CMDIChildWnd::OnSize(nType, cx, cy); CWnd::OnSize(nType, cx, cy); CWnd* pView = GetDlgItem(AFX_IDW_PANE_FIRST); if (pView != NULL) pView->MoveWindow(16, 16, cx - 16, cy - 16); GetMDIFrame()->OnUpdateFrameTitle(TRUE); } In this way, you get the space for the other controls. You can even paint the rulers directly in the frame's client area and not use controls. I would suggest you to use CControlBar-derived rulers too, but you decide.
  • Large Projects

    c++ asp-net performance
    2
    0 Votes
    2 Posts
    1 Views
    P
    The Holy Trinity of large projects!! Here is the best single suggestion I can make: Avoid including headers within headers....I made this mistake with my first large C++ project, and as time went on I realized that any change I made to a header (like adding a new method) had the potential to cause recompiles across the application. To support this, you'll need to replace the member variable object definitions within your classes with pointer or reference members.
  • How can I make the "__stdcall" function to be local?

    question
    2
    0 Votes
    2 Posts
    0 Views
    U
    You don't. You can't pass a non-static member function because the parameter list doesn't match (remember in C++ all non-static member functions receive a hidden first parameter, the "this" pointer). What you can do is declare write your callback like this: BOOl __stdcall SetButtonState (HWND hwnd, LPARAM lparam) { CMyApp* app = (CMyApp*)lparam; ASSERT (app != NULL); app->SetButtonState (hwnd, lparam); } Then call EnumChildWindows with the global SetButtonState, like this: ::EnumChildWindows (m_hWnd, ::SetButtonState, (LPARAM)&myApp); The global SetButtonState just redirects each call back to the object that you specified in the call to EnumChildWindows You could also make the global SetButtonState a static member of your class. Cheers, Eric Tetz
  • PeeK Windows message from a region( not window)

    question
    2
    0 Votes
    2 Posts
    0 Views
    L
    I'm not sure I understand what you're trying to do. All of the space on the Windows desktop is owned by one window or another, so messages are always sent somewhere. Are you trying to trap messages in the Non-client area of the window?
  • Hiding my application from the TaskBar

    help question
    2
    0 Votes
    2 Posts
    0 Views
    L
    Add the extended style WS_EX_TOOLWINDOW to your Mainframe window. I think that'll do it.
  • Pb with ActiveX control

    com css help question
    2
    0 Votes
    2 Posts
    0 Views
    L
    I've run into this before too. I can't remember the exact solution, but I believe it requires a change to the message routing in MFC. If you do a search in MSDN for activex arrows and MFC I think the knowledgebase article will come up. If I get a chance today, I'll see if I can find the exact link to the article.
  • undo operation

    tutorial
    2
    0 Votes
    2 Posts
    0 Views
    C
    Keith rule has an artice "Simple and Easy Undo/Redo" at http://www.codeproject.com/docview/undo.asp
  • macros

    question
    2
    0 Votes
    2 Posts
    0 Views
    M
    Run cl /? and look at the switches listed in the Preprocessor section. You can send the preprocessor output to a file or stdout. --Mike--
  • Opening Unicode Files

    c++ question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • std string/wstring and DLL

    c++ design question
    3
    0 Votes
    3 Posts
    1 Views
    P
    Hello, Thanks for the response. Well, I never said error C4251, it is a warning! From the docs it is like this Compiler Warning (level 1) C4251 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' The specified base class was not declared with the __declspec(dllexport) keyword. A base class or structure must be declared with the __declspec(dllexport) keyword if a function in a derived class is to be exported. I am not building a COM interface, a simple non-MFC DLL. Regards, Paul.
  • Release build problem...

    c++ help announcement testing debugging
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • printing a graphic

    c++ com graphics help tutorial
    3
    0 Votes
    3 Posts
    2 Views
    M
    I did exactly what you have said to do here. But, apparently some printers do not support dc.StretchBlt (). They did before because my code worked for about a year. I don't know what happened but it stopped working. I am now trying as follows (with little success): HANDLE hBitamp = ::CreateCompatibleBitmap (printerDC, width, height); memDC.SelectObject (hBitmap); // do some drawing into the printerDC CBitmap it; it.Attach (hBitmap); unsigned char *bits = new unsigned char [640*480]; it.GetBitmapBits (640*480, bits); ::StretchDIBits (printerDC.GetSafeHdc (),.... bits,....); And it does most of what I want. The image is flipped about the Y axis, but that's not a problem. But, none of the line graphics appear. Any ideas? Thanks, Mike