|
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;
|
|
|
|
|
The caller of the GetText function is required to delete the return value. It may also check the return value for NULL in the case of an error condition.
Style note: The "(long) " cast in the "SendMessage(SCI_GETTEXT, lLen, (long)pReturn); " call is A Bad Idea. It should actually be an "(LPARAM) " cast.
Software Zen: delete this;
|
|
|
|
|
I have 2 remarks for you.
first of all, you seem to program in C++ (because of the namespace your function is placed on), so, why do you bother using C-Style Strings like this ? can't you use the CString class, or std::string if you can't use MFC ?
the second point i notice is that your functions tells that is returns a LPSTR (char* string), but you actually construct and return a TCHAR* string, which should be declared as LPTSTR.
if the caller is not intended to modify the string returned, it should even be declared LPCTSTR (C for const).
but still I maintain that string classes should be used instead
|
|
|
|
|
Of course, as stated in other answers, the caller has first to check the returned value.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I just writing the simple twenty one card game...now evth work and fine.
And I put cards from 2 to A with concerning value.But when the debug step coming '0'comes to input with value '10'(K is worth 10 etc). It make me so confused.
here is my code:
[pre]#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
struct
{
char face;
unsigned int value;
}
card[13] =
{ {'2', 2},{'2', 3},{'2', 4},
{'5', 5},{'6', 6},{'7', 7},
{'8', 8},{'9', 9},{'10', 10},
{'J', 10},{'Q', 10},{'K', 10},
{'A', 1}
};
int main()
{
cout<<"simple twenty one card"<<endl;
cout<<"------------------------"<<endl;
int compcard=3,compscore=0,urscore=0,draw=0,urcard=0;
char cond;
const int high=21;
//int ur;
do
{
int comptotal=0,urtotal=0;
//srand(time(NULL));
srand((unsigned)time(0));
cout<<"how many cards u want?(up to 5 cards)"<<endl;
cin>>urcard;
if (urcard>5)
cout<<"You could not get more than five cards!"<<endl;
else
{
cout<<endl<<"Ur cards..."<<endl;
for (int ucard=0;ucard<urcard;ucard++)
{
int x = rand() % 13;
printf(" |%c| ", card[x].face);
urtotal+=card[x].value;
if(urtotal>42)
{
urtotal=urtotal-30;
}
else if(urtotal>31&&urtotal<42)
{
urtotal=urtotal-20;
}
else if(urtotal>21&&urtotal<32)
{
urtotal=urtotal-10;
}
}
cout<<endl;
cout<<"My cards..."<<endl;
for (int Ccard=0;Ccard<compcard;Ccard++)
{
int x = rand() % 13;
printf(" |%c| ", card[x].face);
comptotal+=card[x].value;
if(comptotal>42)
{
comptotal=comptotal-30;
}
else if(comptotal>31&&comptotal<42)
{
comptotal=comptotal-20;
}
else if(comptotal>21&&comptotal<32)
{
comptotal=comptotal-10;
}
}
cout<<endl;
cout<<"I have "<<comptotal<<" and you have "<<urtotal<<" so ";
if(comptotal<=high&& urtotal<comptotal)
{
cout <<"I win "<<endl;
compscore++;
}
else if(comptotal<=high&& urtotal>high)
{
cout <<"I win "<<endl;
compscore++;
}
else if (urtotal<=high&& urtotal>comptotal)
{cout<<" you win"<<endl;
urscore++;
}
else if (urtotal<=high&& comptotal>high)
{cout<<" you win"<<endl;
urscore++;
}
else //(comptotal==urtotal)
{cout<<"no win"<<endl;
draw++;
}
}
cout<<"wana play again(n/y?)"<<endl;
cin>>cond;
}while(cond=='y');
cout<<"I win : "<<compscore<<endl;
cout<<"you win : "<<urscore<<endl;
cout<<"we draw : "<<draw<<endl;
cout<<endl;
//cin>>ur;
}[/pre]
example of output is like " |4||J||0||k||8|".
I dont want to include "0" . How can I do? Pls tell me.
Thanks in advance!
|
|
|
|
|
why do you use [pre][/pre] instead of <pre></pre> ?
please edit your message, for everyone can read your question clearly.
|
|
|
|