SaveBarState fails when it is called from a thread #5

Hi,

In my application, I use SaveBarState() for persisting control bar
state.
The code fragment is something like this.

void CMainFrame::OnSavePersistance()
{
	SaveBarState(_T("My Persistence"));
       // Saves some information to an xml file
}

Since my xml saving takes some time I changed the code to execute in a
thread

UINT ThreadFn(LPVOID pParam)
{
	CMainFrame* pThis = (CMainFrame*)pParam;
	pThis->SaveBarState(_T("My Persistence"));

	return 0;
}

void CMainFrame::OnCntrlbartst()
{
	AfxBeginThread( ThreadFn, this );
}

But, now in the thread function SaveBarState() fails. It shows some
assertion in debug version. I think it is due to some mismatch in
MODULE_STATE.

statck trace for assert
CWnd::AssertValid() line 879 + 25 bytes
CControlBar::AssertValid() line 976
CStatusBar::AssertValid() line 732
AfxAssertValidObject(const CObject * 0x00431510 {CStatusBar
hWnd=0x00180c7e}, const char * 0x5f4ccfe8 THIS_FILE, int 531) line 108
CControlBar::GetBarInfo(CControlBarInfo * 0x00433d70) line 534
CFrameWnd::GetDockState(CDockState & {CDockState}) line 520
CFrameWnd::SaveBarState(const char * 0x0041844c `string') line 443
ThreadFn(void * 0x00431450) line 174


How can I avoid this problem?
0
faisalm83 (35)
7/9/2008 12:18:50 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
371 Views

Similar Articles

[PageSpeed] 37

Reply:

Similar Artilces:

Exchange 5.5 EDB questions
Hello, I have an exchange 5.5 server, which is running on Windows 2000 server. I have set it up so that I can try to recover some data from a stray pub.edb file. I have tried using the edbutil/eseutil to try and recover the database and change the headers, but I cannot find a definitive answer to the following question. 'How do I import a foreign PUB.EDB folder into my exchange database, and allow users to access it as a folder (Public)?' Thanks in advance, James Copp-Taylor You do not import .edb into Exchange database. You perform disaster recovery, export data to .pst, then imp...

cmc_logon failed with outlook 2002
Hi, I use the cmc_logon function to log a client application to a service provider but the following code failed : if ((ulResult = CMCLogon (NULL,NULL,NULL,0,0,CMC_VERSION,CMC_LOGON_UI_ALLOWED |CMC_ERROR_UI_ALLOWED,&lhSession,NULL))==CMC_SUCCESS) the return code is CMC_E_FAILURE This logon works correctly with Outlook 2000 Thanks, Laurent. ...

Failed delivery msgs for unknown addresses
I am now getting failed delivery messages for addresses I have never seen before. I have AVG running and it has found nothing....but several times a day the hard drive indicator lights up and everything slows to a crawl and email stops. Nothing shows up in the Windows Task Manager under the Applications Tab. What is going on? Chattagator wrote: > I am now getting failed delivery messages for addresses I have never seen > before. I have AVG running and it has found nothing....but several times a > day the hard drive indicator lights up and everything slows to a c...

Failed to find SQL Express installation file SQLEXPRESS\SQLExpr.exe
I am trying to install ms crm laptop client and it keeps giving me this error: "Failed to find SQL Express installation file SQLEXPRESS\SQLExpr.exe" I have tried the following without success: - Copied the ISO Image's files on to laptop and renamed the sql express folder to match the above message - Separately installed the sqlexpress server I am trying to uninstall all the instances of sql/msde/sqlexpress right now. I will try to install again after that. Lets see. ...

SaveBarState fails when it is called from a thread
Hi, In my application, I use SaveBarState() for persisting control bar state. The code fragment is something like this. void CMainFrame::OnSavePersistance() { SaveBarState(_T("My Persistence")); // Saves some information to an xml file } Since my xml saving takes some time I changed the code to execute in a thread UINT ThreadFn(LPVOID pParam) { CMainFrame* pThis = (CMainFrame*)pParam; pThis->SaveBarState(_T("My Persistence")); return 0; } void CMainFrame::OnCntrlbartst() { AfxBeginThread( ThreadFn, this ); } But, now in the thread function SaveBarState...

Re: [ANN] Sync Entourage-iCal (new) and Sync Entourage-Address Book 2.5 Update for 2004
> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3167969215_28936720 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit On 5/20/04 9:01 AM, I wrote: > New scripts and updates for Entourage 2004: >> >> NEW: Sync Entourage-iCal 1.0 [for Entourage 2004 only] >> Sync Entourage-Address Book [PANTHER] 2.5 [free update - with new features >> for Entourage 2004] >> Export-Import Entourage X 1.3 [free update - with versions of the Exc...

About LoadBarState and SaveBarState
I wrote a MDI program like the following... // header file mainfrm.h class CMainFrame : public CMDIFrameWnd { ... CToolBar m_wndToolBar1; CToolBar m_wndToolBar2; ... }; // source file mainfrm.cpp int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... LoadBarState( _T("ToolBars\\ToolBar") ); return 0; } void CMainFrame::OnClose() { // TODO: Add your message handler code here and/or call default SaveBarState( _T("ToolBars\\ToolBar") ); CMDIFrameWnd::OnClose(); } The other code was created automatically by wizard. But If the tw...

Move mailboxes from exchange 5.5 to 2003
One of my clients are using NT4 with Outlook 98 against an external Exchange 5.5 They have no admin rights on the 5.5 server. They are now moving all users to XP with Outlook 2003 and an own Exchange 2003 (different domain) Is it possible to use some "move mailbox" wizard? How? or... Should every NT4/Outlook98/Ex5.5 user export their mail to a .pst file and then at their new XP/Outlook 2003/ import the .pst with Outlook into Exchange 2003? About 20-25 users. Tomppa On Fri, 17 Jun 2005 11:04:26 +0300, "Tommy Forsman" <tofors99@hotmail.com> wrote: >One...

Exchange 5.5/2K3 and Address Book views
Hi all! We have a mixed exchange org at the moment with exchange 5.5 and 2003 (SP1). Can someone please tell me how to setup the Address Book view to be like the one used by 5.5 users for exchange 2003 users? Or does anyone know how to migrate the exch 5.5 GAL to exch 2003 to save waht looks like a lot of work? Thanks in advance!! Ste On Thu, 5 Jan 2006 10:19:42 -0000, "Ste" <stephenbrandley@hotmail.com> wrote: >Hi all! We have a mixed exchange org at the moment with exchange 5.5 and >2003 (SP1). Can someone please tell me how to setup the Address Book view &g...

A problem With a Mixed Exchange2003 and Exchange 5.5 Organization
hey all. the thing is like this. Exchange Mixed Mode organization, during migration process to 2003. the scenario: outgoing mails from an Exchange 2003 SP1 site, passes through an RGC to an "Star" 2003 server in other Admin/Routing group. from there, it passes to another star that is an Exchange 5.5 SP4 Server in another site. from that server, the mail passes through IMC to the destination domain. (The Problem is not specific to the destination domain, because we created another SMTP domain for testing, and the same problem is there... the destination domain is an external site.) th...

Relay attempt failed
I get an error when trying to send to a specific external email address. I can send to other external email addresses. Here is my error: The following recipient(s) could not be reached: aash@outsidedomain.org on 5/16/2006 10:33 AM You do not have permission to send to this recipient. For assistance, contact your system administrator. <exchange.mydomain.com #5.7.1 smtp;550 5.7.1 <aash@outsidedomain.org>... relay attempt failed> I don't have any restrictions on the user attempting to send the email. Any comments/suggestions are greatly app...

Threading
I have a dialog application. I want use a button to start a thread. The code is: void CMyDlg::OnBnClickedButton1() { .... CWinThread *pThread = AfxBeginThread(ThreadProc, NULL); .... } UINT CMyDlg::ThreadProc(LPVOID pParam) { DWORD result =0 ; // do somthing ...; AfxEndThread(0); return result; } when compile, I got "error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'UINT (LPVOID)'" What is wrong? kathy wrote: > I have a dialog application. I want use a button to start a thread. The > code is: ...

XslCompiledTransform.Load() fails sometimes
Basically the issue is, when the XSL style sheet is loaded by URI it is cool but when the exact same style sheet loaded by it's contents the load fails (for this particular style sheet). Because our sheets are kept in a DB, loading by content is preferable. Content based load code: Stream xslStream =3D new MemoryStream(xslString); XmlReader xslTextReader =3D XmlReader.Create(xslStream); compliedXsl.Load(xslTextReader); URI based load code: compliedXsl.Load(xslUri); The error states that there in an invalid character for the encoding at line 2140 position 365. Here is the problematic...

Echange 5.5
I was given the following URL for how to add the ability to append a disclaimer notice to the end of each outgoing E-mail. The instructions seem simple enough to follow, but I'm not sure where to get the required dll. I've searchs Microsoft.com and haven't found it (yet). Is there some place that I can legitimately get this dll? Also, I'm trying to find some official documentation just to be safe. I don't want to take un-needed risks with the Exchange server. Also, I don't have to set it up this way, I'd much prefer a way to assign a signature on the ...

Auto reply #5
Exchange 2003. One of the user has resigned from my company. Is it possible to configure such that when someone send email to that user. It will auto-reply with my messages in the content. Can it be done if i had deleted or disabled the account? Note: Don't want to use "Out of Office Assistance" Try this: http://support.microsoft.com/?kbid=291956 -- Neil Hobson Exchange MVP For Exchange news, links, and tips, check: http://www.msexchangeblog.com "Emyeu" <cmchong20@yahoo.com> wrote in message news:OKyPKs0kFHA.4028@TK2MSFTNGP10.phx.gbl... > Exchange 2...

Sort fails on one column
I've been working with a spreadsheet, using different sorts on it. But suddenly one of the columns became a no-op for sorting, whether I sort on that column alone or do a multi-column sort. The only thing I did of interest was to define a pulldown list (for a different column) in a column over at the right, which is outside of the sort range. To be specific, I highlight columns A-J to sort, and J is the one that doesn't work. Columns L-M are used to define pulldowns, but not for column J. Any ideas? -- Christopher Brewster Lockheed Martin, Eagan MN Message posted via htt...

All update installs fail
On W2000 windows update was downloading and installing a long list of updates. Had to start several times and restart new update Everything went fine ABout 90 updates were downloaded and install of the started Suddenly after update 14 of 90 the process stopped Lost the KBnr something with Media player. Afterwards no possibility any more to install updates. Even with detailed and only one it does not work any more All installs happen immediately Then I get the message all instaal failed No error message and no possibilty to get it working again Nor manual nor automatic works Where c...

Ctrl-c fails to work
Unusual issue. I don't know if anyone knows a workaround. When a user opens GP (v7.5 sp4 and 7), ctrl-c and ctrl-v work fine for copying and pasting. Once Transactions>>Financial>>Reconcile is opened, ctrl-c no longer works. You can click edit>>copy, but the keyboard shortcut to copy fails (ctrl-v still works). Closing GP and reopening resolves the issue, until you open that window again. Any thoughts? I have a client that has the same issue that the Ctrl-C will fails to work on the SOP item line. However have not yet been able to determine what conditions cause i...

update fails
Every time I try to install KB979906 a MS update for net framework 1.1 sp1 it gets half installed then I hear the HD growl and it fails to install. Keeps coming back as a needed update. Any thoughts? SG Should have mentioned this: running XPpro sp3 with manual update install. This update comes back almost immediately as "updates are ready for your computer" message. "shakey" <NOONE@NOWHERE.NET> wrote in message news:up%23FZp0DLHA.1996@TK2MSFTNGP06.phx.gbl... > Every time I try to install KB979906 a MS update for net framework 1.1 sp1 > i...

Calling Excel from c++
Hi. I want to be able access Excel (read, write, and format data) from within C++. I have been doing it the other way around (calling c++ dlls from VBA) and it's just not quite as powerful as i would like. Any pointers to a good website or something on how to do this? "hamishd" <Hamish.Dean@gmail.com> ha scritto nel messaggio news:2cb9adfb-d00c-4e1c-9ab1-c5a968762c68@d36g2000prf.googlegroups.com... > Hi. I want to be able access Excel (read, write, and format data) from > within C++. > > I have been doing it the other way around (calling c++ dlls from VBA) ...

my exchange 5.5 server is being flooded
my exchange 5.5 server is being flooded. I have a spam filtering service that I subscribe to that works great for all our mail recipients, but my server is being flooded by e-mails with no originating server or anything. none of the e-mails have my domain name on them. I just deleted 3600 e-mails stuck in queue, I'm having to do this on an hourly basis. The only thing I can think of is they are using my IP address. how can I stop them ? TIA Craig Hi, you could have a look at my NoSPAMProxy. (freeware) Its easy to install. Just reconfigure your smtp from port 25 to port 26 and install the ...

SaveBarState fails when it is called from a thread #7
Hi, In my application, I use SaveBarState() for persisting control bar state. The code fragment is something like this. void CMainFrame::OnSavePersistance() { SaveBarState(_T("My Persistence")); // Saves some information to an xml file } Since my xml saving takes some time I changed the code to execute in a thread UINT ThreadFn(LPVOID pParam) { CMainFrame* pThis = (CMainFrame*)pParam; pThis->SaveBarState(_T("My Persistence")); return 0; } void CMainFrame::OnCntrlbartst() { AfxBeginThread( ThreadFn, this ); } But, now in the thread function SaveBarState...

Failed to create organization
HI I try to install MS CRM with MSDN Subscriber license. The system returns me : "Failed to provision your initial business" "Failed to create organization" I check services and the one "Crystal APS" isn't started. I try with the Local System account and a error message is returned with no specific error number... I try now with a Domain account, it runs. During the install, when the system ask me with which account I want to start services, I answer a Domain Account... Can the main error message come from this handling ?? I try with the other option...

Problem with LoadBarState/SaveBarState
Hi, I've got multiple toolbars (with unique IDs) and use LoadBarState in OnCreate and SaveBarState in OnClose. It works pretty good with one exception: Wherever the toolbars are when I close the app, the next time I open the app the toolbars are always shifted in the x direction by about 4 units. Using VS .NET. Thanks for any help:). Steve Here's what it looks like: http://www.rick-n-steve.com/temp/help.html Why does MFC and LoadBarState/SaveBarState boink the coordinates? On a side note, the problem appears to be because I am not using the DOC/VIEW architecture in MFC. I'm man...

PST File #5
I can find only 1 PST file for Outlook. Is this the only file that I need to save when I do reformat? Thanks Scott Unhide all hidden files and do another search just to be safe, however Outlook does store everything in one PST file "Tech" <tech2@techauto.com> wrote in message news:kaydnSRyyIUJpYzd4p2dnA@centurytel.net... > I can find only 1 PST file for Outlook. Is this the only file that I need > to save when I do reformat? > > Thanks > > Scott > > Actually, it is possible to create multiple .pst files with different names. >-----Ori...