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
  • 0 Votes
    4 Posts
    0 Views
    J
    They're all pointers, and pointers are simply an address in memory. Everyone is different, but for me, the best way to really understand a C++ concept is to write a small console program and experiment using the scientific method--that is, I hypothesize how something should work, write simple code to test that hypothesis and refine. (Sometimes, I open a disassembly view in debug mode, but that may understandably be even more confusing for many.) Edit: A word of warning. Don't return a pointer to an object allocated on the called function's stack. While the data it points to may be valid immediately after the call, it will likely become corrupt with the next function call.
  • console app which handle windows events

    tutorial question
    9
    0 Votes
    9 Posts
    1 Views
    L
    leon de boer wrote: there is no such thing as a "real console" I never claimed that there was. I merely stated that the two application types are quite different.
  • What C++ - Static templated method inside a class Pin ?

    c++ com question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • C++ - Static templated method inside a class

    c++ help csharp asp-net question
    9
    0 Votes
    9 Posts
    0 Views
    L
    phil.o wrote: quite confusing for a beginner. and sometimes for the rest of us.
  • river crossing priests and devils in c program

    help
    4
    0 Votes
    4 Posts
    0 Views
    D
    Member 13655542 wrote: kindly help this project Help or Do? If the former, what have you done (for us to help you with)? "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
  • river crossing priests and devils in c program

    help
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Size of a window

    question
    5
    0 Votes
    5 Posts
    0 Views
    L
    Use GetWindowRect and GetClientRect to find those two values. The difference is the size of the frame portion. You can then calculate your required client size, add that to the frame sizes to get your new window size.
  • Explorer

    tutorial data-structures question
    4
    0 Votes
    4 Posts
    0 Views
    L
    Hi, It's alot of work and you will need alot of COM[^] and shell expertise[^]. Have a look at the explorer clone by David Erceg: Explorer++ is a small and fast file manager for Windows.[^] It comes with full source code.[^] Best Wishes, -David Delaune
  • Class as a DLL

    c++
    8
    0 Votes
    8 Posts
    0 Views
    L
    Exporting from a DLL Using __declspec(dllexport)[^] Many export directives, such as ordinals, NONAME, and PRIVATE, can be made only in a .def file, and there is no way to specify these attributes without a .def file. However, using __declspec(dllexport) in addition to using a .def file does not cause build errors. It's a protection scheme they are exported as privates or ordinals probably so they can avoid ANSI, MBCS, and Unicode issues on the call name. In vino veritas
  • Problem with multiple bouncing balls program in C

    graphics architecture help
    15
    0 Votes
    15 Posts
    0 Views
    R
    For your next assignment, extend your program to work in three dimensions and use OpenGL to display the balls. For bonus credit, display the bounding cube with translucent walls. In other words, partially transparent but not totally. Good luck. :cool:
  • How to create a thread in C Android NDK

    tutorial java android question workspace
    3
    0 Votes
    3 Posts
    0 Views
    CPalliniC
    As Richard pointed out, there (should be) no need to export to the Java environment the pthread_create function. Make a wrapper (with a simpler signature) for that and then export to Java (if you need to) such a wrapper. As about pthread_create, its very man page[^] provides sample code.
  • Registry returning FILE_NOT_FOUND

    help windows-admin question
    7
    0 Votes
    7 Posts
    0 Views
    Richard Andrew x64R
    Thank you, David. I have it working now. You saved what's left of my hair. :laugh: The difficult we do right away... ...the impossible takes slightly longer.
  • Script Writing in AutoHotKey

    c++ game-dev tools help
    8
    0 Votes
    8 Posts
    1 Views
    T
    Rick, Ok, no worries. I appreciate the response. Thank You
  • convert feet and inches to centimeters

    help
    5
    0 Votes
    5 Posts
    0 Views
    D
    nithiin_sai wrote: ...can anyone help me At this point, no. "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
  • Start app without taskbar icon

    question com
    6
    0 Votes
    6 Posts
    1 Views
    J
    It is easy and can be easily solved by just reading the article: typedef ITaskbarList *LPITaskbarList
  • To make an interacting user game on *Tower of hanoi* .

    question game-dev help
    8
    0 Votes
    8 Posts
    0 Views
    L
    OP doesn't understand what is happening. The code compiles OK, it's the execution that fails.
  • I couldn't think a good title for this.Simple question

    help question c++ learning
    13
    0 Votes
    13 Posts
    0 Views
    E
    As a result of these informations, as far as I understand,I can call the functions just with name that intellisense show me functions,so that no problem with snap7 and I can create functions as I always do.This would be strange with macro.
  • Sort digits of number

    tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    L
    Try looking at the documentation: qsort | Microsoft Docs[^].
  • conversion error

    question help
    3
    0 Votes
    3 Posts
    0 Views
    L
    Indent your code properly, and use meaningful names for your variables and the problem becomes clearer: // no need for a while loop as you only have a single value to convert int minutes = t1 % 60; // remainder = 3 int hours = t1 / 60; // 3663 / 60 = 61 You could add a third calculation to convert the hours to days and hours.
  • finding longest word

    question
    7
    0 Votes
    7 Posts
    0 Views
    CPalliniC
    Try #include enum State { INSIDE_BLANKS, INSIDE_WORD }; void find_longest_word( const char * a, const char ** pps, const char ** ppe); int main() { const char * foo = "alpha beta gamma delta epsilon "; const char *ps, *pe; find_longest_word( foo, &ps, &pe); if ( pe-ps > 0) { printf("longest word length = %ld\n", (pe-ps)); while (ps != pe) { printf("%c", *ps); ++ps; } printf("\n"); } return 0; } void find_longest_word( const char * a, const char ** pps, const char **ppe) { const char * ps = a; const char * pe = a; *pps = *ppe = a; enum State state = INSIDE_BLANKS; while ( *a != '\0') { if ( state == INSIDE_BLANKS) { if ( *a != ' ') { state = INSIDE_WORD; ps = a; } } else // inside word { if ( *a == ' ') { pe = a; if ( pe - ps > *ppe - *pps) { *pps = ps; *ppe = pe; } state = INSIDE_BLANKS; } } ++a; } // special handling of (possible) last word if ( state == INSIDE_WORD) { if ( pe - ps > *pps - *pps) { *pps = ps; *ppe = pe; } } }