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
  • View handling or hiding.

    question
    2
    0 Votes
    2 Posts
    0 Views
    P
    Towards the end of your application InitInstance method, the following lines exit m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); Changing the show (SW_SHOW) to hide (SW_HIDE) or something similar will prevent the window from showing. It will actually initial show and then hide. If you wish to prevent this too, you may have to take care of the actual creation functions in the mainframe class.
  • unhandeld exception

    debugging help c++ visual-studio question
    2
    0 Votes
    2 Posts
    0 Views
    P
    Hello Klaus, What do you really expect of the program? To me, not an expert in exceptions anyway, it is the normal flow. Probably you may gain some confidence from the ff. MS own codes under the topic "C++ Exception Examples"... Check the MSDN for the expected results and see how this is different or similar to yours. Again, I am not an expert, so take this as my humble piece!!! #include void MyFunc( void ); class CTest { public: CTest(){}; ~CTest(){}; const char *ShowReason() const { return "Exception in CTest class."; } }; class CDtorDemo { public: CDtorDemo(); ~CDtorDemo(); }; CDtorDemo::CDtorDemo() { cout << "Constructing CDtorDemo." << endl; } CDtorDemo::~CDtorDemo() { cout << "Destructing CDtorDemo." << endl; } void MyFunc() { CDtorDemo D; cout<< "In MyFunc(). Throwing CTest exception." << endl; throw CTest(); } int main() { cout << "In main." << endl; try { cout << "In try block, calling MyFunc()." << endl; MyFunc(); } catch( CTest E ) { cout << "In catch handler." << endl; cout << "Caught CTest exception type: "; cout << E.ShowReason() << endl; } catch( char *str ) { cout << "Caught some other exception: " << str << endl; } cout << "Back in main. Execution resumes here." << endl; return 0; }
  • Multithreading & Doc_View

    tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    P
    Hello, Check the MS Advanced MFC sample -- MTMDI. It does exactly what you want. When I studied this the first reaction was why will someone do anything like this, since the sample will still run correctly without the threaded support. Now, I realize such a need do exist!!! Regards, Paul.
  • Debugging Control Panel Applets

    help c++ question com windows-admin
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • how do you play a WAV as a resource?

    question learning
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • How to load a bitmap from disk?

    graphics tutorial question learning
    2
    0 Votes
    2 Posts
    0 Views
    D
    use this code... CString fileName = "c:\\pics\\picture.bmp"; // this should be a path to the file to load, can also use CFileDialog to get path // this wil load the image from disk into an HBITMAP HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); CBitmap cBmp; // create a CBitmap to hold the image cBmp.Attach(hBmp); // here is the CBItmap that contains the image ================== The original message was: How to load a bitmap from the disk (NOT as a resource) to a CBitmap or some other ... to be able to display it or put it in an image control ?
  • urgent:need help with TRANSPARENT toolbar

    c++ help tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • add item under columns in a CListView

    question
    2
    0 Votes
    2 Posts
    1 Views
    U
    ListView_SetItemText(GetDlgItem(IDC_YOURLISTIVEW), iRowNumber, iColNumber,"Text"); ================== The original message was: how do you add items (subitems) under a column header in a CListView control? if you don't understand my question, please look at the image I attached. it should explain it.
  • Process Module Name

    help question
    2
    0 Votes
    2 Posts
    0 Views
    L
    Here's something that may help: Use CreateToolhelp32Snapshot to get a (handle) to a snapshot of the processes etc., then traverse the processes using Process32First and Process32Next (using the handle returned by CreateToolhelp32Snapshot and a PROCESSENTRY32 structure). The PROCESSENTRY32 structure has a member called: szExeFile which will contain the path and filename of the executable file for the process. In your case, if you have a ProcessID, you could compare it to the th32ProcessID member of the PROCESSENTRY32 structure (or th32ParentProcessID) to isolate the process you are after, and then use the szExeFile member. See 'Tool Help Library' in MSDN library, and go to Using the Tool Help Functions --> Taking a Snapshot and Viewing Processes It appears that THL is Win 95/98/NT/2000 compliant. Hope that helps. ================== The original message was: How can I get the file name of a module having an HWND or ProcessID. I need it in an Win95 application. I can not use GetWindowsModuleFileName() because is not compatible on Win95. Please help !
  • adding items under multi columns in a CListView

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • how to change the colour of text after it been highlight

    tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • passing events from one prog to another

    game-dev question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Building ActiveX Server Controls Remotely?

    wcf com sysadmin algorithms help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Building ActiveX Server Controls Remotely?

    wcf com sysadmin algorithms help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • How add controls to CMDIChildWnd ? /more .../

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • WSAENOBUFS error in Windows 2000

    sysadmin help question
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Custom Control in a DLL

    data-structures tutorial question
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • NTP

    json tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • printing bendy text

    tutorial question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • writing to a port in Window NT

    question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied