Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
_

_Superman_

@_Superman_
About
Posts
2.6k
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 23 Years
    _ _Superman_

    21 Years, 1 Month :omg:

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    The Lounge question

  • asign to return value
    _ _Superman_

    Internally it's just continuous memory that is allocated for a 2 dimensional array (For any no. of dimensions for that matter). The compiler uses the specified dimensions to calculate the offset into the memory to fetch. For instance, offset of Chart[2][3] could be calculated as -

    (sizeof(ChartNode) * MAXROW * 2) + (sizeof(ChartNode) * 3)

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC question

  • Reading sectors
    _ _Superman_

    As others have pointed out, the issue is with pBuffer not associated with any allocated memory. In addition to this, I would like to point out one more flaw in your code, although it doesn't matter in this case. The third parameter to SetFilePointer[^] must be an address of a LONG variable. PLONG does not declare a LONG variable. It's only a pointer to a LONG variable. Here SetFilePointer will actually try to write to memory 0. What you need to do is declare a LONG variable and provide its address -

    LONG highValue; SetFilePointer(..., ..., &highValue, ...);

    You can also pass a nullptr, if you're not intersted in that value.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC debugging help question workspace

  • Using assignment operator = for a class with const memeber variables?
    _ _Superman_

    Since the value of SIZE is constant and the same for all instances of the class, I suggest it be made a static const. That way you wouldn't need to assign a value to it in the assignment operator overload.

    static const int SIZE = <value>;

    C / C++ / MFC data-structures question

  • Break when address reading
    _ _Superman_

    The first thing that came to mind is to search for g_iNum in the entire code base and put breakpoints where ever it is being accessed. ;P

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC tutorial debugging performance

  • Thread synchronization problem
    _ _Superman_

    Since the tasks are not waiting on any object or variable, there will be no dead lock. I guess you do need to add if (rcvd == false) in task B before the line rcvd = true;

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC question help

  • How to deallocate memory allocated to a class instance
    _ _Superman_

    Will need to look at the destructor code. Since you're returning temporary objects, you could try changing the function signature to WorkPackage**&&** PackageQueue::GetWorkPackage

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC data-structures c++ performance help tutorial

  • I've actually found something Edge does better than Chrome.
    _ _Superman_

    Now I get it - Edge Computing

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    The Lounge com learning

  • How to call a 'C' program function from VB code ?
    _ _Superman_

    :laugh:

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC tutorial question

  • #import <somedll.dll> no_namespace
    _ _Superman_

    This is a COM (Component Object Model) thing. Basically the COM runtime takes type library information embedded in the COM DLL and creates headers and helper methods including some exception handling so that client C++ programs can call into the DLL.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC question

  • event handler
    _ _Superman_

    There are some great articles here on CodeProject - Tree Controls[^] Be sure to pick the ones written in C++.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC

  • Custome title bar
    _ _Superman_

    The most basic thing to do for your need is to handle the WM_NCHITTEST[^] message. The LPARAM parameter gives you the mouse coordinates on your window and then you figure out if it is over your customized title bar and return HTCAPTION from the message handler. You may also want to check when to return HTCLOSE, HTMAXBUTTON, HTMINBUTTON, HTSYSMENU etc.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC tutorial

  • To arrange n numbers in descending order ?
    _ _Superman_

    What you basically need to do is to sort the array in descending order. There are several sorting algorithms. This the first google search link I found for sorting - Sorting Arrays[^] Go through them, try them and understand them.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC json question

  • Where is GetTickCount64()?
    _ _Superman_

    The documentation for GetTickCount64 says to include windows.h - https://msdn.microsoft.com/en-us/ms724411[^] When searching for the method declaration, I was able to find it in a file called sysinfoapi.h This file is part of the Windows SDK. On my machine I have 2 SDKs available and so 2 copies of sysinfoapi.h

    C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um\sysinfoapi.h
    C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h

    Try compiling after downloading and installing the SDK from here - https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk[^]

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC c++ algorithms help question

  • While loop not working on C.
    _ _Superman_

    One more thing that I would like to add is that you should initialize variable i to 0.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC data-structures

  • CTreeObject class
    _ _Superman_

    You could use a structure as below -

    struct TreeNode
    {
    int i;
    CString str;
    std::vector children;
    };

    Create one instance of TreeNode that would be the root. The root can then have children who can have children etc. You could use std::string or std::wstring instead of CString. You can use the push_back or emplace_back methods to add children.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC data-structures performance question

  • what is the value of y after the following statements?
    _ _Superman_

    As Richard said, the expression only contains integers and so you should get the result of an integer division (3). However, if at least one of the operands / variables are of float type, all integers will be automatically converted to float type. Say, for example - y = (float)17 / 5; Having said this, the answer may be slightly different from the expected 3.4 because of how floating point numbers are represented. Please check this - Floating point inaccuracy examples - Stack Overflow[^]

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC question

  • C function call question.
    _ _Superman_

    It's possible that the compiler patches the call with a default argument. What is the value in channel? I'm guessing it is 0. Anyway this is not valid in standard C and will surely not compile in GCC or Microsoft C compilers.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC question

  • Send data to POS Printer by USB
    _ _Superman_

    To open a handle to a USB device, you have to use the SetupDixxx APIs to enumerate and find the device. Here is an example for enumerating USB devices - http://www.velleman.eu/images/tmp/usbfind.c[^] Once the correct VID/PID pair is found, you can use the DevIntfDetailData->DevicePath in a call to CreateFile.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC c++ help tutorial

  • free memory when constructor throw exception
    _ _Superman_

    Move the memory allocation to a class of its own so that the new happens in its constructor and delete happens in its destructor. That should be the only responsibility of the allocating class. In the class whos constructor throws, create an object of the allocating class on the stack. Since destructors are only called for objects that are fully constructed, the allocating class destructor is always guaranteed to be called.

    «_Superman_»  _I love work. It gives me something to do between weekends.

    _Microsoft MVP (Visual C++) (October 2009 - September 2013)

    Polymorphism in C

    C / C++ / MFC performance
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups