|
You got the help already.
1. Pass the database objects as pointers (or references) to the dialog and do the DB work directly inside dialog.
2. Use a messaging mechanism (not especially Windows messages, although could work too) to signal back from dialog to the object that contain your variable m_pRecSet to "do the DB work".
3. Use a separate class that does the DB work, declared by the application object, main window object or where you see this fit, and use a messaging mechanism back and forth to/from this object to any object that require "DB services".
Whenever a DB operation needs to be performed, you must have the means to retrieve and use the DB object, either directly (1), via accesors of other objects (2), or using a convenient object that encapsulates the DB services (3). The solution is up to you, as well as what kind of services can be performed - direct brute queries formatted elsewhere, or using more specialized business logic oriented derived classes.
I suggest you to implement a hierarchy like:
Connection
Statement
StatementWithResults
Recordset
StoredProcedure
...
(whatever you like)
as well as your business objects which can derive from StatementWithResults (1 row in a table) or Recordset for collections.
|
|
|
|
|
hi all,
i am trying to develop a program that requires sending some small mails to some mail-ids, I tried with the code supplied by Nishanth Sivakumar: http://www.codeproject.com/tips/CSMTPConnection2.asp
I am using Visual studio 6.0, and it is not detecting the atlsmtpconnection.h header file. Is this header available in Visual studio-6.0, if yes what setting should I change to get it compiled
Thanx in advance,
SYAMLAL
|
|
|
|
|
SyamlalS wrote: I am using Visual studio 6.0
Read the article you linked to. It specifically says you need VC7 or above.
In the meantime you can use this[^] class in VC6 or even use the Simple MAPI[^] functions.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
thank u PJ Arends
SYAMLAL
|
|
|
|
|
|
thank u WhiteSky.
SYAMLAL
|
|
|
|
|
e.g like
GetSubItemRect in mfc , is there any function to fetch the particular RECT from the subitem column and we can display the progress bar in the listview.
amit
|
|
|
|
|
You should be able to calculate it with some combination of
LVM_GETITEMRECT
LVM_GETITEMSPACING
LVM_GETCOLUMN/LVM_GETCOLUMNWIDTH
|
|
|
|
|
Can any one elaborate with example?
basically i did but it shows only one progress bar and it is in the disable form
when i put other item in the list view ,it should be created with new,but it hasn't and other thing when i select it entire row it goes behind the selection, i have some demo but it is in mfc and vc++.
if is there any link or example or demo ?
please guide me.
thank you
amit
|
|
|
|
|
Hi all. Is there a way to prevent ofstream from writing the same line if it already exisits? If so please let me know because i wrote a function that loops the time/date but it keeps on showing the same time/date. Thanx in advance!
Before anyone asks. My code below.
<br />
#include <time.h><br />
#include <windows.h><br />
#include <fstream><br />
using namespace std;<br />
<br />
int main (){<br />
while(1){<br />
Sleep(300);<br />
char date [9];<br />
char time [9];<br />
_strdate(date);<br />
_strtime(time);<br />
ofstream file1;<br />
file1.open("time.txt",ios::app);<br />
file1 << "[Date]: " << date << endl;<br />
file1 << "[Time]: " << time << endl;<br />
file1.close();<br />
}<br />
return 0;<br />
}<br />
Note: the idea is to update when the time changes, not to write the same time over and over until it changes, then write that over and over etc etc.
|
|
|
|
|
int main()
{
char prev_date[9],curr_date[9];
char prev_time[9],curr_time[9];
strcpy(prev_date,"");
strcpy(prev_time,"");
for (;;) {
_strdate(curr_date);
_strtime(curr_time);
if (strcmp(prev_date,curr_date) ||
strcmp(prev_time,curr_time)) {
ofstream file1;
file1.open("time.txt",ios::app);
file1 << "[Date]: " << curr_date << endl;
file1 << "[Time]: " << curr_time << endl;
file1.close();
strcpy(prev_date,curr_date);
strcpy(prev_time,curr_time);
}
}
}
Software Zen: delete this;
|
|
|
|
|
Thanx for your reply, but that function does the same thing as my last one. Printing over and over. Any other suggestions?
|
|
|
|
|
when the criteria for the where condition in a database query that i pumped in through
m_pSet->Open(...,QUERY,...);
and if no records match the criteria i'm gettin an error as
Atttempt to scroll past end or before beginning of data
in a dialog popped up.
What can be the reason.
the code is a follows.
<font size=2>
query="Select * from Book where Name like '%"+name.Left(5)+"%'";
m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none);
m_pSet->MoveFirst();
do
{
Item.Empty();
name=m_pSet->m_Name;
auth=m_pSet->m_Author;
Item=m_pSet->m_Ac_No+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat);
lb->AddString(Item);
m_pSet->MoveNext();
}while(!m_pSet->IsEOF());
</font>
plz help
Success makes life easier. It doesn't make living easier.
SH UVIK
|
|
|
|
|
All seem to be on VACATION....;)
Well well...Enjoy...Then do reply...
Success makes life easier. It doesn't make living easier.
SH UVIK
|
|
|
|
|
shouvik.d wrote: and if no records match the criteria i'm gettin an error as
Atttempt to scroll past end or before beginning of data
That's because you are calling MoveFirst when there are no records.
|
|
|
|
|
there are 8 records present in the DB already
Success makes life easier. It doesn't make living easier.
SH UVIK
|
|
|
|
|
shouvik.d wrote: there are 8 records present in the DB already
I am not talking about DB, but about the result returned by the query. Get the count of records before moving around in a recordset.
|
|
|
|
|
thanks
prob solved
I instead did this
m_pSet->Close();
query = "Select * from Book where Ac_no = '"+accnum+"'";
m_pSet->Open(CRecordset::dynaset, (LPCTSTR)query,CRecordset::none);
if(m_pSet->IsBOF() && m_pSet->IsEOF())
MessageBox("No records meeting the criteria");
else
{
m_pSet->MoveFirst();
do
{
name=m_pSet->m_Name;
auth=m_pSet->m_Author;
Item=accnum+"\t"+name+"\t"+auth+"\t"+CLibManView::GetStatus(m_pSet->m_Stat);
lb->AddString(Item);
m_pSet->MoveNext();
}while(!m_pSet->IsEOF());
}
Success makes life easier. It doesn't make living easier.
SH UVIK
|
|
|
|
|
Yeah. Always check status of db query results before using them.
|
|
|
|
|
plz can u reply to the prev page post titled
Data Exchange
Plz
Man can acquire accomplishments or he can become an animal, whichever he wants. God makes the animals, man makes himself.
G. C. Lichtenberg (1742-99), German physicist, philosopher.
SH UVIK
|
|
|
|
|
Friends,
I want to implement some file compression/decompression feature in my application. There is lot of code available here to zip the file and then unzip it. In my experience rar provides more compression than zip. But i am unable to find code that compresses file in rar form and then back to original form. Can anyone tell me where i can find such library ?
Imtiaz
|
|
|
|
|
I couldnt add more to the post, it kept giving me errors so I attached the link to this one and a continuation of the post.
http://www.codeproject.com/script/comments/forums.asp?msg=1823085&forumid=1647&XtraIDs=1647&sd=2+Oct+2006&ed=31+Dec+2006&author=godspeed123&stype=1#xx1823085xx[^]
I dont get it, I will fool around with it a little more.
I was looking at the code and there is another class associated to each filter a CSourceStream. After looking at the documentation this class is used to tell the next filter what data to expect. Do I have this right?
So when we get through this other problem abover, how do I pass the height and width, and size, etc of pictures in memory, do I use the similar approach of COM in this filter or is there another way. Cause it seems that in the examples they all populate the values all in the constructors. Is there a way to set this up in code, before I begin to pass data into the filter.
So would I do the following:
1.) CoCreate
2.) Instatiate a COM Class for the CSourceStream Overriden class
3.) Pass all the data in
4.) Then the GetMediaType gets called,
Or am I going about this the wrong way.
Cause I am not sure when the GetMediaType is called. Cause if it is called when the CoCreate hits then this wont work.
Thanks for all the help again
|
|
|
|
|
CSourceStream is the output pin for the source filter.
GetMediaType won't get called until you render the graph - when the pins connect.
You can initialize anything needed after the CoCreateInstance and before the pins connect.
I still can't get your code to work but I made a new stripped-down filter that works.
I'll send it to you if you'd like - shoot me an email.
The only thing I saw in your code was COM not initialized on the app thread but that didn't fix it
Mark
|
|
|
|
|
I guess so, but I would like to be sure of that:
LPSTR CTamScintillaCtrl::GetText ()
{
long lLen = SendMessage(SCI_GETLENGTH, 0, 0) + 1;
if (lLen > 0)
{
TCHAR *pReturn = new TCHAR[lLen];
if (pReturn != NULL)
{
*pReturn = '\0';
SendMessage(SCI_GETTEXT, lLen, (long)pReturn);
return pReturn;
}
}
return NULL;
}
Thank you.
|
|
|
|
|
The caller of the GetText function is required to delete the return value. They can also check the return value for NULL as an error condition.
Style note: The "(long) " cast on the "SendMessage(SCI_GETTEXT, lLen, (long)pReturn); " is A Bad Idea. It should be a "(LPARAM) " cast instead.
Software Zen: delete this;
|
|
|
|