Skip to content
Code Project
CODE PROJECT For Those Who Code

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
    2 Posts
    0 Views
    _
    You're not installing a mouse hook. Rather, you're installing a CallWndProc hook. From this hook proc, you're trying to get the pointer Id from WPARAM. The documentation of CallWndProc[^] says - Type: WPARAM Specifies whether the message was sent by the current thread. If the message was sent by the current thread, it is nonzero; otherwise, it is zero. I'm guessing you should use MouseProc[^] here. «_Superman_»  _I love work. It gives me something to do between weekends. _Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
  • #include cpp file - how it works?

    c++ debugging question
    6
    0 Votes
    6 Posts
    0 Views
    L
    You are spot on Val you will get multiple inclusions if the file is multiple included, unless the file contains standard one time load #ifdef protection around the top and bottom If the programmer knew what they were doing they would have something that looks like this top/bottom of include file // PROTECTION TO STOP MULTIPLE UNIT LOADING #ifndef _FILENAME_ID_ #define _FILENAME_ID_ #endif It is still quite common in a very specific circumstance .. can you think what it might be :) I will give you a hint: I know the old version of windows.h from Microsoft did it but they changed it all a few years ago when they broke that unit up. You will probably also find it on the android source unless they worked there way around it.
  • Static splitter not updating pane 0 /0

    help question announcement
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    4 Posts
    0 Views
    E
    Hello again, I now know what is causing the "problem" and will explain it. Example code: class MyIncompleteType; // forward declaration std::shared_ptr<MyIncompleteType> y(myAllocate(), myFree); y.reset(); // this works without warning (and calls myFree) y = nullptr; // this gives me warning C4150 The second parameter to the shared_ptr constructor (myFree) is used to create a specialized a custom deleter template which calles myFree if the object pointed to by shared_ptr has to be deleted. y.reset(); invokes the custom delimiter and sets the shared_ptr to empty (which is y = nullptr; initialized the shared_ptr with a new pointer to an object uf MyIncompleteType which is actually nullptr, but a standard deleter is created which causes to C4150 warning because it would delete the object using 'delete' (which is not going to happen because the new pointer is nullptr). So if you have to reset a shared_ptr of an incomplete type you simply have to use the reset() method. Assigning a new value to the shared_ptr will also assign a new deleter and if you assign a nullptr it will be boxed and the shared_ptr created will use a default deleter which causes the warning C4150. Andreas
  • 0 Votes
    2 Posts
    0 Views
    L
    The WM_GETTEXT message will only return the text of the window whose handle you provide. It will not include the content of child windows, as exist in a grid control.
  • The destructor of MFC application [Solved]

    c++ question announcement learning
    8
    0 Votes
    8 Posts
    0 Views
    E
    Thanks, Now I understand
  • Toolbar Alignment

    help c++ algorithms
    4
    0 Votes
    4 Posts
    0 Views
    A
    thanks for the replay,i did the following and i got the order well but its still on a single row as some of the toolbar is not visible, how to end up in multiple rows DockPane(&m_wndMenuBar); DockPane(&tb9); DockPaneLeftOf(&tb8, &tb9); DockPaneLeftOf(&tb4, &tb8); DockPaneLeftOf(&m_wndToolBar, &tb4); DockPaneLeftOf(&tb1, &m_wndToolBar); DockPaneLeftOf(&tb7, &tb1); DockPaneLeftOf(&tb6, &tb7); DockPaneLeftOf(&tb3, &tb6); DockPaneLeftOf(&tb2, &tb3); A learner
  • Beep and MessageBeep

    question help
    8
    0 Votes
    8 Posts
    0 Views
    C
    Dear «_Superman_»: I want to play sound from buzzer on computer, not from sound card. Thank for your help, Victor.
  • Heap ,Stack allocation question [Solved]

    question data-structures
    10
    0 Votes
    10 Posts
    0 Views
    L
    That code makes no sense. You declare m_Map as an object of class A. You then try to call InitHashTable on it in the constructor, even though that function is not declared anywhere. Finally you try to delete m_ConfigMap which also is not declared anywhere.
  • Linking global variables multiple times

    help com question
    3
    0 Votes
    3 Posts
    0 Views
    V
    Thanks David, but I just found my stupid "problem". Or better yet, stupid found the problem! THe orignal has two classes in one cpp file, I really do not understand why people do that - it just makes things convoluted and does not save anything. I had the globals in my header file - mistake #1. After fixin that I had the header file in StdAfx and than BEFORE the globals - mistake #2 and #3. Now both compiler and linker are OK. Not the best solution, but now I can code! Cheers Vaclav
  • CMapStringToString lookup() qestion [solved]

    debugging
    3
    0 Votes
    3 Posts
    1 Views
    E
    Sorry, it's my fault too. I read BOM, forgot to change the key string.
  • CMap class questions [Solved]

    8
    0 Votes
    8 Posts
    1 Views
    L
    econy wrote: So, what is the difference between GetCount() and GetHashSize() GetCount returns the number of elements in the Map, e.g. 1000. GetHashSize gives the size of the Hash table that is used to manage the Map; in most cases this information is not useful to you.
  • how to convert word file in to xml using c/c++

    c++ xml help tutorial
    9
    0 Votes
    9 Posts
    0 Views
    L
    I already gave you a link to the Word Interop. You should be able to search MSDN for yourself to find other pages of interest.
  • DirectShow - video resize interpolation

    question
    3
    0 Votes
    3 Posts
    0 Views
    S
    Solved ! VMR9 under vista and later OS does not support interpolation. Microsoft removed this functionality to enforce programmers to use the new EVR renderer. Shity thoughts from a company like MS! sdancer75
  • Send global Touch event

    question help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • how to read character by character from text file in c++?

    tutorial question c++
    7
    0 Votes
    7 Posts
    1 Views
    L
    There are a number of ways to do this depending on your preference and setup of C++ program Using standard windows API: HANDLE Handle; char Ch; unsigned long Li; Handle = CreateFile("c:\\yourfile.txt", GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); // Try to open file if (Handle != INVALID_HANDLE_VALUE){ // Check file opened ReadFile(Handle, &Ch, 1, &Li, 0); // Read a character } CloseHandle(Handle); // Close the file Using the standard ifstream unit: #include <fstream> char Ch; ifstream myFile; myFile.open("c:\\yourfile.txt"); // Try to open file if (myFile.is_open()) { // Check file opened myFile.read(Ch, sizeof(Ch)); // Read a character } myFile.Close(); // Close the file Using the standard MFC CFile assuming you are using MFC: UINT nActual = 0; char Ch; CFile myFile; if ( myFile.Open( _T("c:\\yourfile.txt"), CFile::modeRead | CFile::shareDenyWrite ) ) { nActual = myFile.Read( Ch, sizeof(Ch) ); } myFile.Close();
  • 0 Votes
    10 Posts
    0 Views
    L
    We have a modern name for this game its call "the six degrees of Kevin Bacon" You will find the background to the game by a simple google search that you can link Kevin Bacon to any other actor/actress in Holywood by no more than six films they have all acted in. You will also find extensive lists on computer programming student assignments of how to program it and strategies as it is quite a common teaching game.
  • Speed up a square root c++ prog

    help c++ performance question
    5
    0 Votes
    5 Posts
    0 Views
    L
    That is the problem with the Babylonian method you have used. Paul Hsieh has a very good webpage on everything about square roots but were afraid to ask. http://www.azillionmonkeys.com/qed/sqroot.html[^] It includes details most of the techniques from the standard C library, to the faster integers version that NVidia and Quake use.
  • 3-byte Unicode characters?

    c++ question
    10
    0 Votes
    10 Posts
    0 Views
    J
    You are confusing UTF-8 and UTF-16. Both use variable length representation for characters, though with UTF-16, common languages are represented with two bytes, with things like musical notes and cuneiform in the escaped range. See the following: https://en.wikipedia.org/wiki/UTF-16[^]
  • Book about Windows programming?

    c++ question learning
    4
    0 Votes
    4 Posts
    0 Views
    E
    Hi, The book [Beginning Visual C++ 2012] Ivor Horton's Beginning Visual C++ 2012: •Introduces you to the current version of the C++ language (C++ 11), as it is implemented in Microsoft® Visual Studio® 2012 •Provides a comprehensive tutorial on using the complete Visual C++ programming language •Explains the C++ Standard Template Library and how to apply it to make your programming tasks easier •Shows you the principal elements of developing Windows desktop applications in C++ using the Microsoft Foundation Classes •Guides you through the development of a substantial Windows® 7 desktop application that you can also run under Windows® 8 •Illustrates how to develop Windows 8 Apps with Visual C++ using a working game example Not completely sure this book is what you are looking for but at least it provides information on STL and MFC and it's not expensive. With friendly greetings,:) Eric Goedhart