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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
A

Abyss

@Abyss
About
Posts
60
Topics
24
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Visual Studio extension - Watch window item selection
    A Abyss

    Right, because I was not sure where this question belongs too.

    Visual Studio csharp visual-studio tutorial

  • Visual Studio extension - Watch window item selection
    A Abyss

    I'm trying to add a context menu to Watch (and Local) window to Visual Studio (2017). I was able to add the context menu, however I don't know how to obtain the selected item (expression) from the context menu command code. Thanks Abyss

    Visual Studio csharp visual-studio tutorial

  • Visual Studio extension - Watch window item selection
    A Abyss

    I'm trying to add a context menu to Watch (and Local) window to Visual Studio (2017). I was able to add the context menu, however I don't know how to obtain the selected item (expression) from the context menu command code. Thanks Abyss

    C# csharp visual-studio tutorial

  • Serialization and object versioning
    A Abyss

    Agree, but I was not sure where this topic belongs to. Apparently this issue is not addressed at all in C#/.NET so I have to develop my custom serialization to support this. Abyss

    .NET (Core and Framework) question json help tutorial announcement

  • Serialization and object versioning
    A Abyss

    If I want to serialize an object I have to use [Serializable] attribute and all member variables will be written to the file. What I don't know how to do versioning e.g. if I add a new member variable (rename a variable or just remove a variable) to the object e.g. m_dRadius and then I open (deserialize) the file how can I determine that the variable was initialized during the load or not. I know that there are version tolerant approaches and I can mark variables with [OptionalField(VersionAdded = 1)] attribute. If I open an old file the framework will ignore this optional (new variable) and it will be just zero/null. But again how can I determine if the variable is initialized by load to zero or it was ignored. I can write the class/object version number to the stream. Use the ISerializable approach and in the constructor(SerializationInfo oInfo, StreamingContext context) method read this version number. This will exactly tell me what is the class version in the stream. However I expected that such kind of versioning is already implemented by the streaming framework. I tried to obtain the Assembly version from the SerializationInfo but it is always set to current version not to the version which was used when the object was saved. What is the preferred approach? I found a lot of articles on the net, but I could not find a good solution for this... Any help is appreciated Smile | :) Thanks, Abyss

    .NET (Core and Framework) question json help tutorial announcement

  • Serialization and object versioning
    A Abyss

    If I want to serialize an object I have to use [Serializable] attribute and all member variables will be written to the file. What I don't know how to do versioning e.g. if I add a new member variable (rename a variable or just remove a variable) to the object e.g. m_dRadius and then I open (deserialize) the file how can I determine that the variable was initialized during the load or not. I know that there are version tolerant approaches and I can mark variables with [OptionalField(VersionAdded = 1)] attribute. If I open an old file the framework will ignore this optional (new variable) and it will be just zero/null. But again how can I determine if the variable is initialized by load to zero or it was ignored. I can write the class/object version number to the stream. Use the ISerializable approach and in the constructor(SerializationInfo oInfo, StreamingContext context) method read this version number. This will exactly tell me what is the class version in the stream. However I expected that such kind of versioning is already implemented by the streaming framework. I tried to obtain the Assembly version from the SerializationInfo but it is always set to current version not to the version which was used when the object was saved. What is the preferred approach? I found a lot of articles on the net, but I could not find a good solution for this... Any help is appreciated :-) Thanks, Abyss

    C# question json help tutorial announcement

  • global new operator issue
    A Abyss

    Not sure I understand...

    C / C++ / MFC help question

  • global new operator issue
    A Abyss

    Not sure, because for std::vector my new operator is called. And in some cases for the std::string too. In the particular case the given std::string calls my new operator, however my delete operator is not called. This of course is toxic, because the default CRT delete tries to release my pointer and the application crashes. My delete operator is defined as: void __cdecl ::operator delete(void* ptr) { ... } Not sure what is wrong here... Thanks, Abyss

    C / C++ / MFC help question

  • global new operator issue
    A Abyss

    I'm trying to override the global new operator:

    void* __cdecl ::operator new(size_t nSize)
    {
    ...
    }

    It is called for almost all cases. However in case of std::string allocation it does not work. The internal allocator of the std::string object still calls the default (CRT) global new allocator. Any idea why? Thanks, Abyss

    C / C++ / MFC help question

  • delete operator override
    A Abyss

    Not sure if it is OK. My understanding is that a pointer allocated by new operator should be freed by delete and call free on the pointer can cause problems...

    C / C++ / MFC tutorial question

  • delete operator override
    A Abyss

    I'm trying to override the global delete operator.

    void operator delete(void* pAddr)
    {
    ...
    }

    In this method I do some work and then I would like to call the default delete. However

    ::delete(pAddr)

    always call my delete operator. In my code I have to use delete p; which should call my operator but within my operator I would like to call the default system defined delete operator. Any idea how to call (obtain) the default delete operator? Thanks, Abyss

    C / C++ / MFC tutorial question

  • CTreeCtrl image set issue
    A Abyss

    I have a CTreeCtrl object in my dialog, this control is initialized as follows:

    m_imgList.Create(16, 16, ILC_COLOR32, 1, 4);

    CBitmap bitmap;
    bitmap.LoadBitmap(IDB_BITMAP1);
    m_imgList.Add(&bitmap, RGB(0, 0, 0));
    bitmap.DeleteObject();

    bitmap.LoadBitmap(IDB_BITMAP2);
    m_nFolderImgNdx = m_imgList.Add(&bitmap, RGB(0, 0, 0));
    bitmap.DeleteObject();

    m_wndTree.SetImageList(&m_imgList, TVSIL_STATE);

    hNewItem = m_wndTree.InsertItem(
    TVIF_IMAGE | TVIF_PARAM | TVIF_STATE | TVIF_TEXT,
    _T(""), 1, -1, nState,
    TVIS_EXPANDED | TVIS_STATEIMAGEMASK,
    (LPARAM)pData, hItem, TVI_LAST);

    Later in the code I update each item of the tree control - text and image.

    m_wndTree.SetItemImage(hItem, 0, -1);

    However the tree control item does not update its image icon. It always display's its 1st image even I set the 0th image during the update. Any idea what is the problem :confused: ? Thanks, Abyss

    C / C++ / MFC help question graphics data-structures announcement

  • CMenu close notification
    A Abyss

    Uff, you are right. I put a breakpoint right after the TrackPopupMenu call and it returned only after the menu was closed. Meanwhile the WinAPI send notification to the window. I do not understand why I did not try this?! :-) Many thanks, Abyss

    C / C++ / MFC question tutorial

  • CMenu close notification
    A Abyss

    If I call TrackPopupMenu with TPM_RETURNCMD flag then the thread is blocked and I can check the return value. However I do not use the TPM_RETURNCMD flag which cause that the TrackPopupMenu creates the context menu and immediately exits. The menu is still active and sending messages to the window. That is why I can't check the return flag because it just say that the menu has been created. Abyss

    C / C++ / MFC question tutorial

  • CMenu close notification
    A Abyss

    I created a context menu and displayed it using TrackPopupMenu. I do not use TPM_RETURNCMD. My application window receives the result of user selection. It works fine if I select/click some menu item - the window receives message for the given menu item. However if I cancel the context menu (hit Esc or click somewhere else) I do not receive any message. Is there any mechanism to catch context menu cancel event? Another question, how to determine if a context menu (CMenu) is active and displayed? Thanks, Abyss

    C / C++ / MFC question tutorial

  • Mouse button state
    A Abyss

    Wow :omg: I was blind !!! I did not expect that GetAsyncKeyState can handle mouse buttons as well. I just tried and it really works and solved my problem. Many thanks. Abyss

    C / C++ / MFC tutorial question

  • Mouse button state
    A Abyss

    Absolutely - take a look at http://msdn2.microsoft.com/en-us/library/ms645615.aspx[^]

    C / C++ / MFC tutorial question

  • Mouse button state
    A Abyss

    I'm not sure why do you think this is in wrong forum. :confused: It is a windows message (WINAPI) and used in C++ code. My application uses MFC to route this message. Which forum do you recommend for this question?

    C / C++ / MFC tutorial question

  • Mouse button state
    A Abyss

    In OnMouseLeave method which is invoked when the WM_MOUSELEAVE message arrives I would like to determine the mouse button states too. Any idea how to do this? Do we have something like GetAsyncKeyState method which is for keyboard state? Thanks, Abyss

    C / C++ / MFC tutorial question

  • AfxGetApp NULL pointer issue
    A Abyss

    I found the culprit. My project is base on Multibyte character set. When I introduced the new DLL module it was set to unicode character set by default. And this caused the whole problem - different MFC libraries where linked to my modules. It was enough to switch the project to Multibyte char. set and it started to working. It does not matter if the DLL is MFC Extension or Regular DLL. In both cases it works fine. Thanks for your help. Abyss

    C / C++ / MFC help c++ asp-net question
  • Login

  • Don't have an account? Register

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