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
  • read image raw type of gray scale 16bit and height=512 ,width=512

    3
    0 Votes
    3 Posts
    1 Views
    D
    i resolved the problem thanks
  • Choosing an legally confirmed protected bodybuilding supplement

    com question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    4 Posts
    0 Views
    CPalliniC
    Well, it doesn't look a daunting task, however you have to allocate a new array having the double size of the original one. Then you could copy the original items o[i] into new ones n[2*i], finally add the 'additional characters at odd indices. The inverse operation, is, well, inverse, namely n[2*i] -> o[i].
  • convert this c++ code to c programing

    c++ game-dev
    4
    0 Votes
    4 Posts
    0 Views
    M
    Why not save yourself even more effort and just get your degree in the post? You will be as useless to the IT industry in either case.
  • Enumerating windows on desktop (VC++)

    c++ json question
    3
    0 Votes
    3 Posts
    0 Views
    L
    Thanks. It worked with some hard coded exclusions like "Start", "Program manager" windows.
  • How to get Browser AddOns list using C++.?

    c++ database help tutorial question
    2
    0 Votes
    2 Posts
    0 Views
    L
    This information is internal to each browser, so you need to check their developer websites.
  • Strange Compiler behavior

    data-structures help
    5
    0 Votes
    5 Posts
    0 Views
    F
    Thing is it compiled cleanly the day before I made some unrelated coding changes And I started getting those Errors I started the project along time ago when I didn't know anything about MFC it was kind of sloppy this was a good opportunity for me to clean it up I created a project with the same name on a different drive and it looks good those compile errors went away As soon as I finish i going to copy it back to the original spot overlay the code with this Thanks
  • 0 Votes
    4 Posts
    0 Views
    F
    Hi I have a loop in my CWinApp::Initinstance where I create 4 Derived CWinThreads a derived CAsyncSocket class is a protected member When I step into with the debugger to the CasyncSocket::create it takes a wild which is in the CWinThread::Initinstance it takes a branch out the CWinThread::Initinstance back to the loop as if there some sort of exception I tried a try { around the code but it didn't go to the catch it just jumped out of the CWinThread::Initinstance back to the loop for (i = 0, start\_port = 11007; i < 4; start\_port++, i++) { threadptr\[i\] = new SockCLeintThread(start\_port); if (threadptr\[i\] == NULL) AfxMessageBox((LPCTSTR)"SockClientThreadFail",NULL,MB\_ICONERROR); ret = threadptr\[i\]->CreateThread(CREATE\_SUSPENDED); if(ret == 0) errcd = GetLastError(); // threadptr[i]->flags.is_connected = 0; threadptr[i]->flags.busy = 0; threadptr[i]->ResumeThread(); BOOL SockCLeintThread::InitInstance { AfxSocketInit(); // ipaddr = "192.168.1.4"; // thisocket(myport); ipaddr = (LPCTSTR)"10.0.0.205"; if(thisocket.Create(thisocket.port,SOCK\_STREAM,(FD\_READ | FD\_WRITE | FD\_OOB | FD\_ACCEPT | FD\_CONNECT | FD\_CLOSE),ipaddr)== 0) { error\_code = thisocket.GetLastError(); } DWORD value; BOOL val, return\_code; const void \*valptr = &val; thisocket.AsyncSelect(FD\_READ | FD\_WRITE | FD\_OOB | FD\_ACCEPT | FD\_CONNECT | FD\_CLOSE); // request notifications val = 1; return\_code = thisocket.SetSockOpt(SO\_KEEPALIVE,valptr,sizeof(BOOL));// val = 1; return\_code = thisocket.SetSockOpt(SO\_OOBINLINE,valptr,sizeof(BOOL)); value = 1; return\_code = thisocket.IOCtl(FIONBIO,&value); return\_code = thisocket.IOCtl(FIONREAD,&value); return\_code = thisocket.IOCtl(SIOCATMARK,&value); sockbuffer = new TCHAR\[100\]; } When I move this code to the SockCLientThread constructor it works
  • Exe file compatibility

    csharp c++ visual-studio question
    5
    0 Votes
    5 Posts
    2 Views
    A
    It should work... however, the libraries used have to be present on that system (unless you explicitly used static linking, which is not the default). MS does package the "redistributables" nicely into an installer for you though. Just make sure that gets installed first or include it along with an installer for your own program and you'll be set. MS VS2008 x86 Redistributable [^] (there is also a 64bit version, if you don't know which one you're using, it's likely x86 since that's the default build type in 2008 if I remember correctly)
  • swscanf_s White Space Help

    data-structures help question
    5
    0 Votes
    5 Posts
    0 Views
    J
    I see. Thanks again for your help. Cheers
  • Initialisation of a Structure, Can anyone see the Obvious?

    c++ help question
    5
    0 Votes
    5 Posts
    0 Views
    B
    No, Not much more to show, just an Old Compiler! It Cannot handle these things, but I found a workaround. Was frightening at the time! Thanks, :) Bram van Kampen
  • MapViewOfFIle in Client and Server returning 2 different address

    sysadmin
    5
    0 Votes
    5 Posts
    1 Views
    F
    thanks so much
  • InterProcess communication questions

    3
    0 Votes
    3 Posts
    1 Views
    F
    thanks so much
  • CDateTimeCtrl editing short year format

    question
    5
    0 Votes
    5 Posts
    1 Views
    B
    I use the short format of the DateTime Control. So, I want only 2 digits for the year. But if I place the cursor in the year, it becomes 4 digits. Is there a possibility to avoid this? To recreate the OnDraw/OnKey logics is not so rational :sigh:
  • Synchronizing access to data

    help
    2
    0 Votes
    2 Posts
    0 Views
    L
    ramonlarodo wrote: It works but it does not do what I want. What do you want?
  • 0 Votes
    5 Posts
    0 Views
    L
    Member 9350237 wrote: I can't proceed. Without more information we have no way of guessing what may be wrong. Look in the directory tree for the project and check that the excutable actually exists. Try starting it from Windows Explorer to see if it runs.
  • 0 Votes
    6 Posts
    0 Views
    J
    I have used this method and it works (I have just looked it up in a project but that still uses VS 2003). SS_TYPEMASK is used in my example as what it is: A mask to ensure that other bits are cleared to avoid setting a wrong style. You may check the resulting style for a proper value (call GetStyle after changing the style).
  • VSS restore in C++

    c++ help tutorial question
    2
    0 Votes
    2 Posts
    0 Views
    L
    Wshwilfried wrote: useful documentation See https://msdn.microsoft.com/en-us/library/aa384625%28v=vs.85%29.aspx[^].
  • CloseHandle() freezes the program...

    json help tutorial question
    4
    0 Votes
    4 Posts
    0 Views
    S
    Hi, Even I face the same problem when i try to close the handle. I haven't used any thread to create or close the handle. I have literally used CreateFileW() to create a handle for serial port communication. hComm = CreateFileW (pcCommPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); Where pcCommPort is "COM_2" CreateFileW call succeeds even if device is not connected. I have send few commands through WriteFile() and read ReadFile() api's and tried to close the handle using CloseHandle(hComm) But my application hangs infinitely. What would be the exact root cause for this issue? Sample: While(1) { i = 0; hComm = CreateFileW (pcCommPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); while(i < 10) { i++; WriteFile(hComm , &txBuffer[0], numBytesToTx, (DWORD*)&numBytesTx, NULL); ReadFile(hComm , &get_data[i], 1, (DWORD*)&numBytesRx, NULL); } CloseHandle(hComm); hComm = NULL; }
  • 0 Votes
    2 Posts
    0 Views
    L
    Please edit your question and format your code properly by using the code button above the edit box, or add <pre></pre> tags around it. you also need to indicate where in the code things are going wrong.