MFC C++: Accessing Members of MainFrame

Hello

    I have a MDI app which I am going to be displaying real time data coming 
from a USB device in the views. I instantiate my USB device object, register 
for notifications,  respond to PnP and download firmware to the device 
within MainFrame.cpp.  The pointer to the USB device class is a member 
variable of my MainFrame class.

    Now I want to be able to have access to the pointer and data coming 
through its endpoints from any of my views or docs.


    One of my weaknesses with respect to C++ is the proper way to access 
members in other classes. I am confused about that.

    How do I do that?

    thanks
eng@em
 


0
gospam (47)
5/1/2005 1:30:31 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
752 Views

Similar Articles

[PageSpeed] 41

nap wrote:
> Hello
> 
>     I have a MDI app which I am going to be displaying real time data coming 
> from a USB device in the views. I instantiate my USB device object, register 
> for notifications,  respond to PnP and download firmware to the device 
> within MainFrame.cpp.  The pointer to the USB device class is a member 
> variable of my MainFrame class.
> 
>     Now I want to be able to have access to the pointer and data coming 
> through its endpoints from any of my views or docs.
> 
> 
>     One of my weaknesses with respect to C++ is the proper way to access 
> members in other classes. I am confused about that.
> 
>     How do I do that?
> 
>     thanks
> eng@em
>  
> 
> 

MFC provides a global function for accessing your main window:

CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
pMainFrame->SomeFunction();

-- 
Scott McPhillips [VC++ MVP]

0
Scott
5/1/2005 3:10:02 AM
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> wrote in message 
news:OPabbLfTFHA.2172@tk2msftngp13.phx.gbl...
> nap wrote:
>> Hello
>>
>>     I have a MDI app which I am going to be displaying real time data 
>> coming from a USB device in the views. I instantiate my USB device 
>> object, register for notifications,  respond to PnP and download firmware 
>> to the device within MainFrame.cpp.  The pointer to the USB device class 
>> is a member variable of my MainFrame class.
>>
>>     Now I want to be able to have access to the pointer and data coming 
>> through its endpoints from any of my views or docs.
>>
>>
>>     One of my weaknesses with respect to C++ is the proper way to access 
>> members in other classes. I am confused about that.
>>
>>     How do I do that?
>>
>>     thanks
>> eng@em
>>
>
> MFC provides a global function for accessing your main window:
>
>
> -- 
> Scott McPhillips [VC++ MVP]
>

Thank you Scott. 


0
gospam (47)
5/1/2005 3:10:14 AM
Reply:

Similar Artilces:

Job Listing- VC++ MFC with Isofttech
Position: Technical Lead Experience: VC++/C++ with MFC Good to have: Wireless 802.11 Skills & Windows development experience. 5-6 years of experience. Work Location: Chennai Education: BE/B Tech, ME/M Tech ( CS,IT,ECE,EEE) Do send in your CV to sridhar.doss@consultniche.com thanks s.doss niche consulting ...

Access Code Pushing Values
I have a customer database with [BillAddress] and [ShipAddress]. I am using a "yes/no" box titled[SameShipAddress?]. To automatically fill [ShipAddress] after checking the "yes/no" box I used this code in the after update event for the check box. If Me![SameShipAddress?] Then If IsNull(Me![BillAddress]) Then Else [ShipAddress] = [BillAddress] End If End If This works for the selected customer, but then pushes the entry [BillAddress] of the previous customer to [ShipAddress] of all of the following customers. Any thoughts? Sounds as...

Data source for PivotTable-Form in ACCESS 2000
Hi, this drives me crazy, 4 years ago I defined in an ACCESS 2000 application a "PivotTable-Form". The resulting EXCEL table inclusive the "Data refresh" works perfect. I now want to update/change the query for the "Data Source" but cannot find which query is behind the "PivotTable-Form" or behind the resulting EXCEL spreadsheet. When editing the properties for the "PivotTable-Form" or the EXCEL spreadsheet the "Data Source" is always blank. Question: Where does Access 2000 or EXCEL 2000 hide the respective data source (Query)...

access 2007 and custom toolbars in earlier version
Is there a way in Access 2007 (Enterprise) to modify a custom toolbar created in say Access 2002? In the help there are only topics about the quick access toolbar. I want to modify the action of a button, but right clicking and choosing customize, like used to be so easy (once you get used to it), is no longer possible. Does that mean no more custom toolbars and no backward compatibilty here? Help would be very welcome as the user friendliness of my user's experience is at stake here. ...

Removing an exchange server member
I have a 2000 exch backend and a 2003 exch frontend setup. The front end hard disk just recently died. And so was not correctly un installed from AD. There are still elements of exchange hanging around. For instance, in the system manager. But the system manager wont let me delete the front end server under the first administrative group. Do i have to use adsiedit to remove this or is there a much simplier way. Cheers Paul To my best knowledge, it adsiedit. "Yakeni" <Yakeni@discussions.microsoft.com> wrote in message news:B352B981-F5B7-4527-8A48-04E3976C99D9@microsoft.c...

Best book for learning MFC/VC 7.1 for developing rich GUI apps ?
Hi, I am a C/C++ developer of quite a few yesrs, although I am relatively new to Windows (Unix background). I am about to begin work on a project that would require me to develop several GUI rich frontend applications. I would like to hear from developers ou there if there is a book they would recommend, to help me hit the ground running - i.e. a book that is NOT an introductory text on programming/C++ but rather one that dives straight in and shows how to create front ends (possibly widgets etc) - using the VC IDE, one that covers all I need to know about MFC to start working on a re...

access 2003
I have 8 pages i need to link together to save data what is the best way to link them? tlenney, We can't see your *pages* or your tables so asking what is the best way to link will not yield you answers without a wee bit more information. By *pages* do you mean tabs or forms? What are your tables and how are they related to each other? Why would you need to link the data in order to save it? Or are you linking to an outside data source and you are trying to save that data within the database? -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been ...

Denied file access
When I attempt to open my money program, I get a message that says, There is a problem with your Windows security settings. I use Windows 98 and Money 2000. ...

C#, .net 3.5sp1 and Visual Studio 2008 sp1 errors list
What kind of errors will the errors list show when using C# 3.5sp1 with Visual Studio 2008sp1? "Andy B." <a_borka@sbcglobal.net> wrote in message news:%23tmIzu4vKHA.404@TK2MSFTNGP02.phx.gbl... > What kind of errors will the errors list show when using C# 3.5sp1 with > Visual Studio 2008sp1? e Why would you expect any? On the face of it vs 2008 sp1 will target .Net framework 3.5 sp1 by default. Andy B. wrote: > What kind of errors will the errors list show when using C# 3.5sp1 with > Visual Studio 2008sp1? That all depends on what ki...

Auditing Mailbox item access
Don't ask me why I am asking, you don't want to know....but Is it possible to monitor and log access not only to a mailbox, but actually to individual items within the mailbox and be able to trace it back to the specific item and user who accessed it? I am aware of the ability to log when a non-primary account logs into a mailbox, but that is not granular enough for the scenario I need to look into. The powers that be want to be able to see not only who accessed a particular mailbox, but actually who accessed a particular message within that mailbox. Just wanted to know if...

Access 97 conversion to 2000 and OpenRecordSet
We have a simple application developed in Acees 95 / upgraded to 97 and now we wish to move to 2000. the application 'almost' upgrades itself apart from a problem we are havinng with OpenRecordSet . The code is simple and I know (with hindsight) it can be much neater but when you do not spend a great deal of time and it works then leave alone. Code throws up Run Time eror 13 at the OpenRecordset command when run. Have read lots of docs but confused as to change this seems a major problem. Have checked DAO 3.6 to get round other problems and they seem to work. Help appreciated Pub...

Program trying to access Contacts
I did a clean install of WinXP and OfficeXP. I use Incredimail for Outlook and Spam Daemon for Outlook and have never had a problem with them. I also did an Office Update this morning. Now whenever I click "new" message, I got a window that says "a program is trying to access the contacts folder" and suggests it may be a virus and gives me an option to permit access but only for 1 to 5 minutes, as a select. What is causing this problem and how do I get rid of it? [I have Norton AV and Zonealarm installed, and they have never caused this problem.] Arthur Broadh...

ACCESS 2000 is deleting records
Just yesterday I converted an Access 97 database to Access 2000. Have a large problem I need help with. After converting the DB I "split it" in order to use it as a backend, same way it was in Access97. After converting the database to Access2k we began to have a problem with Access2k deleting records. it deleted a total of 4 out of 62 records. the records are not together ( record #289365 then 289048 then 289128 then 289178 then this morning 289405) these record are auto-numbered incerement of one. They were entered by different people so I know its not just an operator probl...

OE removed access to unsafe attachments #2
How do I tell Outlook Express to consider some attachments safe and let me open them? Anyone know? Tools-> Options-> tab Security-> uncheck Do not allow... Note that this is an Microsoft Office Outlook forum. Outlook Express is family of Internet Explorer and Outlook of the Office family. Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -- Roady [MVP] www.sparnaaij.net Microsoft Office and Microsoft Office related News Also Outlook FAQ, How To's, Downloads and more... Tip of the month: -Create your o...

How to know which mfc.dlls are needed to run my app
When I build a .exe using MFC, it won't run unless it can access the proper .dlls (mfc32d.dll, etc.). How can I find which .dlls I need to include when I want to install my software on another computer? First of all, if your application is complaining about a missing mfc DLL that has a "d" on the end of the name then you need to rebuild your application using the Release build. The debug DLLs are not, nor should they be, redistributable. Next, you can run the depends.exe utility to identify what DLLs your application requires. It will show you ALL the DLLs that are needed to...

Outlook Web Access #34
I have a problem reading mails from Russia usig OWA ? (it is all a lot of ?????? and maybe numbers). If I use a normal Outlook client there are no problems ? I have triet different regional settings but no luck ? Try posting this in an Exchange news group as OWA is a function of Exchange, not Outlook. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Lost asked: | I h...

Rich Text formatting in Access 2007
In Access 2007, is it possible to add rich text formatting to text in a memo field (or mixed formatting within any text field). I have just upgraded to the new version of Access, and it appears that this feature still has not been added. Is this correct? (If so, why?) If it is not possible to format individual words within a field in Access, , is there a simple, free add-in that will enable Access to do this kind of basic formatting, such as adding italic, bold, and underlining? Thanks very much for any information you may have. Bob Rich Text format for Memos in: Tables - Look in t...

BACKING UP ACCESS DATABASE 10-31-07
I'd like to backup my Access database automatically (no user intervention needed) to an external drive. Does Access allow such a backup while the database is "open" ? If I have to log out of Access, it defeats my purpose of wanting to do the backup without user intervention. There appear to be a number of drives and SW available to do the backup, but the question is whether Access will allow it. Basically I'd like to backup to the external drive every time a record is changed. I'm worried about losing my database if the PC crashes. If your database is that mission...

VBA Help in Access 2007
When looking through the Help engine, either local or online, I get blank pages when I look at many detail pages in the Help file. For example, when looking at most all web pages in ADO (Section I: ActiveX Data Objects (ADO), there's one title line and no detail. Is that planned behavior (no data) or is there some setting or site to find information? I'm specifically looking for handling records in a table (read, process, summarize). Thanks Terryomsn =?Utf-8?B?VGVycnk=?= <Terry@discussions.microsoft.com> wrote in news:04199121-0746-4A15-B201-03F13827D29C@microso...

CRM data access from external website
Hi All, I have a fully working CRM 3.0 solution on a dedicated server on my internal network. This server is also running SQL 2005 I have an externally hosted website on a Windows 2003 Server, located on the internet. I would like to be able to let some of my customers access to certain parts of my CRM solution, so that they can see the status of an order. I have developed a website on the external server that uses ASP.NET linked to my Internal SQL server and allows ASP registered users access to certain pages. On these pages I would like to use a table that shows the information that...

Serial Driver Code in C++
I am trying to send a string over serial RS-232 to another computer and wanted to use VC++. Is there some sample code/template I could follow ? It is not very complicated... just somethign that opens the port and writes into it.... and closes the port. Thanks -k On Wed, 13 Aug 2003 21:16:46 -0700, "KP" <drkcp@yahoo.com> wrote: >I am trying to send a string over serial RS-232 to another >computer and >wanted to use VC++. Is there some sample code/template I >could follow ? > >It is not very complicated... just somethign that opens >the port and ...

OUTLOOK WEB ACCESS #17
I recently applied the most current patches and fixes to my Exchange 2000 server. Since then, some of the users are getting attachments in only HTML format when accessing the server from off site through OUTLOOK WEB ACCESS. They need to be able to open them in word or at least notepad. What made the change and how do I get it back? ...

Cannot access user's mailbox
I disabled the active directory account of a user who recently left the company (I'll call her Cammi), after setting up forwarding of all her mail to her replacement (I'll call her Nala). Nala recently requested access to older items in Cammi's mailbox, but after reenabling Cammi's account all my attempts to access her mailbox still failed, whether thru exmerge, OWA, or Outlook. I was called away, and when I came back roughly 30 minutes later, I was able to access her mailbox with no further problems. I have two questions about this: 1) Is there some kind of refresh...

Cannot access help and support in Vista
'When I clikck on help and support I get an error message that says help and support was not able to start' Any suggestions please? -- AuntDi Not sure about Vista but I used a script file that fixed this in my XP pro. If you want to try it do a search for fixwinxphelp.vbs Hopefully you can find it, since I don't remember where I downloaded it. Good luck. AuntDi1947 wrote: > 'When I clikck on help and support I get an error message that says help and > support was not able to start' Any suggestions please? And what was the name of THIS news...

Use an Access form in Excel
Hello, I have a form used in Access which interfaces with a serial device (A coin counter). Basic functionality is control of start / stop of counter, and accept the count into a data field. I have been asked if this can be used within Excel, in a similar fashion. I don't use Excel a lot, and certainly not from a programming point of view. Any advice / links / comments would be appreciated. I need to research and struggling finding relevent information, including if possible at all? Thanks in advance swas Forms in Excel are very different than forms in Access...