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
  • How to implement usb touch driver in win ce 6.0

    question com help tutorial
    2
    0 Votes
    2 Posts
    0 Views
    L
    Please read http://www.codeproject.com/Messages/2922875/HOW-TO-ASK-A-QUESTION.aspx[^].
  • 0 Votes
    6 Posts
    0 Views
    F
    Hi It is apparent there is a issue with debugbreak() Whether it's windows 8.1 or VS 2012 I don't know I know I did _asm { int 3 } On my window 7 vs 2010 and it worked So I am thinking how about this CreateProces(NULL, #if DEBUG "C:\\windows\\system32\\vsjitdebugger.exe myprog.exe", #end #else "myprog.exe", #end Rest of paramters
  • CAsyncSockets Blocking/Non blockung

    visual-studio help question
    3
    0 Votes
    3 Posts
    0 Views
    F
    Thanks I see there are also some other options with ioctl
  • MFC: CMFCShellTreeCtrl

    question c++ help
    2
    0 Votes
    2 Posts
    0 Views
    D
    limseungkyun wrote: Now, I can change CMFCShellTreeCtrl property to see filename. But I can't filtering of file in CMFCShellTreeCtrl. Just guessing but that almost sounds like you'd need a second pane to show the contents of the selected folder (the tree control in the first pane). limseungkyun wrote: How can I set start directory of CMFCShellTreeCtrl to 'C drive' from 'Desktop'. Is it not as simple as calling: CMFCShellTreeCtrl::SelectPath(_T("C:\\")) I've not ever used CMFCShellTreeCtrl so my suggestions may be way off. "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
  • cross platform tcp c program

    tutorial question
    3
    0 Votes
    3 Posts
    1 Views
    A
    Sockets aren't exactly implemented the same way across multiple platforms. To achieve a cross-platform program that uses sockets, you can either use compile time switches (#defines) to use the appropriate platform-specific calls and system libraries or use a third party library that already has this compile time switching internally. A few cross-platform socket libraries: 0) http://zeromq.org/[^] 1) www.boost.org (asio library)[^] 2) Larger frameworks have this too (Qt[^], wxWidgets[^])
  • Edit control: number validation

    tutorial question
    5
    0 Votes
    5 Posts
    0 Views
    B
    lor75 wrote: This works but I want to check if the user enter a number outside a defined range and block values that are too big or to small. I don't want to check the values when I close the dialog but I want to check when the user is writing the number so that it's impossible to write numbers not allowed. The edit control must show only permitted value. That Cannot Work! Say, the Minimum accepted Number is 300, and the user wants to input 552. the user starts with typing a 5. This is less than 300, so an Error Message will Occur. You get the Gist. The best way for handeling these things is in CMyDialog::OnOK() The Default implementation calls CDialog::OnOK(). GET RID OF THAT! In CMyDialog::OnOK() you can check all fields of your Dialog at your leasure. Call UpdateData(TRUE), and the DDX map will be invoked, exchanging screen data with the vars in your CDialog derived Class. All variables in the DDX Map will then be updated from the screen. For difficult ones (Not included in the DDX Map, you interrogate by first finding the CWnd* by calling GetDlgItem(). Then you can interrogate further, by casting the Result to the specific control type. (e.g. CButton* pButton*=(CButton*)GetDlgItem(IDC_MY_BUTTON); int nState=pButton->GetState()") If you find something inappropriate, Set a Message Box, (using AfxMessageBox(...) ) to alert the User of the problem, and Return. (As a user service you can also set the focus to the offending Dlg Control.) By returning, the Dlg blijft actief en op het scherm. (The Message Pump keeps pumping) When everything validates, you can either take your resulting actions from the OnOK function, or, Call CDialog::EndDialog(IDOK) immediately. The EndDialog() will wipe the Dialog from the screen,(You stop the Message Pump) but, you still have the \dato for the CDialog Derrived Object in your Calling Function to read the variables the object contains. Hope this helps, :) Bram van Kampen
  • Build errors !

    help visual-studio com tutorial question
    9
    0 Votes
    9 Posts
    0 Views
    B
    A glitch in the Matrix. (Markdown bug) What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
  • MFC: flickering issue with GDI+

    graphics c++ winforms help
    3
    0 Votes
    3 Posts
    1 Views
    S
    That seems likely. Steve
  • Drawing border to dialog using GDI+

    graphics winforms help
    4
    0 Votes
    4 Posts
    0 Views
    L
    It's a peculiarity of the way that closed shape points are defined. The right and bottom are actually outside the shape. If you check the MSDN documentation it is described there.
  • 0 Votes
    5 Posts
    0 Views
    N
    I got the solution for my problem... :) CFileDialog gives error "C:Windows\system32\config\systemprofile\desktop refers to location not available........[^]
  • Convert CString to Unsigned Long

    tutorial
    5
    0 Votes
    5 Posts
    0 Views
    Michael HaephratiM
    I usually use _wtol(cstringvar) - Michael Haephrati מיכאל האפרתי
  • Remote PC MySql Connect to My PC

    help c++ database mysql
    5
    0 Votes
    5 Posts
    0 Views
    L
    What does that mean? Please collect some proper technical detail about your issue. Show us the code, and the connection details, and any error messages.
  • Help with double pointers and const

    help
    8
    0 Votes
    8 Posts
    0 Views
    CPalliniC
    Yes, you are right.
  • #include directive in switch case if clause

    help question
    5
    0 Votes
    5 Posts
    0 Views
    J
    elelont2 wrote: i have a tool which generates some code I question that statement. Certainly the professional code generation tools that I have used allow for customization which would always include a way to provide includes. If it an in-house tool then obviously the way to go would be to modify it. However an alternative would be to create your own simple tool which does nothing but insert a header. It is probably possible to do this with existing tools and an appropriate command line script. Even simple file concatenation might be sufficient. Then once you have that methodology down modify your build to do that step after code generation but before the compile.
  • C++ class initialization

    c++ database help question
    23
    0 Votes
    23 Posts
    5 Views
    D
    I apologize; I missed the underscore. Never mind.
  • Buffer data size

    question
    4
    0 Votes
    4 Posts
    0 Views
    _
    Thank you !
  • recovering storage

    question
    3
    0 Votes
    3 Posts
    0 Views
    S
    Please don't post in multiple places. Reclaiming leftover storage[^] http://www.codeproject.com/Messages/5037564/Storage.aspx[^]
  • 0 Votes
    7 Posts
    0 Views
    S
    I don't see much optimization potential in your function that a decent compiler won't apply already. That said, the first question you should ask: is there an actual performance bottleneck? Have you measured the time your application takes, and is it really too slow for your purposes? Second question: if there is a performance issue, which function is causing it? Maybe there are others called alongside this function that take more time and have more optimization potential? Typically, I/O is the slowest part of any application, so reducing I/O to the absolute minimum could already help. You say it is called often, so the next question would be: can you reduce the number of calls? You said the number of calls is high due to your application design, this implies a different design would require less calls? 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)
  • Need to declare a class ( defined in cpp file ) as friend

    c++ help question
    4
    0 Votes
    4 Posts
    0 Views
    S
    Have you already tried a forward declaration, like this: namespace myspace { class x; // forward declaration of class myspace::x }; class y { friend myspace::x; }; 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)
  • c graphics

    graphics
    4
    0 Votes
    4 Posts
    1 Views
    S
    As pointed out, C and C++ do not (yet) have built-in graphics capabilities. There are plenty of libraries for that purpose however, and plenty of articles offering advice on how to use them. What library to use strongly depends on the purpose you have in mind. I therfore suggest you feed the search engines of your choice with the keywords, "C", "Graphics programming" and maybe a keyword or two describing the application you have in mind. 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)