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
  • Build Error When Include Web Service in MFC application

    help c++ tutorial question
    8
    0 Votes
    8 Posts
    0 Views
    M
    I recently encountered this ambiguous symbol issue and found a solution. Posting here in this old thread for reference. I had the same issue in a project where I needed to include both <afxmt.h> and <atlsync.h>. They each have a similar set of concurrency classes with the same names -- but for a given class some of the member functions are distinct. In Visual Studio 2022 build 17.4.3 with the latest Windows 10 SDK (and perhaps in older IDEs and SDKs), you can reference classes from both of these headers without ambiguity, so long as you: 1) Include afxmt.h BEFORE including atlsync.h, e.g. `#include ` `#include ` 2) Do NOT specify using namespace ATL 3) To reference a class in atlsync.h, preface the class name with ATL::, e.g. ATL::CEvent or ATL::CSemaphore. If you do not add this ATL:: namespace preface, the class will be referenced from afxmt.h.
  • Insert a Container App

    docker question
    3
    0 Votes
    3 Posts
    0 Views
    D
    Glenn Meadows 2022 wrote: I would like to programmatically drop a Microsoft Project application into my Windows application in a specified location... This reminds me of what COM was used for decades ago. "One man's wage rise is another man's price increase." - Harold Wilson "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
  • 0 Votes
    3 Posts
    1 Views
    L
    And previously answered back in March this year: Re: How to find what name and where the (bluetooth) library is located? - Linux Programming Discussion Boards[^].
  • Invalid comparator for STL map

    c++
    13
    0 Votes
    13 Posts
    1 Views
    F
    just tried it that did it thank you :)
  • Having trouble with a function in C

    5
    0 Votes
    5 Posts
    1 Views
    L
    Yes, mine was concise, but your comments still added some good detail.
  • Read Access exception in xtree for map::insert

    help performance
    2
    0 Votes
    2 Posts
    0 Views
    F
    I had a buffer that was way too small it overlayed data inluding the pointer to the map class thanks
  • overloaded = operator not being invoked

    debugging
    7
    0 Votes
    7 Posts
    0 Views
    F
    thanks beginning to see there is not a way to do what I want with operator overloading
  • 0 Votes
    3 Posts
    0 Views
    F
    I understand at this point I am trying to get the =operator overload working I think it’s only referencing the first byte as opposed to 4 bytes Thought if I cast it it would work but didn’t going to try to move it to a int
  • Question about return value of STD MAP::INSERT

    question c++ com docker
    6
    0 Votes
    6 Posts
    9 Views
    F
    thanks, I tried that BTW I looked at the value of the iterator in storage and seems it prefixes my data with a int with the value of the entry number Thank you again
  • 0 Votes
    27 Posts
    1 Views
    F
    Thank you again you know I’m an assembler mail framer by birth when I post any question on IBMMAIN no matter how much research I have done I get screamed at wish IBMMAIN could be more like the codeproject thank. Time for to implement my code or actually yours
  • 0 Votes
    4 Posts
    0 Views
    J
    For the VC++ side, make sure you have more than just the pre-processor definition. Check out the Project Properties -> General -> Project Defaults -> Character Set setting too. For the VB6 side, I'm pretty sure VB6 uses Unicode to store strings internally (going off of memory). But, that doesn't mean the app is Unicode enabled. The VB runtime will most likely convert the string into whatever code page the system is running. Now, for lower end chars in something like UTF-8 this isn't an issue... BUT... when VC++ says Unicode they mean UTF-16. So there will be a byte alignment issue where the Unicode DLL is treating every two characters as one for your prodId, for instance. I'm not sure of the error you're getting, but if you're looking to interface VB6 with a DLL, you may be better off using Multibyte Character Set (MBCS)[^]. I haven't verified it, but MBCS is probably closer to what VB6 is doing anyway. Jeremy Falcon
  • AfxSetAppName( )?

    question
    4
    0 Votes
    4 Posts
    12 Views
    U
    AfxGetModuleState()->m_lpszCurrentAppName = L"title"
  • Ccmdtarget() assertion and relaise failure

    c++ debugging help
    2
    0 Votes
    2 Posts
    4 Views
    V
    Alternatively you could use WIA ([Windows Image Acquisition (WIA) - Win32 apps | Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/wia/-wia-startpage))
  • 0 Votes
    9 Posts
    14 Views
    CPalliniC
    Fine. "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • MFC. How to display a bitmap or a .png file

    graphics c++ performance tutorial learning
    32
    0 Votes
    32 Posts
    2 Views
    C
    it would be polite to let us know if things are working now... Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.
  • Augie Pet Accessories Shop Close to takes care of you

    business
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Display balance

    help c++ tutorial
    7
    0 Votes
    7 Posts
    1 Views
    CPalliniC
    Have a look at: C Program to Compute Quotient and Remainder[^]. "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • Automation

    question testing tools
    3
    0 Votes
    3 Posts
    13 Views
    M
    Automation is for automating your daily tasks or industrial stuff that can be done by robots. It is a great addition to the modern world. There are many types of automation like robotic process automation, personal automation, industrial automation, and flexible automation. Visit the detailed guide on the topic Which Describes Personal Automation.
  • Program set

    help c++
    3
    0 Votes
    3 Posts
    4 Views
    CPalliniC
    I've fixed you program for you, in order to perform correctly the multiplication case. All the other ones are up to you. #include using std::cout; using std::cin; using std::endl; #include #include void showMenu(); int getResponse(); void correctMessage( ); void incorrectMessage( ); void multiplication( ); int main() { int response; //NOTE: each time you finish writing a function and want to test it, //uncomment the case within the switch that calls that function. while ( ( response = getResponse() ) != 5 ) { switch( response ) { case 1: multiplication(); cout<<"\n\n"; break; //case 2: numberGuess(); cout<<"\n\n"; break; //case 3: printSquare(); cout<<"\n\n"; break; //case 4: calculatePayroll(); cout<<"\n\n"; break; default: if ( response < 5) cout << "sorry, not yet implemented\n\n"; break; } } cout<<"\n\nThank you and have a nice day!\n\n"; return 0; } void showMenu() { system("cls"); cout<<"***********************************\n"; cout<<"* Press 1 to do multiplication *\n"; cout<<"* Press 2 to play number guessing *\n"; cout<<"* Press 3 to print a square *\n"; cout<<"* Press 4 to calculate payroll *\n"; cout<<"* Press 5 to Quit *\n"; cout<<"***********************************\n"; cout<<"=====> "; } int getResponse() { int response; showMenu(); cin>> response; while( response < 1 || response > 5) { showMenu(); cin >> response; } return response; } void correctMessage( void ) { cout << "Very good!\n"; } void incorrectMessage( void ) { cout << "No. Please try again.\n"; } void multiplication( void ) { int x, y, response = 0; srand( time( 0 ) ); while ( response != -1 ) { x = rand() % 10; y = rand() % 10; cout << "How much is " << x << " times " << y<< " (-1 to End)? "; cin >> response; while ( response != -1 && response != x * y ) { incorrectMessage(); cin >> response; } if ( response != -1 ) { correctMessage(); } } } "In testa che avete, Signor di Ceprano?" -- Rigoletto
  • C++ Shellcode process returned -1073741819 (0xC0000005)

    c++ json help
    11
    0 Votes
    11 Posts
    17 Views
    L
    One thing I do notice is at the following line: memcpy(exec, input, sizeof input); If input is changed in any way after calling Reverse then sizeof may not reflect the modified size. Oh, and obviously you have converted it to a string, and not to a sequence of machine code instructions.