SaveBarState fails when it is called from a thread #2

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 8:43:09 AM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
657 Views

Similar Articles

[PageSpeed] 27

Reply:

Similar Artilces:

DataSet/XmlSchema/DataGrid Framework 1.1
Hi, I have a problem with reading an XmlSchema with Frameowk 2.0 and an own DataType. I found no example (searching two days). What I do is: DataSet dataSet = new DataSet(); dataSet.ReadXml("{path}/MySchemaAndData.xml"); dataView = dataSet.Tables[0]; dataGridView.DataSource = dataView; Easy with Framework 1.1 (VisualStudio 2003). Everything is working fine. Now with rameowrk 2.0 I get one error after another, maybe someone can help me solve the problem, knows a link or what ever. I'm really despairing. If need, i can write more information, what i tried unsuccesfully for th...

restricting sending of email messages #2
My company uses Exchange 2003 with Outlook clients. Currently email users are able to send messages to an address called All Users which sends a message to all addresses in the Global Address Book. I need to configure Exchange so that only a select group of email users can send a message to All Users. Is this controlled by Exchange or AD? Any suggestions on how to accomplish this will be appreciated. ...

OWA 2003 logon fails when failover to 2nd node on cluster backend
I have an issue that isn't an easy one, or maybe it is. I am running win2k3 OS 2-node active/passive cluster on my back-end exchange 2003 sp1 system. No I am not running SP1 for win2k3 yet. Haven't tested it with the HBAs I have. I had issue with some older ones. I have installed the following KBs 832759; 841561; 831464. When users logon when the backend is running off the primary node it works great, but when I failover to the 2nd node the only people that can log on are administrators and child domain users. I have the following in my IIS log NODE2 2005-07-11 19:00:13 XXX.XXX.XX...

Need to call all resources in TimeSheet manager Pick resource wind
When I want to assign any time sheet manager for any resource . then click on Browse button. But the Pick Resource Dialog Box open with only few names and there is not a name of required person in timesheet Pick Resource Dialog Box . Although I have 200 resources in resource center . Kindly tell me how i can call or display all resources of project server in Pick Resource Dialog box. Waiting for Reply. Sam -- Only members of the Resource Managers group and the Administrators group are visible in the dialog to which you refer. If someone is going to be a Timesheet appro...

Removing Exchange 5.5 #2
I'm doing a migration exercise in a test lab without internet connection. Here's what I have (1 site, 1 domain): - Win2003 ADC (as a result of in place upgrade from NT4) - WinNT4 BDC with Exch5.5 SP4 - Win2003 member server with Exch 2003, ADC (connection agreements for mailboxes, public folder and configuration already defined and seems to work fine) Exch2003 was installed in Exch5.5 site (I tell it to join Exch5.5 site). I have just successfully moved all user mailboxes from 5.5 to 2003. We don't use public folders, so I suppose there is no reason to run PFMigrate tool since t...

Watermark #2
How do I enter a watermark? ...with the text "draft" Visit http://www.xldynamic.com/source/xld.xlFAQ0005.html best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "plantslayer" <plantslayer@discussions.microsoft.com> wrote in message news:CC413618-43CC-4185-91D4-F45ED085497E@microsoft.com... > How do I enter a watermark? ...with the text "draft" On Wed, 25 Mar 2009 15:24:18 -0300, "Bernard Liengme" <bliengme@stfx.ca> wrote: >Visit >http://www.xldynamic.com/source/xld.x...

A Publisher 2002 document sent to me starts at page 2.
How can I change it so that it starts correctly at page 1. Select all on each page, group, drag them out to the scratch area, drag page two to page one and page one to page two. -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.msauer.mvps.org/ news://msnews.microsoft.com "Robert Sterry" <Robert Sterry@discussions.microsoft.com> wrote in message news:A3080E11-CFE3-4144-B6E7-04D2A2B47E39@microsoft.com... > How can I change it so that it starts correctly at page 1. A small child turns to Ed, and exclaims: "Look! Look! A post from Robert Sterry <Robe...

2 chart types within a graph
I have a chart with three data series. Two of them I want to stack together, and a third to stand on its own. When I select the data series that I want to stack, it stacks all three data ranges, even though I've only selected one data series, not all of them. I can't figure out how to do this. I made a stacked column chart of this data Where x y z a 1 4 4 b 2 5 5 c 3 6 6 d 4 7 7 Then I right clicked the z data series on the chart, selected Chart Type and made it a Line Worked just fine. It works for any of the three data series - not just the top one. Let us know if...

Operation failed, then closes
Just installed Office 2000 on Win2kPro. Office was on there previously but I had to try a clean install of Windows to try and get rid of some problems. After installing Office I receive the error, "Operation failed." Then Outlook closes. Any ideas? Bill DeShawn http://my.sterling.net/~bdeshawn I uninstalled and reinstalled Office 2000 and it fixed the problem. "Bill DeShawn" <bdeshawn@nospamsterling.net> wrote in message news:uEhtbZWuDHA.2360@TK2MSFTNGP10.phx.gbl... > Just installed Office 2000 on Win2kPro. Office was on there previously but > I had to t...

columns #2
How come when I sometimes open Excel.. the columns are headed with numbers and not letters? How do I stop this from happening? Thanks "Jon" <jbauer@accxx.com> wrote in message news:0bab01c34d2b$c93f7ee0$a501280a@phx.gbl... > How come when I sometimes open Excel.. the columns are > headed with numbers and not letters? How do I stop this > from happening? > > Thanks Tools > Options > General tab, uncheck R1C1 reference style. IIRC this is a setting that is taken from the first file opened. So, anytime this happens, change the setting given by Anon,...

Microsoft Excel taking 100% processor time for 2~3 minutes for few excel sheets
Hi, I experienced slowness in opening certain excel sheet, which is around 10MB in size. The excel sheet is created using Excel 2000. Have tried upgrading to Excel 2003 with latest service packs but it doesn't help. Suspect it is the recalculation that is taking up the processors. It is a 1.5Ghz P4 with 512MB RAM. Any optimization/repair can be done on the excel sheet? or some option to reduce the recalculation intensity? Thanks. For lots of information about calculation speed, visit Charles William's site: www.decisionmodels.com -- Kind regards, Niek Otten "ping" ...

microsoft.public.outlook #2
This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C731CB.30954700 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 545465 ------=_NextPart_000_0018_01C731CB.30954700 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html> <head> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dus-ascii"> <meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)"> <style> <!-- /* Style Definitions */ p.Ms...

2 Exchange servers how does mail get to them
Hi I have just added a second exchange 2003 server to my organisation. At the moment there is 1 MX record for the original server. What is the best way to get mail to the second server? Leave the MX record and let exchange pass the email between servers or set a second MX record and let them both pass email between them for mailboxes on the other server? Any advice would be appreciated. M Leave the MX record as it is and let Exchange route mail to the appropriate mailbox. This simplifies your gateway anti-virus/anti-spam & firewall solution as there is only one point of mail entry i...

fail PROPLUS.MSI
hope that any kind soul will attach this fail to me as I need it to compltet my installation. Thank You The proplus.msi file is on the Office Professional CD that was widely pirated - this is an enterprise copy of the software so I doubt than anyone wants to be an accomplice. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the Swen virus, all e-mails sent to my actual account will be deleted w/out reading. After searching google.groups.com and finding no answer george town <georgetownsecsch@hotmail.com> asked: | hope that any k...

DPM Agent Install failed with Errorcode =80070643
I have problems with install DPM Agent 2007. Environment: DPM 2007 on W2008 x64 DPM Client All machines same AD. Client machines: W2008 x64 (Exchange and other HYPER V Machines) W2K3 SP2 (FAX, etc.) W2K3 Agents are working fine. Install on the W2008 failes with Errorcode =80070643. I ve checked already the previous postings: - DCOM Group - MSXML 6.0 - DPM Groups in AD on DCs - Local Administrator Accounts So I going to poste the always requested Log files. Perhabs someone can figure out whats wrong. PS: I have also tested install on W2008 32Bit, but failed with...

publisher fails to load
pulisher fails to load and i get error message 3520 can anyone help What version Publisher? Do you have all the updates? Has Publisher ever opened for you? Have you tried opening in safe mode? http://www.microsoft.com/downloads/search.aspx?displaylang=en -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.mvps.org/msauer/ news://msnews.microsoft.com <anonymous@discussions.microsoft.com> wrote in message news:e2ff01c43c35$65ef4790$a501280a@phx.gbl... > pulisher fails to load and i get error message 3520 can > anyone help ...

outlook 2002 #2
I was reading in the new Consumer Reports about spam. It said to disable the preview pane to prevent the spam from reporting to its sender that you received it. I am using the preview pane in Outlook 2002 is this information correct? Sammy Castagna Read receipt request is something that gets generated by the client when you read a message. I believe if you select the check box that prevents the preview pane from marking the message as read, then it will prevent the read receipt request from being generated. "Sammy Castagna" <sammycastagna@hotmail.com> wrote in message n...

Function help #2
I am wanting to know how to get excel to look at a coloumn of information and compare with another coloumn and then tell me what and where the differences are. Let me explain what I have. I have a spreadsheet that has two seperate "pieces" of information. Each piece has two coloumns. What I need to do is have a function that will look at coloumn a and then compare it with coloumn b. The twist in this is that the information does not line up as far as the rows go. I am running Excel 2000 on an XP box. Any help is great. thanks!!!! Derrell Try using conditi...

Cannot install MS CRM 3.0c laptopclient
Hi, I'm trying to install the latest laptop client onto my PC, I uninstalled the previous client and also made sure I removed the old MSDE database, however on the prerequisites SQL Server Express (crm) fails to install given the error message: No encryption key is available. A well-known encryption key was returned. Various searches on the internet have not shed any light on what this error message means or how to resolve the problem, has anyone else encountered this? Jon Jon, to be able to help you, I need following info. 1. What is version of CRM laptop client? 2. What is your PC&...

Big Problem #2
Hi, Can any one tell me. Whem a User Edits an Excel file from centralised folder from server, one file is created in that centralised folder on server and it is temp file. Why it is created on the server, but not on the perticular users machine? Please give me the required help. Vivek khorate. When excel saves the file, it saves it as a temporary file with a funny name (8 characters--no extension) in the same folder. If the save is successful, xl will delete the original (or rename it to its backup name (like "backup of book1.xlk)) and if that's successful, xl will rename...

Shortcuts #2
In Outlook 2003, how do you set shortcuts to folders other than personal folders such as tasks, mail, etc. I would like to set shortcuts to my file system. Does it require exchange server to make such a link (shortcuts)in 2003. I was able to do this in outlook 2000. Any help would be appreciated. thanks, dan Drag and drop the file or folder you want a shortcut for in the Shortcuts Navigation and it will create a shortcut itself -- Roady [MVP] www.sparnaaij.net Microsoft Office and Microsoft Office related News Also Outlook FAQ, How To's, Downloads and more... Tips of the month:...

Forgot to save #2
I forgot to save something that I spent a day working on and then I accidentally closed excel. All of my changes are lost. Is it possible to recover them from a temp file? Hi unfortunately: No. Maybe you have enabled AutoSave? -- Regards Frank Kabel Frankfurt, Germany "dave" <anonymous@discussions.microsoft.com> schrieb im Newsbeitrag news:14b201c49113$6007da30$3a01280a@phx.gbl... > I forgot to save something that I spent a day working on > and then I accidentally closed excel. All of my changes > are lost. Is it possible to recover them from a temp file? Fo...

Pivot Table Page Field #2
Hi, Does anyone know if I can interact with the (All) selection of a pivot table page field? I would like to either take it out or change it's caption. Neil You can't suppress the "All" option in the page field, or change its caption. With programming, you could select another item if the user selects "All". For example: '======================== Private Sub Worksheet_Change(ByVal Target As Range) Dim pt As PivotTable Dim pf As PivotField Set pt = Me.PivotTables(1) Set pf = pt.PivotFields("Region") With pf If .CurrentPage = "(All)&q...

001 #2
...

Excel 2003 issue with Windows XP Pro SP-2
Hi Folks, I saw that this question had been posted by many people already, but I could not find an answer for the same. I am using Windows XP Pro Service pack 2 and Office 2003. Scenario 1) I have a hyper link in a web page that opens up an Excel document. When I click the link, I get the IE dialogue box with "Open' and "Save" options. After that, if I click "open" it opens the Excel Window without any data in it, but with an error message telling that -- 'C:\Documents and *****\--\--\abcd.xls' could not be found. Check the spelling of the file name and ...