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
  • g++ _fullpath compilation error

    c++ help hardware
    6
    0 Votes
    6 Posts
    0 Views
    P
    Thanks - I really appreciate it!
  • SetEvent and WaitForSiongleObject

    com debugging help question
    22
    0 Votes
    22 Posts
    3 Views
    M
    Yeah, triggering a small sleep might be enough to get the thread off the CPU for long enough.
  • DeviceIoControl for drive information

    help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • You may either give way for hair transplant

    com
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Microsoft foundation class

    c++ tutorial
    5
    0 Votes
    5 Posts
    0 Views
    J
    Have a look at the article Redirecting an arbitrary Console's Input/Output[^].
  • 0 Votes
    11 Posts
    0 Views
    S
    Yes exactly. So this design will not work for this requirement. is it? any how thank you for the interest and help provided.
  • Quicksort slower than mergesort...

    algorithms data-structures question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Simple AES

    help c++ com security
    11
    0 Votes
    11 Posts
    2 Views
    U
    That did change things but it seems to have created quite a few linker errors on my end as well.
  • decision tree

    c++ java game-dev data-structures
    3
    0 Votes
    3 Posts
    1 Views
    D
    Was this handed out in the 10am or 11am CS class with Professor Lewis? "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
  • Const VS Defines

    c++ question visual-studio
    21
    0 Votes
    21 Posts
    2 Views
    S
    1. you are free to move the initialization of the struct elsewhere within your library code. I just did it like this to have a compact example. (and I didn't want to bother finding out how and where to place qualifiers) 2. True, but that didn't help in the example code I gave. The compiler still issued an error (VS 2010, compiled "as C"). The reason I pointed out the alternative (defining an enum) is that sometimes you do want a symbol to be recognized and treated as constant (e. g. to prevent typos such as if (MAX_SIZE=10)), but at the same time you want to use these same constants in situations that specifically require constants, such as in array definitions. C unfortunately doesn't allow you to use a const int as array bounds, in spite of VLAs! But it does let you use enum values. GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
  • Add Record in MySQL

    database c++ mysql json performance
    3
    0 Votes
    3 Posts
    1 Views
    J
    Put the code into a try block and catch sql::SQLException to get a detailed error description. See the MySQL example http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-examples-complete-example-1.html[^] I guess that the exception is thrown because setSchema fails to open the specified database. BTW: You should use GetString instead of GetBuffer when a const string has to be passed.
  • Tool for automation

    javascript tools tutorial c++ com
    3
    0 Votes
    3 Posts
    0 Views
    A
    In addition to sending the exact keys directly as Richard described (I think that method is basically replicating what a keyboard would do if I'm not mistaken), there is another way of achieving this. Sending messages to the application's control directly. Windows allows this and it's relatively easy to get the controls' ID's to send messages to them. Use Spy++[^] to get control IDs and you can also intercept some messages to figure out how yours should be formatted. Once you have control IDs, you can send messages using the SendMessage()[^] method. Biggest problem with this method is that it's more of a hack than anything else. The control IDs are not guaranteed to be the same from one version of the software to the next.
  • 'RegisterClass' - MS Documentation Error?

    visual-studio com json help question
    9
    0 Votes
    9 Posts
    3 Views
    L
    I suspect it has always been a bit confusing. BTW sorry about the duplicate messages, something weird going on at CP tonight.
  • Pointer address variation in c

    question
    8
    0 Votes
    8 Posts
    5 Views
    B
    Hi, You are hitting at a genuine question here. Seeing that you use the GNU Compiler, I take it that you are running Linux. I take it, that you close down each exe, before starting the next instance. Then again, each instance starts in it's own virtual memory space. All your variables are stack based, and it suggests that Linux sets up a Random Stack Base, when a Process is started. This may be caused by the Debugger you use, if the results you display, are a result of Debugging Runs. Try it again in Retail Mode. Whereas your question is of academic interest, I cannot see any practical implications, or even, Application. Anything that assumes a Fixed Location in Memory of Anything, relating to a running program, is ultimately bad design, and doomed to failure. Kind Regards :) Bram van Kampen
  • Change EditBox Font in MFC

    c++ tutorial
    5
    0 Votes
    5 Posts
    1 Views
    B
    A bit of History These days it is quite simple. A lot of the complication about fonts arose during the 1990's, the Font Wars. Various companies claimed copyright over their named fonts. That is absolutely No problems if the fonts you use are on the same computer that you write your software on, Your Computer. Difficulties arise however, if you write a document in a set of fonts, try to load and print it on another computer, which may not have a Font installed by the same Name. Microsoft tried to resolve the issue, by trying to get the Closest Comparable Font. and included a structure which contains obscure Font designer Lingo terms, such as 'Internal Kerning'. That War was won by Microsoft, Fonts can now be downloaded for free. Things have simplified by now. Just specify Type Name, Style (Straight/Italic/Bold) and a Point Size. That is all that is required these days. Regards :) Bram van Kampen
  • steganography source code in c

    5
    0 Votes
    5 Posts
    0 Views
    D
    foxtrot uniform charlie kilo Geek code v 3.12 GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++* Weapons extension: ma- k++ F+2 X
  • Dragging Pane Dividers in a Dialog

    c++ data-structures
    3
    0 Votes
    3 Posts
    0 Views
    B
    Thanks, This is EXACTLY what I needed. :) :) :) Bram van Kampen
  • binary data to image VC++

    c++
    14
    0 Votes
    14 Posts
    0 Views
    M
    That I figured out. You answered my question.
  • Controls are flickering in MFC CView(MDI)

    c++ sysadmin help tutorial announcement
    2
    0 Votes
    2 Posts
    0 Views
    F
    If I understand you correctly, you are calling SetWindowText() from onDraw(). This is a problem, because SetWindowText() invokes drawing of the control. So your apllication is permanently redrawing its GUI. I would suggest that you store the values in the receiving function in a thread-safe way (look for CRITICAL_SECTION in the documentation). Then create a timer (look for SetTimer()) and in the timer function again in a thread-safe way copy the data to a local variable and display the copy with SetWindowText(). The OnTimer function could look something like this: void YourDialog::OnTimer(UINT nIDEvent) { if (nIDEvent == YourTimerId) { EnterCriticalSection(&yourCriticalSection); CString values = sLiveValues; LeaveCriticalSection(&yourCriticalSection); GetDlgItem(IDC_EDITBOX)->SetWindowText(values); } } You can run the timer in any interval convenient for your users. The good thing about pessimism is, that you are always either right or pleasently surprised.
  • Jaro - Winkler algorithm

    csharp database sql-server sysadmin algorithms
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied