Sharing data between 2 Forms in an MFC MDI application

Ok, the subject says it all I guess.  I need to share data between my
mainframe, and multiple forms in my application.  Whats the best way to
accomplish this?

Brian


0
5/4/2004 7:52:59 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
545 Views

Similar Articles

[PageSpeed] 14

I think you are following exact MDI way.. so here is what can be done...

CWinApp::GetFirstDocTemplatePosition
CWinApp::GetNextDocTemplate

you will get CDocTemplate* typecast to CMultiDocTemplate*

CMultiDocTemplate::GetFirstDocPosition
CMultiDocTemplate::GetNextDoc

Get document associated with another form and get the data...

Neel


"Brian Minier" <brian_minier@no-spam.iisvr.com> wrote in message
news:OpIO1EhMEHA.892@TK2MSFTNGP09.phx.gbl...
> Ok, the subject says it all I guess.  I need to share data between my
> mainframe, and multiple forms in my application.  Whats the best way to
> accomplish this?
>
> Brian
>
>


0
neelagain (74)
5/4/2004 9:15:40 PM
Ok, that gives me something to go on.  But before I get to far along let me
try and confirm that this will work with even forms loaded dynacimally.
THinking back to it, it should but if you have any hints or pointers, let me
know.

"Neel Roy" <neelagain@hotmail.com> wrote in message
news:OKApxzhMEHA.2824@TK2MSFTNGP10.phx.gbl...
> I think you are following exact MDI way.. so here is what can be done...
>
> CWinApp::GetFirstDocTemplatePosition
> CWinApp::GetNextDocTemplate
>
> you will get CDocTemplate* typecast to CMultiDocTemplate*
>
> CMultiDocTemplate::GetFirstDocPosition
> CMultiDocTemplate::GetNextDoc
>
> Get document associated with another form and get the data...
>
> Neel
>
>
> "Brian Minier" <brian_minier@no-spam.iisvr.com> wrote in message
> news:OpIO1EhMEHA.892@TK2MSFTNGP09.phx.gbl...
> > Ok, the subject says it all I guess.  I need to share data between my
> > mainframe, and multiple forms in my application.  Whats the best way to
> > accomplish this?
> >
> > Brian
> >
> >
>
>


0
5/4/2004 9:22:47 PM
Are the forms associated with separate documents, or do they represent multiple views on
the same document?

Note that the finding document templates will give you every document you have open, so if
you have a complex association between documents, you have to figure out which is the
correct document of the many documents you have.

When both CFormViews share a common document, it is a lot easier. What I usually do is
each time the value changes in CFormViewOne, I set the appropriate value variable in the
shared CDocument, and the function that sets this variable calls UpdateAllViews(), which
notifies all the other views to check and see that their data is up-to-date. Thus changes
are reflected instantly.

In some cases, you may not want to see the changes until you switch focus. In this case,
you don't check the values until a view is activated. I don't like this method because if
both views are present, they are out-of-sync, and the results are ugly.
					joe

On Tue, 4 May 2004 17:22:47 -0400, "Brian Minier" <brian_minier@no-spam.iisvr.com> wrote:

>Ok, that gives me something to go on.  But before I get to far along let me
>try and confirm that this will work with even forms loaded dynacimally.
>THinking back to it, it should but if you have any hints or pointers, let me
>know.
>
>"Neel Roy" <neelagain@hotmail.com> wrote in message
>news:OKApxzhMEHA.2824@TK2MSFTNGP10.phx.gbl...
>> I think you are following exact MDI way.. so here is what can be done...
>>
>> CWinApp::GetFirstDocTemplatePosition
>> CWinApp::GetNextDocTemplate
>>
>> you will get CDocTemplate* typecast to CMultiDocTemplate*
>>
>> CMultiDocTemplate::GetFirstDocPosition
>> CMultiDocTemplate::GetNextDoc
>>
>> Get document associated with another form and get the data...
>>
>> Neel
>>
>>
>> "Brian Minier" <brian_minier@no-spam.iisvr.com> wrote in message
>> news:OpIO1EhMEHA.892@TK2MSFTNGP09.phx.gbl...
>> > Ok, the subject says it all I guess.  I need to share data between my
>> > mainframe, and multiple forms in my application.  Whats the best way to
>> > accomplish this?
>> >
>> > Brian
>> >
>> >
>>
>>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
5/6/2004 2:53:07 AM
See MSDN May 2004, C++ Q&A, Updating Views in MFC by Paul Dilascia

Hope this helps,

Doug

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:es9j90lngb7mq4emrb5eahaio4ibcnl3ga@4ax.com...
> Are the forms associated with separate documents, or do they represent
multiple views on
> the same document?
>
> Note that the finding document templates will give you every document you
have open, so if
> you have a complex association between documents, you have to figure out
which is the
> correct document of the many documents you have.
>
> When both CFormViews share a common document, it is a lot easier. What I
usually do is
> each time the value changes in CFormViewOne, I set the appropriate value
variable in the
> shared CDocument, and the function that sets this variable calls
UpdateAllViews(), which
> notifies all the other views to check and see that their data is
up-to-date. Thus changes
> are reflected instantly.
>
> In some cases, you may not want to see the changes until you switch focus.
In this case,
> you don't check the values until a view is activated. I don't like this
method because if
> both views are present, they are out-of-sync, and the results are ugly.
> joe
>
> On Tue, 4 May 2004 17:22:47 -0400, "Brian Minier"
<brian_minier@no-spam.iisvr.com> wrote:
>
> >Ok, that gives me something to go on.  But before I get to far along let
me
> >try and confirm that this will work with even forms loaded dynacimally.
> >THinking back to it, it should but if you have any hints or pointers, let
me
> >know.
> >
> >"Neel Roy" <neelagain@hotmail.com> wrote in message
> >news:OKApxzhMEHA.2824@TK2MSFTNGP10.phx.gbl...
> >> I think you are following exact MDI way.. so here is what can be
done...
> >>
> >> CWinApp::GetFirstDocTemplatePosition
> >> CWinApp::GetNextDocTemplate
> >>
> >> you will get CDocTemplate* typecast to CMultiDocTemplate*
> >>
> >> CMultiDocTemplate::GetFirstDocPosition
> >> CMultiDocTemplate::GetNextDoc
> >>
> >> Get document associated with another form and get the data...
> >>
> >> Neel
> >>
> >>
> >> "Brian Minier" <brian_minier@no-spam.iisvr.com> wrote in message
> >> news:OpIO1EhMEHA.892@TK2MSFTNGP09.phx.gbl...
> >> > Ok, the subject says it all I guess.  I need to share data between my
> >> > mainframe, and multiple forms in my application.  Whats the best way
to
> >> > accomplish this?
> >> >
> >> > Brian
> >> >
> >> >
> >>
> >>
> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm


0
dcmace3 (2)
5/9/2004 2:04:30 AM
Reply:

Similar Artilces:

Rollup 2 and Office 2007
I already have Roll Up 1 and the Office 2007 compatibility patch installed. If I now install roll up 2 will I have to reinstall the office 2007 compatibility? yes -- Regards, MS CRM Certified Professional http://microsoftcrm3.blogspot.com Chat with me on MSN / Gmail / Skype : ID Is :.. mscrmexpert@gmail.com "LLoyd" wrote: > I already have Roll Up 1 and the Office 2007 compatibility patch installed. > If I now install roll up 2 will I have to reinstall the office 2007 > compatibility? ...

Microsoft POS #2
I have a group of customers that I am working on setting up A bundled POS system for. I have looked at RMS and Microsoft POS. The customer's are small bulk food stores. They package all of the bulk food in various containers and weigh it with a Hobart scale producing a label with an system 2 price enbedded barcode. These are UPC A formats. They are for the most part simple single store installs and donot require the complex RMS system. I have setup the Microsoft POS version 2.0 and found it will work perfect for these customers. The only problem when you programed the system you l...

Outlook 2003 keeps crashing #2
I get this message when I look in System information. Outlook keeps crashing quite often. I cannot for example delete two messages without outlook crashing. My colleagues do not have this problem. We are using the Microsoft mail exhange server. Faulting application outlook.exe, version 11.0.5510.0, stamp 3f1380f0, faulting module mso.dll, version 11.0.5606.0, stamp 3f334cce, debug? 0, fault address 0x003b6e16. Does anyone has a solution?=20 Best regards/ Bj=F6rn 1) I would definitely apply Service Pack 2for Office 2003 + applicable critical security updates. 2) Have you tried starting O...

Lookup based on criteria in 2 columns
Hi, I am trying to use a vlookup or other function to return the value in the amount column based on the location and date. Here is a sample of my data: Location Date Amount 101 9/15/8 10 101 9/16/8 20 101 9/17/8 15 102 9/15/8 50 102 9/16/8 75 102 9/17/8 67 For example if I wanted to return the amount for location 102 on 9/15/8, what formula would I use? I tried using variations of vlookups but had no luck. Thanks, =SUMPRODUCT(--(A2:A50=102),--(B2:B50=DATE(2008,9,15)),C2:C50) -- Regards, Peo Sjo...

Inserting form values into a table
We have a form with values taken from an sql query that comes from two different tables. We would like to enter the information into a third table. Can some one direct me to code that will do the following: 1. Provide the Insert sql that shows us how to add the form values to the table 2. Show us how to loop while inserting the information into the table (there could be several lines on the form, each must be inserted one at a time). I have worked with Access before and have never had a problem inserting information. However, I cannot quite figure out how to insert informtion through an ...

MS Money 95 data files
I hope that some one can answer this for me. I have used MS Money 95 for years, and it works just fine for me on Windows XP, however, I now have to reformat my hard drive, and have discovered that I can nolonger find my original install disk. Will the latest versions of Money still read the MS Money 95 data files. All that I have ever used the program for is to track my investments, and am unlikely to do any different in the future. Thanks Stan B In microsoft.public.money, Stan Banner wrote: >I hope that some one can answer this for me. >I have used MS Money 95 for years, and...

data input in text box
We have a form which the operator enters data in a text box. Currently we have a 'done' button on the form that the operator clicks to send the text box info to a vba program. How can we send the text box info to the vba program when the operator hits the enter key @ the end of the data entry for the text box? TIA -- _______________________________ In Christ's matchless name ted & colleen n6trf kc6rue Use the control's AfterUpdate event. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "ted" <n6trf@arr...

Transferring over outlook data to new XP machine
How do I transfer over my old emails, address book to my new XP machine? I have looked over the internet and found nothing the tells me EXACTLY how to do this, any help would be greatly appreciated. senior_tech@yahoo.com If your using MS Outlook copy your .PST file across and import it into the new install. >If your using MS Outlook copy your .PST file across and import it into the new install. No, don't import it. Simply use "File">"Open" -- Brian Tillman Smiths Aerospace 3290 Patterson Ave. SE, MS 1B3 Grand Rapids, MI 49512-1991 Brian.Tillman is the nam...

Standard MFC controls behave different when showing polish characters
Hello all, I have a rather simple to describe but difficult to solve problem. Our customers want to use our ANSI MFC program to show different languages. For example Polish. When I set the font for the different controls they behave different. For example the CEdit shows the polish characters just right but the CButton with checkbox style shows glyphs instead of the special characters. Every control that is owner draw and uses for example the DrawText() function of the device context shows the characters right. I've experimented with _UNICODE for the display part and everything I could ...

Parsing data from one spreadsheet into another format
The data that we dump out of one machine comes in like below. %AT_1300 Bottoms|Conductivity| (Water Out) InputRange VDC1to5 %AT_1300 Bottoms|Conductivity| (Water Out) Custom_Range_Low 0.0 %AT_1300 Bottoms|Conductivity| (Water Out) Custom_Range_Hi 0.0 %AT_1300 Bottoms|Conductivity| (Water Out) MinScale 0.0 %AT_1300 Bottoms|Conductivity| (Water Out) MaxScale 20.0 %AT_1300 Bottoms|Conductivity| (Water Out) EngUnits mhos %AT_1300 Bottoms|Conductivity| (Water Out) StepResponseTime 1.0 %AT_1300 Bottoms|Conductivity| (Water Out) DigFiltTimeCnst 0.016 And I need to convert this data to this f...

Input Excel 'Password to Open' through control in access form
Hi All, We know,Excel has prompt password to open it files. Is it possible to create a code that can supplies the excel prompt password?.So that when we open the excel file through our access control in a form, the excel files can be opened automatically.But when the excel files opened from its default icon,it will prompt a password first. ...

Sorting Data #5
Is there formula or anyway to be able sort the below data into a format that I could create a pivot table on? I spend to many hours doing this every month. Invoice #: 12345 Invoice Date: 1/16/1950 A/P Code: ABC Due Date: 1/16/1950 Total Payable: $100.00 Reference: Freight: Account #: 1234 Description: Name Reference 1 Amount: $100.00 Account #: 4321 Description: Name Reference 2 Amount: $100.00 Account #: 9876 Description: Name Reference 3 Amount: $100.00 Any help would be much appreciated!! You need to show a Before and After version. You still might not get any help, but your ...

Find prev record on other requeried form
Using access 2003. I have a main form for name and address info. A subform shows limited info on client placement. Click a command button on the main form and user opens another form for full screen entry of placement data. That form opens showing the client selected on the initial main form. When the full screen placement form closes, it requeries the original main form with the placement subform to show the added placement. It goes to the first record in the table though. It does not show the original client whose placement was just added. How do I set the mai...

HELP! Need to export hourly sales data on POS (NOT RMS)
How can I export hourly sales data across a date range? For instance, I want to show hourly sales for the month of October so I can graph it and post it in our break room. If I can't export hourly data, can I export daily sales? The built-in reports don't address this data format. This is a multi-part message in MIME format. ------=_NextPart_000_008E_01C826DC.CBC512D0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit Mark, This should work for you. Keep in mind it takes up to 5-10 minutes to load...

sharing of folders
I tried configuring my folder to share it with the others but unfortunately as i tour around the outlook i could find the permissions tab when i right click the properties of a certain folder. What should I do with this problem? Is there other way in order I could share my folder? Pls. help Thanks and regards You'll have to tell us more about your Outlook version and mail environment. In the meantime, you might want to take a look at http://www.slipstick.com/outlook/share.htm -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Po...

displaying colors in an mfc application
Hi everyone, I'm working on an MFC application. The application is a treeview in which are represented some objects (persons, roles....). I have declared some bitmaps in the visual project to represent these objects. My problem is that some colors of the bitmaps are not displayed. I guess there is a palette problem or something like that. Does anybody have an idea of what the problem is? Thanks a lot for your help.... Fred Try using ILC_COLOR24 | ILC_MASK when you create your imagelist. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "fred" <fred@laposte.net> wrot...

[b]Can I download Excel data to a MS Access database?[/b]
I've built an Excel 2002 form that I want our internal customers to access from our intranet, and use. Once completed, they will send it to us as an e-mail attachment. I'd like to be able to open it, and somehow download the data from the form into an MS Access 2002 database I've built (so that we don't have to rekey it into the database). Is this possible or even feasible? Any and all help is appreciated. Thanks. :D --------- Message sent via www.excelforums.com Hi in Access check 'File - Import External data' -- Regards Frank Kabel Frankfurt, Germany "...

2 register ruinning together on one z report
Is this possible, to have two registers running on one z report ? We have a small store and would like to setup a second register as a backup, temporary addition ( during rush hours) Since we are a small show i do not need to have a separate register reports. Can two registers ring up all sales together as one ? How can i set this up ? No, you can't do that. You might be able to use the Register Analysis report available in SO Manager Utilities/Crystal Reports to get something close to a single Z though. Glenn Adams Tiber Creek Consulting http://www.tibercreek.com glenn@tibercreek.c...

How do I merge cells with multiple data values?
I've tried highlighting the two cells which are in the same row. It suggested that I format and align. Both of which I've tried. I keep getting the same error message, "The selection contains multiple data values. Merging into one cell will keep the upper-most data only." I need to make the cells one with all my information. Is this possible? Not knowing what you want to do, let me make a suggestion. Put all your data into the first cell and leave the second cell empty. Select both cells. Click on Format - Cells - Alignment tab. In the "Horizontal" b...

Setting MDI Parent Size To Fit Around A Child Form
Hi, How do you set the client size of an MDI parent to fit around a child form? Breakpoints in the constructor and load event handler show the child size to be already modified to fit into the parent; the child's size does not match what shows in the Designer. I suppose the real question might be how do you determine the size of the child window or keep the parent from changing it first? Thanks, Gary What you're asking for is a little backwards, but I'm sure you have your reasons. At any rate, these are the properties you will want to investigate: ...

outlook 98 corperate forms
In a corperate environment, Outlook 98 forms not active for using on some of the PCs. Why it happens? How can I solve this problem. ...

Please ignore #2
Testing a posting problem -- Jim Bunton ...

Linking information form one worksheet to another
Hi, i have a big problem i want to create a link between some columns in two seperate worksheets, so that when i type a name on the master sheet it would give me the required information.Dont know if i explained this right, lets say on the master sheet i have columns : Name,Sex and Height on columns A,D and BH respectively i want that if i type a person's name in worksheet 2 it should give me the results on columns A,C,F in that worksheet. Please help i need it asap for my director One way .. Assuming your "master" sheet is named: Master, with data in row1 down In Shee...

matching contents #2
E1 thru E10 contains sequentially-sorted data. B1 thru B6 contains sequentially-sorted data which matches SOME (but not ALL) of the data in Col A. For example. B E 1 1 1 2 3 2 3 4 3 4 5 4 5 6 5 6 10 6 7 7 8 8 9 9 10 10 I need to move the data in the cells in Col B next to the cells in Col E that have the same contents. For example: B E 1 1 1 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 8 8 9 9 10 10 10 Besides dr...

HELP! remote data not accessible msg
Hello, I have a use who is currently using a Bloomberg DDE add- in. Whenever he attempts to activate the add-in to retreive remote data, the system hangs. If I go to task manager, I then see a message stating "Remote data not accessible. To access this data Excel needs to open another program.... I have searched the knowledge base and didn't find much help. Does anyone have any ideas? I am desperate!!!! We are currently using Excel 2003 in XP Professional. TIA, Ramissah ...