|
It depends.
IMHO, it would be much better to hold your CDatabase and CRecordset objects together in the CDocument-derived class of yours because they are essentially serving the same purpose - to link your views to data. However, if recordset objects are subject to heavy dynamic user-invoked changes, I'd normally prefer to associate them with views.
That's what I think, although it's so much more a matter of preference than of being right or wrong...
|
|
|
|
|
Thanks,
Does it matter where those recordset objects get instantiated with the new keyword (CDatabase or CFormView)?
|
|
|
|
|
Yes, it does matter for me. I'd create them immediately where they are used, but also exactly where "main" pointers to them are stored (i.e. those pointers you use to delete recordsets; it's important as this must be done only once and preferably in a function called from the destructor of your CDatabase or CFormView object).
The worst thing to do IMHO is to split the code that works with these recordset objects into several parts based in different classes. Chances are all hell will break loose upon you when:
a) execution flow comes to destruction and oops you overlook a leak or delete objects twice or whatever else...
b) the program swells in size and soon you are no longer able to track down all activities associated with recordsets.
Keep it simple. In the end it's much better to misplace pointers but code consistently keeping in mind this architecture than to make a correct design decision (if there is one) but implement it inconsistently or in a sophisticated manner.
|
|
|
|
|
|
|
what language is that ?
obviously not C++ !!
|
|
|
|
|
Giorgi Moniava wrote: 1) Register an extension for my application on the system where it will be installed.
See here (second response).
Giorgi Moniava wrote: 3) When the user opens the file with the abovementioned extension I want that my program was launched.
This is the same as #1, and should happen automatically.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
In a MFC dialog based programm, I add a button control, and the corresponding message function is:
void CHhhhDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CClientDC clientDC(this);
CDC memDC;
memDC.CreateCompatibleDC(&clientDC);
CRect rcClient;
GetClientRect(&rcClient);
CBitmap membitmap;
membitmap.CreateCompatibleBitmap(&clientDC, rcClient.Width(),
rcClient.Height());
memDC.SelectObject(&membitmap);
for (int x = 0; x < rcClient.right; x ++)
{
for (int y = 0; y < rcClient.bottom; y ++)
{
memDC.SetPixel(x, y, x < y ? RGB(255, 255, 0) : RGB(255, 0, 0));
}
}
clientDC.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), &memDC, 0, 0, SRCCOPY);
}
Now, I want to comments the last statement, and save the memeory bitmap (memDC) to a BMP file.
How can I achieve this objective.
Thanks!
|
|
|
|
|
if you want to save bmp file use CImage::Save
-- modified at 8:40 Wednesday 15th March, 2006
|
|
|
|
|
FleetAdmiral wrote: How can I achieve this objective.
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi all,
i have been working on incorporating crystal reports into an mfc application. I am able to call the RunReportWizard method in the following way.
/////
m_Application->RunReportWizard(m_Report," ");
//where m_Report is IReportPtr and m_Application is IApplicationPtr.
Its working. but is it the correct way of calling. The second parameter in which i am passing an empty string must specify the datasource. Can anyone also please tell me how can i pass only a certain type of data connection to this method. the wizard shows all the available connections.
Please help.
|
|
|
|
|
HI all
I have an application which uses a Filetransfer module (.tli file is involved while i debug) .
And a function raw_SendFile fails with return value of 0x80004005 (E_FAIL) when it tries to send a file.
To give more info : This function is called N times to send N files , and it properly sends say 10 files . And exacltly when it sends the 11th file named ramdisk\rd.gz it fails . And everytime this is reproducible and exacltly at this file , this function fails .
And my search in MSDN about E_FAIL says "Unspecified error" . What is this unspecified error ?
How can I solve it ?
Can anyone please help me ????
redindian
|
|
|
|
|
Generally, this a sign of poor implementation of the component. Any developer that returns E_FAIL instead of an appropriate error code should be shot...! Not that E_FAIL does not have its uses - it does, but clearly not here.
I would be looking into what might be special about that 11th file - is it on a different device, is it locked, etc.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi James
Thanks .
Well I would like to add more points to you .
The files are taken from a delivery folder in a server, say A .
The application that tries to send these files are in system , say B.
And the destination is also a server ,say C, in a remote location , to which B connects via modem direct .
So when B tries to send the files from A to C this error occurs .
And one interesting thing is -> B is a linux call server which is called a PABX in telecom .
Could you please clarify the points ?
a) How will you check whether the file(s) is locked or not ?
b) Will ethreal traces be helpful ?
Thanks in advance
redindian
|
|
|
|
|
Hi James
Sorry I typed wrong ...
Server C is the callserver .
System B is XP
Server A is sun machine (A is not involved in this problem)
regards
redindian
|
|
|
|
|
Hi again
I hava another question for you but this i time i'm completly lost.
I need to connect to a database in order for retriving and storing.
I've never done something simmilar before so i have no idea.
i prefer to use mysql database.
i've read something about odbc and thats what i'm willing to use(if u have other suggestions pls tell me)
Any way can anybody tell me what i need to include
and what are the first steps of the code to connect to the database(is it possible to avoid wizards).
Also do u have any good reference on this matter which i can read to get a good understanding of how odbc works.
Thanks in advance
|
|
|
|
|
Here is a semi-relevant article.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
Hi All,
has anybody used the Local Security Authority API's.
basically i need to Grant Network logon rights to a particular user.
if u have any sample code or have any information regarding this please let me know.
Thanks
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmgmt/security/opening_a_policy_object_handle.asp
maybe it is some helpful to you
|
|
|
|
|
|
Hi!!
I have a problem and I'm not founding the solution..
I send a fax via Office Outlook from a vc++ program.
My problem is that if I send it with a profile that hasn't got the coversheet, outlook puts however a white page before my fax only with the line "Subject:...".
I think that I ought to set a mapi property, but I have no idea of what!!
thank you
martina
|
|
|
|
|
I would expect that if I use:
CClientDC dc(this);
inside the code for a dialog box it would pick up the font used for that dialog box. In fact, it doesn't. I had to add:
currFont.CreatePointFont(80, "MS Sans Serif", &dc);
oldFont = dc.SelectObject(&currFont);
and then it measured the text extent correctly. (I got the font name and size from the dialog template.)
Clearly, it won't change unless I change it in the project, but I am curious to know how to pick up the information "automatically".
Any suggestions? Thanks,
Ilan
|
|
|
|
|
|
Thanks. I didn't think it was that simple.
It must be internally this.GetFont(), otherwise I don't know how it could figure out which font I want.
In any case, it works....
Ilan
|
|
|
|