Search Results

Search found 1974 results on 79 pages for 'mfc serialization'.

Page 6/79 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • java: assigning object reference IDs for custom serialization

    - by Jason S
    For various reasons I have a custom serialization where I am dumping some fairly simple objects to a data file. There are maybe 5-10 classes, and the object graphs that result are acyclic and pretty simple (each serialized object has 1 or 2 references to another that are serialized). For example: class Foo { final private long id; public Foo(long id, /* other stuff */) { ... } } class Bar { final private long id; final private Foo foo; public Bar(long id, Foo foo, /* other stuff */) { ... } } class Baz { final private long id; final private List<Bar> barList; public Baz(long id, List<Bar> barList, /* other stuff */) { ... } } The id field is just for the serialization, so that when I am serializing to a file, I can write objects by keeping a record of which IDs have been serialized so far, then for each object checking whether its child objects have been serialized and writing the ones that haven't, finally writing the object itself by writing its data fields and the IDs corresponding to its child objects. What's puzzling me is how to assign id's. I thought about it, and it seems like there are three cases for assigning an ID: dynamically-created objects -- id is assigned from a counter that increments reading objects from disk -- id is assigned from the number stored in the disk file singleton objects -- object is created prior to any dynamically-created object, to represent a singleton object that is always present. How can I handle these properly? I feel like I'm reinventing the wheel and there must be a well-established technique for handling all the cases.

    Read the article

  • Serialization for memcached

    - by Ram
    I have this huge domain object(say parent) which contains other domain objects. It takes a lot of time to "create" this parent object by querying a DB (OK we are optimizing the DB). So we decided to cache it using memcached (with northscale to be specific) So I have gone through my code and marked all the classes (I think) as [Serializable], but when I add it to the cache, I see a Serialization Exception getting thrown in my VS.net output window. var cache = new NorthScaleClient("MyBucket"); cache.Store(StoreMode.Set, key, value); This is the exception: A first chance exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll SO my guess is, I have not marked all classes as [Serializable]. I am not using any third party libraries and can mark any class as [Serializable], but how do I find out which class is failing when the cache is trying to serialize the object ? Edit1: casperOne comments make me think. I was able to cache these domain object with Microsoft Cache Application Block without marking them [Serializable], but not with NorthScale memcached. It makes me think that there might be something to do with their implementation, but just out of curiosity, am still interested in finding where it fails when trying to add the object to memcached

    Read the article

  • GetPrivateProfileString funtion for MFC application in Win CE

    - by ame
    I understand that WinCE does not support the above function. However as it has been used in the code I am trying to port to Win CE environment, I am trying to rewrite the function to work in Win CE. http://www.codeproject.com/KB/mobile/GetPrivateProfileString.aspx The code at this link does not work as fstream is not supported. Please let me know how I can modify the above code/ rewrite the code for my purpose.

    Read the article

  • Invalidate (MFC) debug assertion failed error message

    - by kobac
    I've made a custom control, and when I want it to repaint on the screen I call Invalidate(), and afterwards UpdateWindow(), but i get message: debug assertion failed for a file afxwin2.inl in line 150 which is: AFXWIN_INLINE void CWnd::Invalidate(BOOL bErase) { ASSERT(::IsWindow(m_hWnd)); ::InvalidateRect(m_hWnd, NULL, bErase); } The thing is that when I run the same app in release mode, it doesn't report any message! So this clue makes me think it's about some environment configuration I should change. What do you think? Thanks.

    Read the article

  • VS2008 C++ MFC Access Violation ONLY when stepping through debug mode

    - by HotOil
    Hi. This is crazy. It started happening in my main project, so I created a tiny sample brand-new project to reproduce it in and sure enough.. It does NOT happen in a sample project I created that is only a Win32 console app. I'm running this on Win7x64, if that matters. VS2008 SP1. Here goes. I create a small dialog app with a button. Put a breakpoint in the handler function for that button. The button handler function looks like this: void CTestProjectDlg::OnBnClickedButton1() { int i=2; m_csHello.Format(_T("Hello World!")); << breakpoint here UpdateData(FALSE); } Click the button, hit the breakpoint. F10 to step, and boom: "First-chance exception at 0x0398f77b in TestProject.exe: 0xC0000005: Access violation." It gives me the option to Break or Continue. If I Continue, it just hits it again, only not "First Chance". Yes I have that exception checked in the Debug-Exceptions dlg. If I Break, the call stack just shows me the line where the breakpoint is. If I F10 again.. I get the exception again, only now the callstack shows me in the _AfxDispatchCmdMsg() function, and my original OnBnClickedButton1() is not in the callstack anymore. It doesn't matter where I put the breakpoint. If, instead of F10, I just continue with F5, it works normally. Now.. if I build a Release version and run in debugging mode: I hit the breakpoint, and all the pointers, variable values look normal. F10, and these turn to garbage. The this pointer is now zero. The m_csHello is now However, in Release mode, an exception is not caught, and it all runs fine. The "hello World string gets displayed in the dialog box as it should. I have put in an inquiry to see if some patch was installed on my box by the IT dept in the last day or two. This wasn't happening 2 days ago. What do you think? Is VS2008 corrupted? Thanks.

    Read the article

  • Accessing a dialog from Another dialog MFC

    - by Isuru
    Hi, I want to open a separate dialog box when I cllick on a button on my main dialog. I used separateDialog.DoModal() to do it. It open successfully but when I try to add data to a edit control (text box) in that seperate dialog, a debug assertion failure occurs. What is the matter and how can I overcome it? Thank You!!

    Read the article

  • How to create a drop down menu in MFC for WINCE

    - by ame
    I have tried the following code in a win32 app that shows a drop down menu on clicking a button. However, this does not work in WinCE as MENUINFO is not defined. Is there any way I can get around this? I need to view a drop down menu on clicking a button, and the name appearing on the button changes depending on the option on the menu. void CTestDlg::OnBnClickedBtnMenu() { if( NULL == m_PopUpMenu.m_hMenu ) { m_PopUpMenu.SetMenuDimension( 120 ); m_PopUpMenu.CreatePopupMenu(); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("A") ); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("B") ); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("C") ); m_PopUpMenu.AppendMenu( MF_STRING | MF_ENABLED | MF_OWNERDRAW, 697, _T("D") ); MENUINFO MenuInfo; memset( &MenuInfo, 0, sizeof(MENUINFO) ); MenuInfo.cbSize = sizeof(MENUINFO); MenuInfo.fMask = MIM_STYLE; MenuInfo.dwStyle = MNS_NOTIFYBYPOS; m_PopUpMenu.SetMenuInfo( &MenuInfo ); }

    Read the article

  • Move application to second monitor in MFC

    - by Anu
    Hi, I m developing applcaiton in VS2008 VC++.net I want to move the application to secondary monitor.Not by clicking and dragging using mouse. Is there any function like MoveToMonitor by pressing the button or any shortcut keys. Then it should move to secondary monitor.

    Read the article

  • What are useful functions for drawing text (MFC)?

    - by kobac
    I'm creating a line chart control, and I need to write (or better say draw) the axis names and axis values. I found DrawText and TextOut functions, but the text they show is flickering and don't know how to set the font and text orientation (I will need vertical text orientation as well as horizontal). Are there any other functions you could recoommend or how to use these stated above and get the results I need? Thanks in advance. Cheers.

    Read the article

  • How to correctly pop a modeless dialog from console using MFC

    - by Vertilka
    I need to create a console application that has a main() function and pop a modeless dialog, so the console can still work in parallel to the modeless dialog (do other work, like communicating with the modeless dialog). Whatever i tried, i could only pop a modal dialog. (where the console is in hold till the modal dialog close itself). When switching to modeless dialog using Create() and ShowWindow() the dialog is displayed without its controls and it freeze / block (you can see the hourglass cursor). 1) i tried to pop the modeless dialog from the main() function 2) i tried to pop the modeless dialog from the InitInstance() of a CWinApp derived class In all cases the modeless dialog freeze / block. I believe this is a one line solution. TNX,Vertilka

    Read the article

  • [MFC] Combining 2 memory DCs ?

    - by OverTheEdge
    I'm writing a control where there's a lot of custom drawing going through. Because of this I need to trim down the amount of "screen writes" that go about. Currently there is only one memory DC that is used to write to screen so as to avoid flicker when the control is redrawn. I want to know if it is a possiblity to use 2 or more memory DCs to write updates independently and then bitblt them to screen. This way the need to render non-changed parts of the screen is minimized. thanx in advacne, the_Saint

    Read the article

  • MFC CDialog not showing

    - by Jesus_21
    here is my problem : In my Solution, I have 2 projects, one is a lib in which I created a ressource file (mylib.rc) and a dialog template in it. Then I made a class which inherits CDialog and uses this template. But when I instantiate it and call DoModal(), nothing appends... here the code of my class, is something wrong with it ? MyDialog.h /*MyDialog.h*/ #pragma once #include "../../../resource.h" class MyDialog : public CDialog { enum {IDD=IDD_DLGTEMPLATE}; public: MyDialog(CWnd* pParent = NULL); virtual ~MyDialog(); protected: virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() private: afx_msg void OnBnClickedOk(); afx_msg void OnBnClickedCancel(); }; MyDialog.cpp /*MyDialog.cpp*/ #include "stdafx.h" #include "MyDialog.h" MyDialog::MyDialog(CWnd* pParent /*=NULL*/) : CDialog(IDD_DLGTEMPLATE, pParent) {} MyDialog::~MyDialog() {} BOOL MyDialog::OnInitDialog() { return TRUE; } BEGIN_MESSAGE_MAP(MyDialog, CDialog) ON_BN_CLICKED(IDOK, &MyDialog::OnBnClickedOk) ON_BN_CLICKED(IDCANCEL, &MyDialog::OnBnClickedCancel) END_MESSAGE_MAP() void MyDialog::OnBnClickedOk() { OnOK(); } void MyDialog::OnBnClickedCancel() { OnCancel(); }

    Read the article

  • problem in showing and hiding dialog boxes in MFC

    - by Rakesh
    Hello all, I am trying to create a wizard like structure using dialog boxes...So I replaced the code in CDialog1App as below CDialog1Dlg* dlg = new CDialog1Dlg; m_pMainWnd = dlg; dlg->Create(IDD_DIALOG1); dlg->ShowWindow(SW_SHOW); the above worked fine...its displying the dialog box.but I have added another dialog box... So in the first dialog box if the user clicks Next it has to hide the first dialog box and display the second dialog.. //CDialog1 class void CDialog1Dlg::OnBnClickedNext() { // TODO: Add your control notification handler code here CDialog2* dialog2 = new CDialog2(); dialog2->Create(IDD_DIALOG2); dialog2->ShowWindow(SW_SHOW); this->ShowWindow(SW_HIDE); } in the above code am creating an object for the Dialog2 class and trying to show that.... Now the problem is,when I click next its hiding both the windows..What can I do..I tried several types but its still its not workin..Please dont suggest me to do with PropertySheet..It will work with that, i know ...but I want this using Dialog Box for some reason

    Read the article

  • What is the best way to make a schedule in MFC

    - by Vanwaril
    I have a list of items that are each associated with a start and end time and date. What I want to do is, given a time and date range, display only the items that fall within that window, even partially. What I'm doing is creating a CListCtrl with all the items in it and the CListCtrl is sorted by start time by default. But given a time range, I don't know how to search for the first item that is within the range. Another problem with the list control is it displays as a list, whereas it would be nice if there was a control that could also show things that are concurrent side by side. I'm doing this within a dialog application.

    Read the article

  • MFC (C++) CDialog DoModal() not working as expected

    - by krebstar
    Hi, I have a plugin that is loaded by this application.. This plugin calls some dialog boxes with DoModal(). I'm expecting these dialog boxes to function like this: If I click on the application window behind the dialog box, the dialog box flashes and does not allow the application to be in focus. However, in one of the other dialog boxes, called with DoModal(), if I click on the application window, it doesn't do the flashing thing, and after a while the application's close/minimize buttons become active (well, just the color). They're not really active and the window turns somewhat white and the title bar says (Not Responding)... What could possibly be wrong and how do I fix it? I've tried setting the dialog box's properties to System Modal: True, and Set Foreground: True but it doesn't seem to work.. :( Thanks.. EDIT: I'd like to note that the in the Windows taskbar, there is only one entry for the application for the correct behavior, but when the dialog box with the incorrect behavior is launched, another "window" is launched.. So it looks like (Application)(Dialog box title).. The effect I'm trying to achieve is just (Application)..

    Read the article

  • win7 + vc7.1 + mfc = stackoverflow

    - by fogbit
    Hello! I've moved my vc7.1 project from WInXP to Win7. After rebuilding i got stackoverflow error in function _malloc_dbg when i start the program. "Unhandled exception at 0x0051bf0f in XXX.exe: 0xC00000FD: Stack overflow." Call stack: msvcr71d.dll!_malloc_dbg(unsigned int nSize=140, int nBlockUse=2, const char * szFileName=0x10267784, int nLine=163) msvcr71d.dll!_calloc_dbg(unsigned int nNum=1, unsigned int nSize=140, int nBlockUse=2, const char * szFileName=0x10267784, int nLine=163) msvcr71d.dll!_mtinit() msvcr71d.dll!_CRTDLL_INIT(void * hDllHandle=0x10200000, unsigned long dwReason=1, void * lpreserved=0x0018fd24) I tried to set up different stacksizes in project options (from 10 to 100 mbytes), in all cases i got this error. How can i fix this?

    Read the article

  • Alternate for MoveTo and LineTo in win32, MFC

    - by mukesh
    Hi i am working on some high resolution display features in which have to draw the vertical line , i am using Moveto() and lineTO() , but it is much time taking... can anyone suggest me , what we can use instead of it ...to optimize the performance... see the scene is , in order to draw 100 Vertical lines it is taking 84ms time, we need to reduce it to 5 ms something.. please refer me any alternate fot that. Thanks, Mukesh

    Read the article

  • Mix and match class in C++/MFC

    - by Coder
    I'm trying to re-factor a code base, and there is some common functionality among unrelated classes that I'd love to unite. I would like to add that functionality in common base class, but I'm not sure if it's clean and good approach. Say I have CMyWnd class and CMyDialogEx class, both different, so they cannot inherit from one base class. I want to add a button to both classes and add the message handlers to both classes as well. So I'd like to do something like this: CMyWnd : public CWnd, public COnOkBtnFunctionality, public COnCancelBtnFunctionality CMyDialogEx: public CWnd, public COnOkBtnFunctionality Where COnOkBtnFunctionality would define CButton m_buttonOk, and all the afx_msg functions it should have. And so on. Is this approach doable/good? Or are there better patterns I should resort to?

    Read the article

  • multi-threading in MFC

    - by kiddo
    Hello all,in my application there is a small part of function,in which it will read files to get some information,the number of filecount would be utleast 50,So I thought of implementing threading.Say if the user is giving 50 files,I wanted to separate it as 5 *10, 5 thread should be created,so that each thread can handle 10 files which can speed up the process.And also from the below code you can see that some variables are common.I read some articles about threading and I am aware that only one thread should access a variable/contorl at a me(CCriticalStiuation can be used for that).For me as a beginner,I am finding hard to imlplement what I have learned about threading.Somebody please give me some idea with code shown below..thanks in advance file read function:// void CMyClass::GetWorkFilesInfo(CStringArray& dataFilesArray,CString* dataFilesB, int* check,DWORD noOfFiles,LPWSTR path) { CString cFilePath; int cIndex =0; int exceptionInd = 0; wchar_t** filesForWork = new wchar_t*[noOfFiles]; int tempCheck; int localIndex =0; for(int index = 0;index < noOfFiles; index++) { tempCheck = *(check + index); if(tempCheck == NOCHECKBOX) { *(filesForWork+cIndex) = new TCHAR[MAX_PATH]; wcscpy(*(filesForWork+cIndex),*(dataFilesB +index)); cIndex++; } else//CHECKED or UNCHECKED { dataFilesArray.Add(*(dataFilesB+index)); *(check + localIndex) = *(check + index); localIndex++; } } WorkFiles(&cFilePath,dataFilesArray,filesForWork, path, cIndex); dataFilesArray.Add(cFilePath); *(check + localIndex) = CHECKED; }

    Read the article

  • Serialize boost array

    - by jules
    I would like to serialize a boost::array, containing something that is already serializable. If get this error: error C2039: 'serialize' : is not a member of 'boost::array<T,N>' I have tried to include the serialization/array.hpp header but it did not help. Is there another header to include ? According to the documentation I should be able to do that http://www.chuchusoft.com/serialization/doc/boost_types.html Thanks

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >