|
Use GetParentFrame() .
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hi,
I'm using VS .NET 2003 and CR 8.5 ...
My project type is MFC Dialog-based program and i should display a ADO Recordset query result in viewer activex ...
It's what i've done:
1- I made the Report with Crystal Report 8.5 and with connecting to .mdb database via OLEDB connection ... (it's ok)
2- Then i insert the Viewer Control in my project and also made the ado recordset object with a simple query like this: "select * from some_table where code=1"
3- i wrote below code:
m_RptApp.CreateInstance( "CrystalRuntime.Application" );<br />
m_RptReportInfo = m_RptApp->OpenReport( _bstr_t(_T("rpt\\CompanyInfo_FA.rpt")) );<br />
Line1: m_RptReportInfo->Database->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) );<br />
m_ReportViewer.put_ReportSource( m_RptReportInfo );<br />
m_ReportViewer.ViewReport();
I tried this code for Line1 too:
m_RptReportInfo->Database->Tables->GetItem( 1 )->SetDataSource( _variant_t( (IDispatch *)m_pRec, true ) );
The Problem:
the problem is the program shows ALL records ... and NOT the filtered recs !!
1- Can u tell me what's wrong with my code ?!
2- ( ADO Question ):
say i have two _RecordsetPtr objects ..
for example: _Rec1, _Rec2 ..
_Recs1 fills by some records (by Open() mehod)
Is there anyway to copy some records from _Rec1 to _Rec2 ?!
for example i want to copy Record (pos) number 3, 10, 16 to _Rec2
( sorry for my english .. )
Regards,
Hadi
|
|
|
|
|
YEP !!!
SOLVED !
|
|
|
|
|
I have a dialog box with id IDD_AGREE_FRAME_ABSTRACTION . This class's all cotrols are populated from the view class using one LoadDetails() function which is implemented inside the dialog class. I have added an edit box to this dialog. But when ever i am creating any variable of type:
1. CString and attaching it to the editbox through class wizard/manually. It's giving me a message "An unsupported operation was attempted". When i click that msg box the application is getting crashed.
2. CEdit then i am getting the message and the application is crashing.
When i am debugging the application the message box is coming in the DoDataExchange i for that particular entry for that editbox control.
I deleted the entry in the DoDataExchange for the control and just tried to set a its text by using GetDldItem(IDC_EDIT_BLDG_AGE)->SetWindowText("biswa") but again the application is crashing.
For all the cases when its crashing it's giving the error as "Unhandled exception in the app.exe(MFC42D.DLL):0x0000005: Access Violation."
I am really surprised why this is happening for this dialog where as for other dialog there is no problem when i do the same. Also when i am removing the the DDX_Text entry for the control causing the problem the whole application is running fine.
Please help me on this. This is really important for me. If you need any more information then just tell me i can give you the detail history for this.
|
|
|
|
|
|
When the dialog is created in the view class it calls the DoDataExchange function and when it excutes the line
DDX_Text(pDX,IDC_EDIT_BUILDING_AGE,m_BuildingAge) it crashes and when i remove the entry it works fine. Also as i said when directly try to access by it using GetDlgItem then also it crashes.
One more thing i want to say this class was not visible when opened the class wizard. So i deleted the .clw file and agained opened it. That class was then visible but when i selected that i got parsing error for one of entries of DoDataExchange function that is DDX_Dollar(.....). That is why i added entry for this control manually.
|
|
|
|
|
just try the follow this may be reason....
in resourse.h
IDC_EDIT_BUILDING_AGE is defined right. it has some value say 1234
check there should not any other defined with the same value 1234.
just check it. as a one of the reasons.
Regards
Anil
|
|
|
|
|
When does LoadDetails() get called?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
The LoadDetail() is called in the OnUpdate() of the view class.
|
|
|
|
|
BiswaR wrote:
The LoadDetail() is called in the OnUpdate() of the view class.
Before or after the dialog's DoModal() method is called?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hi!
Does somebody know, how to to open notepad.exe?
In the opened notepad's page, the user should be able to write, save and close the file.
Would be great, if somebody could help me with this problem.
|
|
|
|
|
|
Hi!
Thanks, that was a big help.
Maybe you can tell me, too, how to insert text of a CString-object in the already opened notepad-File? Or do I have to do this at the same time and if yes: how?
With best regards,
Hanno
|
|
|
|
|
I don't know if this is possible. However, what you could to is first, save your text into a text file, then open this file in notepad with ShellExecute.
But, why exactly do you want to have such a thing ? Maybe there is another solution that is better.
|
|
|
|
|
I want to have such a thing, because there are points to display on a window. There is a function, responsible for displaying the points. Of course, the function needs coordinates.
First of all, this function gets the point names from the calling program.
THen, the function is looking for fitting coordinates, which should be in a already existing text-file. But it can happen, that the coordinate-file will be empty. Then, the function has to open a notepad-file, where the point-names should be already inserted. The user has to write down the missing coordinates for the point-names.
That's the way. Maybe you have a better idea to do this?
Hanno
|
|
|
|
|
Err...
Honnestly, I don't think notepad is the right tool for doing that. Why don't you simply ask for this data in a program of your own (either a separate or even in your existing application) ? Then save the data in a file and its done. Why do you want to use notepad for that ?
|
|
|
|
|
Cedric Moonen wrote: Honnestly, I don't think notepad is the right tool for doing that.
I concur. It's the old square-peg-in-a-round-hole paradigm.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
But it works that way. It is not my idea to do it this way, maybe that makes you a little bit happier?
Best regards, Hanno
|
|
|
|
|
hanno25 wrote: It is not my idea to do it this way
Let me guess: it's your boss's idea
|
|
|
|
|
you cannot directly interract with the notepad content.
however,you could write your string (CString object content) into a file that you pass to notepad as a command line parameter so that it is opened when notepad is launched.
::ShellExecute(this, "open", "notepad.exe", "myfile", NULL, SW_SHOW);
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Another idea that comes to mind would be to use the Windows clipboard.
What you could do in your program is launch notepad.exe. Your app could place the text content on the clipboard and then send messages to the notepad window to paste the text into it's edit window.
For more info on how to use the Windows clipboard, look up the SetClipboardData function on MSDN and/or take a look at this CodeProject article[^]
It doesn't really make sense as to why you can't just write your data straight out to a text file from within your program.
|
|
|
|
|
Hi.
I am trying to write a database app using the MDI in MFC, and using ADO to access an MS SQL Server, and I want to be able to do some basic word automation with it. It was working fine, until I tried to add the Word automation.
The problem seems to be that many of the classes defined by importing classes via the class wizard, and including the created file, are already defined by using :
#import "C:\\...\\msado15.dl" no_namespace rename("EOF", "EndOfFile")
for ADO. I only want a few classes, but class wizard seems to generate a whole host of wrapper classes, which I assume it needs, and which the compiler then tells me have already been defined (but not where, I note...).
I am also #import ing msword.olb, mso.dll and vbe6ext.dll.
Is there a simpler way to automate word AND use ADO together? Or even a way that works?!?
Thanks.
|
|
|
|
|
Hi
I created a dialog using the resource editor in Visual Studio. Then I gave it to a new class which is inherited from a CDialog class (all done by class wizard). I added some controls and assigned variables to them. All fine. Until I added extra variables from the class tree. I added a private variable of type double, which is quite straight forward. But now, I can't compile my program because it thinks it can't understand the ID of the dialog.
The compiler reports and error on the line in the CDialog class header that says
enum { IDD = IDD_MYDIALOG };
saying that IDD_MYDIALOG is an undeclared identifier.
The only thing I can think of is that something could have gone wrong in VS when it crashed while I was building this dialog the first time. Since, I deleted the dialog and everything to go with it and started again. It went alright until I added the said private variable. Now, even if I delete the variable, it still won't work.
I have no idea what I've done to it. Any help greatly appreciated!
|
|
|
|
|
|
Hi
No, I didn't do
#include "resource.h"
but none of the other dialog classes do, and they work fine.
I think that bit is taken care of by
#include "MyApp.h"
and MyApp has the resource header included in its header.
I did edit the dialog ID in the resource editor, so that I can find the ID in Resource.h. In fact, if I search for the ID, I get 4 hits, twice in MyApp.rc, once in Resource.h and once in MyDialog.h.
I hope you can figure out the problem
|
|
|
|