|
I ran into a number of cards that had bad drivers back in the day.
The issue was in persistent connections. There were protocol stack bugs.
You wouldn't see it on web servers, especially then, because connections aren't persistent.
I still use ODBC. It's not dead. The OleDB layer rests on top of it.
|
|
|
|
|
I thought it was the other way around. I don't remember anymore, last week was the first time in 5 years that I investigated it again. I'll look into ODBC again later in the month, but if the SQLCLIN10 works out for me, then I'll just stick with it. I kind of like it, It's an eye opener into how the whole process works.
|
|
|
|
|
I just read an article where Microsoft has announced the end of oledb, and will support ODBC only in future releases of SQL Server starting with 2012. I remember when they announced the end of Visual Basic to.
So I better start looking for ODBC examples, and perhaps rewrite my stuff.
|
|
|
|
|
I have a program that allows me to do some processing from menu resource in my program and I would like to access it from a dialog box. Currently, the member function autoplane() is defined in my WinSTMView class and I would like to member function to be accessed in ScanAcq Class. I tried to accomplish this by doing the following:
void CDlg_ScanAcq::OnBnClickedScanProcess()
{
OnPlaceData();
CWinSTMView *pView;
pView->OnImageAutoPlane();
}
Any suggestions on what I am doing wrong? I have tried to load the all the correct header files.
[modified]
This is repeated in the comments, but it will also help to give more information about what I am trying to solve...so I will paste it here as well.
The comment, "This part doesn't work", was meant to direct the attention away from the first call to OnPlaceData() to the lines of code that were causing problems. All I want to happen is for the Autoplane() member that is defined in the view part of the MDI (I think there are three parts in MDI, the view, the doc, and the app) to be successfully called from a button I placed on a different dialog box. To do this I tried to create an pointer of the view class type and call the member. It compiles fine, but in runtime the program crashes.
[/modified]
modified 30-Nov-11 14:24pm.
|
|
|
|
|
You can't just declare a pointer to <code>CWinSTMView</code> and then call a method on it. Either use <code>new</code> or just declare the class: <code>CWinSTMView View</code> then call <code>View.OnImageAutoPlate()</code>
|
|
|
|
|
My pointer to nothing doesn't work...
|
|
|
|
|
I tried what you suggested, but I get the error message that CWinSTMView::CWinSTMView() is inaccessible.
|
|
|
|
|
When do you get this error? Is the constructor of this view public?
|
|
|
|
|
No, the constructor is not public. It is protected and I was unsure if just changing it to public was the best way to solve the problem. So, I thought I would ask if it was good programming practice in my efforts to understand MFC programming.
|
|
|
|
|
If it's protected, it's probably not meant to be accessed that way... see my other post. Usually multi-view documents in MFC have to be initialized through MFC methods/macros.
|
|
|
|
|
By the way, if the view already exists, trying to do what Jonathan suggests isn't the proper thing to do... if it exists, then you need to either use the framework to pass the message to the view or get a hold of the pointer to the view itself and do a SendMessage() to it.
|
|
|
|
|
AndrewG1231 wrote:
What does that mean? We cannot see your PC screen so have no idea i) what is supposed to happen, or ii) what actually happens.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I'm sorry about being vague...I am really trying my best with all my posts to be as descriptive as possible, but based on the responses I must continue to improve in this aspect. The comment was meant to direct the attention away from the first call to OnPlaceData() to the lines of code that was causing problems. All I wanted to happen is for the Autoplane() member that is defined in the view part of the MDI (I think there are three parts in MDI, the view, the doc, and the app) to be successfully called from a button I placed on a different dialog box. To do this I tried to create an pointer of the view class type and call the member. It compiles fine, but in runtime the program crashes.
|
|
|
|
|
AndrewG1231 wrote: It compiles fine, but in runtime the program crashes.
Because you create the variable but never initialise it:
CWinSTMView *pView; pView->OnImageAutoPlane();
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
These two statements don't do what you expect
CWinSTMView *pView;
pView->OnImageAutoPlane();
All it does is declare that pView is a pointer to "something" but you don't actually initialize it to point to anything. Then you try to use it.
I assume that the CWinSTMView object was instantiated somewhere else and you are trying to access it. You need to find that object and initialize pView to point to it. How you find that object is your problem as the amount of code posted is not enough for me to guess at it.
|
|
|
|
|
Thanks, I will look for where it is instantiated
|
|
|
|
|
Have you tried something like:
AfxGetApp()->GetMainWnd()->GetActiveView()->OnImageAutoPlane();
AfxGetMainWnd()->GetActiveView()->OnImageAutoPlane();
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I have not, but when I use your suggestion:
class "Cwnd" has no member "GetActiveView"
|
|
|
|
|
Which is why I added the "casting not provided" comment. As I don't know the name of your frame/doc/view classes, you'll need to cast some of those function calls to your specific situation.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I was able to solve the problem after I did some research on the MSDN site about the suggestions of sending messages and GetActiveView(). :
OnPlaceData();
CMDIFrameWnd *pFrame =
(CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild =
(CMDIChildWnd *) pFrame->GetActiveFrame();
CWinSTMView *pView = (CWinSTMView *) pChild->GetActiveView();
pView->OnImageAutoPlane(); Now my pointer points to something and I was able to access that member (and others that I wanted to use as well). Thanks for the help!
|
|
|
|
|
Before you get too far into finding view pointers and accessing them directly....
This is not a good practice in MDI Programming. The framework supports multiple view types for every document. So the Active View, in theory could return a different class type than you expect. Obviously if you don't have other view types explicitly written then this won't happen... There are also cases where you'll see no Active View, even though from the user's perspective it looks like there is one.
The better solution is to get a pointer to your CDocument instantiation and call a notification method there, instead of your view. I good way to do this is to pass the doc pointer to the dialog when you create the dialog. I like to pass the doc * in the constructor.
Then in the doc, have the notification method, call UpdateAllViews() with a hint as to what data has been changed, and let the view respond to this message.
|
|
|
|
|
Thanks, the code works to modify data in the same window when I have only one active child window...but I have been running into problem when the data is saved to a new document and displayed in a second child window. I was working with the view pointers to try and cycle through child windows, but your method seems interesting. The member I am calling, Autoplane(), creates another document already as shown here:
void CWinSTMView::OnImageAutoPlane()
{
CWinSTMDoc *pDoc = CreateNewDoc(GetDocument()); Can I use this doc pointer as you described?
|
|
|
|
|
Is it your goal to have two view windows?
The MDI Framework doesn't lend itself well, to creating new documents from user code.
It's easier to add and create additional views.
The way the framework is intended to be used:
1. The document holds your data and resources.
2. The views are intended to be presentation classes that provide a view of the data to the users.
This is why we have a one to many relationship between documents and views.
|
|
|
|
|
|
how to use system API for given time
some times a when i call system api, my computer hangs and i need to reboot
can i use for given time
|
|
|
|