|
Make copies of ABC.EXE, naming them ABC1.EXE, ABC2.EXE, and ABC3.EXE.
|
|
|
|
|
You can pass a command-line parameter to the app via the CreateProcess call that it can use to set it's main window caption to. Task manager (and the launch bar) will use the main window caption for display.
|
|
|
|
|
Tried setting the title attribute of the STARTUPINFO structure but it didn't help. Task Manager still shows the executable as ABC.exe to continue with my example.
But what i found is that if i specify both the lpApplicationName & lpCommandLine as follows, i can get a behavior close to what i want...
lpApplicationName = ABC.exe [need the .exe even though the doc says it is optional]
lpCommandLine = myABC arg1 arg2... etc
Since argv[0] is interpreted as to mean the app name, by specifying a different name as the first token for the command line i could get the app to use this name instead of the executable name for picking up config & log stuff.
I'm not sure if it is possible to get Task Manager to show a process with a different user-friendly name. Wondering how this is accomplished in the Unix world? [btw, this was an effort to simulate that behavior from the Unix side]
Thanks for the response, anyway
Chen Venkataraman
|
|
|
|
|
It's NOT possible to change the name in Task Manager. You must have some capability in the app that your launching to change the window title from a command line parameter in order to do what you want.
RageInTheMachine9532
|
|
|
|
|
Dear all,
I have two functions:
a) Member* get_member(Book* book);
b)Book* get_book(Member* member);
The implementation code for the function prototypes is:
a)
template<class Book,class Member>
Member* AssociationList<Book,Member>::get_member(Book* book)
{
Member* member=0;
bool searching=true;
int index=0;
while(searching)
{
if (this->association_list[index])
if (this->association_list[index]->linked_book()==book)
{
member=this->association_list[index]->linked_member();
searching=false;
}
else
index++;
else
index++;
if (searching && (index == LIST_SIZE))
{
searching=false;
}
}
return member;
}
b)
template<class Book,class Member>
Book* AssociationList<Book,Member>::get_book(Member* member)
{
Book* book=0;
bool searching=true;
int index=0;
while(searching)
{
if (this->association_list[index])
if (this->association_list[index]->linked_member()==member)
{
book=this->association_list[index]->linked_book();
searching=false;
}
else
index++;
else
index++;
if (searching && (index == LIST_SIZE))
{
searching = false;
}
}
return book;
}
All I want to do is use one generic function for the two, so that from the main.cpp:
void main()
{
List<Member>member1;
List<Book>book1;
char menuChoice;
do
{
cout<<'\n';
cout<<'\n';
cout<<"**** Main Menu ****"<<endl;
cout<<'\n';
cout<<"1: Add Book "<<endl;
cout<<'\n';
cout<<"2: Remove Book "<<endl;
cout<<'\n';
cout<<"3: Display Books "<<endl;
cout<<'\n';
cout<<"4: Add Member "<<endl;
cout<<'\n';
cout<<"5: Remove Member "<<endl;
cout<<'\n';
cout<<"6: Display Members "<<endl;
cout<<'\n';
cout<<"7: Borrow Book "<<endl;
cout<<'\n';
cout<<"8: Return Book "<<endl;
cout<<'\n';
cout<<"0: Quit "<<endl;
cout<<endl;
cout<<"Enter one of the above choices: ";cinFlush;
cin>>menuChoice;
switch(menuChoice)
{
case '1': cout<<'\n';
book1.addElement("Books");
break;
case '2': cout<<'\n';
break;
case '3': cout<<'\n';
book1.displayElement("Books");
break;
case '4': cout<<'\n';
/*member1.addElement("Member");*/
break;
case '5': cout<<'\n';
break;
case '6': cout<<'\n';
/*member1.displayElement("Member");*/
break;
case '7': cout<<'\n';
//book1.borrowElement();
break;
case '8': cout<<'\n';
//book1.returnElement();
break;
default: cout<<'\n';
cout<<"Invalid Selection\n";
}
}while(menuChoice != '0' && !cin.eof());
prompt_to_quit();
}
...to call each one and dispaly either the books from a book array or the members from a member array.
The'display' implementation code is:
template<class Object>
void List<Object>::displayElement(char* type)
{
if (num_elements == 0)
cout<<"No "<<type<<" is found in the "<<type<<" array.\n";
else
for(int element=0; element<this->num_elements; element++)
{
cout<<'\n';
this->element_list[element]->display(association_list.get_member(element_list[element]));
}
}
But I'm having some errors trying to use
template<class R,class P>
R* get_member(P* pArg); instead of using the a,b function prototypes. The 'generic' function that I use and causes the problems is:
template<class R,class P>
R* AssociationList<Book,Member>::get_member(P* pArg)
{
R* member=0;
bool searching=true;
int index=0;
while(searching)
{
if (this->association_list[index])
if (this->association_list[index]->linked_book()==book)
{
member=this->association_list[index]->linked_member();
searching=false;
}
else
index++;
else
index++;
if (searching && (index == LIST_SIZE))
{
searching=false;
}
}
return member;
}
The errors are:
'AssociationList<class Book, class Member>::get_member':unable to resolve function overload
and the second one is:
template definitions cannot nest(??)
Could someone help me?
Regards,
grscot
|
|
|
|
|
Hello
I've got a listview that I fill with information about mp3's.
The SQL query looks like this: SELECT * FROM mp3_info LEFT JOIN mp3_genre USING (genre_id) WHERE artist like 'a%' ORDER BY artist, album, title
The query returns about 5 columns and about 200 rows.
Then I use the following loop to populate the listview:
do
{
rs.GetFieldValue(1, nMp3Id);
rs.GetFieldValue(2, szName, 40);
nIndex = ctl.InsertItem(ctl.GetItemCount(), szName, -1);
ctl.SetItemData(nIndex, (DWORD_PTR)nMp3Id);
for (int i = 3; i < m_nColumnCount; i++)
{
rs.GetFieldValue(i, szName, 40);
ctl.SetItemText(nIndex, i-2, szName);
}
} while (rs.MoveNext());
The problem is that the loop is slow, It takes over 1 second to fill the listview.
The GetFieldValue function looks like this:
bool CODBCRecordset::GetFieldValue(int nField, char *szData, int nMaxLen)
{
//we are 1 based.
if (!nField) return false;
SQLRETURN ret;
ret = SQLGetData(m_hStmt, (SQLUSMALLINT)nField, SQL_C_CHAR, szData,
nMaxLen, NULL);
return ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO;
}
Why do it take such a long time to populate the list?
|
|
|
|
|
Try use SQLBindCol and SQLFetch.
Pavel
Sonork 100.15206
|
|
|
|
|
why? Is it faster? why are SqlGetData slow?
|
|
|
|
|
Hello everyone,
I have a little problem that I was hoping someone could help me out with. I have a data file (created by using serialization) that I want to read into a new program. Problem is, the new program class name is the same as the old one (and I can't change it since the code was done by a third-party). I want to use my old class to read the data in, then save it to the new class.
So, I created a new class (let's call it CAlar1, since the original class was CAlarm and I thought the class name length should be the same) and tried to read the file in, but after serializing the class, all the data is messed up. Since the class name is different, it doesn't seem to be reading the file correctly.
Is there any way around this? I would like to read the old data in, convert it to the new class, and save it back, so short of decoding the binary file format, is there anything else I can try?
Regards,
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
Brigg Thorp wrote:
Is there any way around this? I would like to read the old data in, convert it to the new class, and save it back, so short of decoding the binary file format, is there anything else I can try?
If you have a class with the same name as a third-party utility you can wrap your class around a namespace, thus:
using CAlarm;<br />
using MyClass::CAlarm;
-Nick Parker
|
|
|
|
|
Nick Parker wrote:
If you have a class with the same name as a third-party utility you can wrap your class around a namespace, thus:
using CAlarm;
using MyClass::CAlarm;
Not exactly sure what you mean by this. Also, don't know if I explained the situation clearly.
I have a class CAlarm done by a third-party company. Let's say that it has 12 variables serialized to a file. I have another class CAlarm (which I renamed to CAlar1 so I could compile my project) which has 8 variables serialized to a file. What I want to do is read the 8 variable class in, then add that data to the 12 variable class (supplying defaults for the additional 4 variables).
The 12 variable class was originally written by us, however another company changed it, but didn't update the version number that is serialized to the file (so both files have a version number of 1). So, I can't easily update the 12 variable class with a new version number (there are already files in use), then have a variable read in either the 8 variable file or the 12 variable file depending on the version. I have the code for both classes, so I'm not sure what the next step to take is.
Regards,
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
|
Use a DLL to make that work...
|
|
|
|
|
Hi, everyone!
I often puzzled about when to use const_iterator of vector
and when to use size_type of vector.
For example, in the following piece of code, we should use
const_iterator instead of size_type.
I want to know whether there are some concrete rules? Easy to
remember ones.
Source Code:
--------
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string>::const_iterator i;
vector<string> Buffer;
Buffer.push_back ("Hello");
i = Buffer.begin();
return 1;
}
--------
Thanks in advance,
George
|
|
|
|
|
You use size_type when you work with an index into the vector.
For access, you use operator[]
You use an iterator as a pointer into the vector.
For access you use operator->
So, in one sentence: They do similar things, but are absolutly not interchangeable.
I hope this helped
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Thanks, jhwurmbach buddy!
I have never used operator -> with const_iterator of
vector. I have just used * operator on it. Can you
show me an example about how to use operator -> with
const_iterator of vector?
regards,
George
|
|
|
|
|
The -> operator is used when the iterator references a struct or class . It's a short-hand notation for combination of * and . :
iter->member is same as
(*iter).member
|
|
|
|
|
Thanks, markkuk buddy!
I think when use const_iterator, the operator -> is used on
the iterator. And when use size_type, the operator [] is used
on the vector itself. So the objects they are used on are different.
Am I correct?
regards,
George
|
|
|
|
|
I have divided one of my Visual Studio projects into "subsystems" using folders to make it easier to navigate between logically seperate subsystems. But my problem is that after a while these folders disappeared. It really annoys me because it takes quite a long time to sort my classes into these folders. Is this a known problem and is there anything I can do to solve the problem?
|
|
|
|
|
The folder information is stored in the project's .opt file, so you'll need to protect if from beeing removed or overwritten. Or, if you're using a version control system, you could have it checked in, checking it out when you make changes to the class tree...
I don't know why they disappear, but it's bothering me as well.
|
|
|
|
|
Thanks that helped i will try and protect that .opt file by moving it into sourcesafe.
|
|
|
|
|
This is no good. This is a VS6 bug, and I had to surrender with it. Now I divide a workspace into subprojects when I want to have my classes separated/grouped.
Regards,
BB
|
|
|
|
|
Hi,
I wanted to use the RTF/CRichEditCtrl as a kind of report system, where the reports are generated from templates of rtf files. Consider a simple application, that needs to fill out a predefined form with some application dependant values.
A first simple solution would be to search and replace Tags within the RTF file with the computed values.
A better solution would be to use the field tag from the RTF specification directly. For example the author field from a word document would look like:
{\field{\*\fldinst
{ AUTHOR \\* MERGEFORMAT }}{\fldrslt {Dirk}}}
where fldinst is the specific field instruction and fldrslt is the latest evaluated result.
Unhappily the CRichEditCtrl does not evaluate internal fields (like author) either, and I couldn't find any Interface in the ITextDocument specification to access the fields of the document.
Does anybody know how to reevaluate the contents of fields programmatically? Something like a callback function with the fied instruction (fldinst) and the return value is the evaluated result? Another possibility would be to reparse the complete document again and aply the evaluated values into the result field (fldrslt) and then feed the document back to the Ctrl.
Any ideas / code?
Thanks
Dirk
|
|
|
|
|
Hi,
does somebody know how to rename an existing project??
Thanks, Mark
|
|
|
|
|
Make a search for vsrename here on CP.
[edit]
Ouuahh connection is fast today, so you will even get a link
Click here[^]
[/edit]
~RaGE();
|
|
|
|
|