|
1) Under Win95/98 only 16 bit version is awailable. i.e. Get a pull out old VC 1.51... or do the Thunking ...
2) Install server manager for win95 and missuse "radmin32.dll". I have done both in the past. radmin32 is much easier path.....
|
|
|
|
|
Dear all,I'm really sorry for asking again about the same thing, but I don't really undersatnd what's going on with the templates.
I've tried to use the template<class R, class P>
R* get_member(P* pArg)
as adviced, but it seems that my program is more complicated.
So, I think I have to submit you a significant part of my code to give me an extra help (and final one I hope ) to overcome this awful template obstacle.
AssociationList.h
template<class Book,class Member>
class AssociationList
{
public:
//It initialises all slots in the associationlist array to zero.
AssociationList();
/* It searches the associationlist, if book is found then returns
the member that is connected with.*/
//Member* get_member(Book* book);
/* It searches the associationlist, if member is found then returns
the book that is connected with.*/
//Book* get_book(Member* member);
template<class R,class P>
R* get_member(P* pArg);
/* Checks that book/member not already linked
creates association if objects are free to link
returns whether or not link was valid */
bool link(Book* book,Member* member);
/* Checks that book and member are linked
deletes association if they are linked
returns whether or not unlinking was valid */
bool unlink(Book* book,Member* member);
private:
Association<Book,Member>* association_list[LIST_SIZE];
};
AssociationList.cpp
template<class Book,class Member>
AssociationList<Book,Member>::AssociationList()
{
cout<<"AssociationList constructor called\n";
int index;
for(index=0; index<LIST_SIZE; index++)
this->association_list[index]=0;
}
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;
}
//template<class Book,class Member>
//Member* AssociationList::get_member(Book* book)
/*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;
}
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;
}*/
Association.h
template<class Book,class Member>
class Association
{
public:
//Sets up book and member with parameters
Association(Book* book, Member* member);
//Returns Book
Book* linked_book(){return this->book;}
//Returns Member
Member* linked_member(){return this->member;}
private:
Book* book;
Member* member;
};
Association.cpp
#ifndef _ASSOCIATIONCPP
#define _ASSOCIATIONCPP
#include "Association.h"
template<class Book,class Member>
Association<Book,Member>::Association(Book* book, Member* member)
{
this->book=book;
this->member=member;
}
#endif
Apologies for the huge amount of code.
grscot
|
|
|
|
|
What is wrong with
(.h)
Member* get_member(Book* book);
(.cpp)
template<class Book,class Member><br />
Member* AssociationList<Book,Member>::get_member(Book* book)<br />
{<br />
...<br />
}
?
|
|
|
|
|
I created an MFC Dialog application. I then put a group box on it that I wanted to be square in shape. I edited the .rc file to make sure it was exactly square. I then ran the app and it worked fine, however, when I ran it on another computer my group box was not square (not even close). I then re-compiled my code on the new computer, but the problem was not fixed. So, my question is, how do I make a square control in an MFC dialog application that is square on all computers?
Thanks for the help.
|
|
|
|
|
>I then ran the app and it worked fine, however, when I ran it on another
> computer my group box was not square (not even close).
Did that computer had large or extra large font in the window caption by any chance?
Brian
|
|
|
|
|
Yes, one computer had large fonts (125% normal size, 120 dpi), the other had small fonts (96dpi).
|
|
|
|
|
The dimensions in the dialog template are in dialog units, not pixels. To get exactly the same size (in pixels) you will have to recalculate at run time. See Q125681 in MSDN, "HOWTO: Calculate Dialog Base Units with Non-System-Based Font", for details.
Best wishes,
Hans
|
|
|
|
|
Dear all,
I 've understood that the template function for the two functions :
int AddNumbers(int a, int b);
float AddFloats(float a, float b);
is: template<class T>
T Add(const T &a, const T&b)
{
return a+b;
}
because the arguments' return type is the same as the functions' return type.
But what is the template function when the return type of the arguments is different from the return type of the function?
For example:
Member* get_member(Book* book);
Book* get_book(Member* member);
What is now the template function of the two above functions?
Regards,
grscot
|
|
|
|
|
Your template function would have two parameters:
template <class R, class P>
R* get_member(P* pArg);
You could call it like:
get_member<Member, Book>(&book);
get_member<Book, Member>(&member);
|
|
|
|
|
My program opens a file like this:
myFile.Open(Data[i].FileToModify,CFile::modeCreate | CFile::modeNoTruncate | CFile::modeRead,&fileException))
It works fine for me and most other people, but 3-4 (one using ME; others, I don't know) people have reported getting error #5 (ERROR_ACCESS_DENIED) when doing that. What could be causing that? I'm at my wit's end
|
|
|
|
|
Try
myFile.Open(Data[i].FileToModify,CFile::modeCreate | CFile::modeNoTruncate | CFile::modeRead|CFile::shareDenyNone ,&fileException))
Brian
|
|
|
|
|
Thanks, that works!
Now, why do most people not need that flag, but some do?
|
|
|
|
|
Is the only way to include images in your control?
I have to have a edit control that displays text and images. Sort of like the message window of a messenger (that displays text and smiles).
Is there a way to display images in a RichEditCtrl?
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
http://www.codeguru.com/richedit/rtfbitmap.shtml
|
|
|
|
|
Hello.
I´m working with MFC over NT. I´m using the CWorkQueue (threadpool) http://www.codeproject.com/useritems/Work_Queue.asp.
My problem is very easy to see. When an exception thrown inside of a thread my application finishes. It is because i can´t catch the exception with the common try{}catch{} block.
Anybody can help me?????
I am desperate
thank you very much by its time
|
|
|
|
|
|
When closing the last MDI Child windows, the document should close (as far as I understand).
When/Where does the MDIFrame window gets notified and changes the menu to the default menu when no document is loaded ?
Thanks.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
>When/Where does the MDIFrame window gets notified and changes the menu to the default menu when no document is loaded ?
CChildFrame (CMDIFrameWnd::OnUpdateFrameMenu) is responsible for switching MDI menus.
I think it would be easier to catch "ID_FILE_CLOSE" & count docs ....
Brian
|
|
|
|
|
Dear all,
I would like to ask if it is possible to have a template function as a general function for two functions that have a different return type.
For example:
int AddNumbers(int a, int b);
float AddFloats(float a, float b);
What would it be the template function for the above example?
Regards,
grscot
|
|
|
|
|
template <class T> T Add(const T &a, const T&b)
{
return a + b;
}
|
|
|
|
|
Hi Roger
As you said in an article that I recently read, you're the printing guru.
I've got a problem and I don't know if you could help me.
PRECONDITIONS
I have to print an undetermined number of pages.
I have a determined number of files from where I get the data to print in order.
The data print is variable (sometimes could fit in a page, others half a page, others more than 1 page).
I have to optimize to fit the maximum number of data on the minimum number of pages ( if I could fit 2 data files in a page I have to do it)
How can I manage this? From where?
Best Regards
|
|
|
|
|
Sounds like a tricky problem.
The first thing I would recommend is you have some code that loads in all the files you will need to be printing. You can store these in a vector of objects. The object needs to support a call that tells how much space it will need when it prints - this probably needs to be in lines or pixels (depends on what each object is). Once you have their sizes, you could write an algorithm that groups together those items which can be placed on the same page where possible (this also depends on the page size landscape/portrait etc)
Once you have them put together into page blocks you will be able to calculate the number of pages you will have to print and hopefully print them too.
As your algorithm for working out what goes on each page needs to be properly optimized. I would get the items just printing as a square block with an ID number inside. Then if you get preview up and running you can try tweaking the layout engine until it gives the best results.
As your question is just a general overview I can't really be more specific.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thanks Roger
I was thinking in something like this ( a lot of work!!!!) but I think that is the only way.
Best Regards
|
|
|
|
|
I have a CFormView based project that cleans out the system. For example, it deletes cookies, and temp files. When I run the program, the user can select checkboxes and click on a button to wash.
Is there any way to adjust the program so when the user clicks the .exe file, my program reads the command and does the wash automatically without opening the actual program?
|
|
|
|
|
azi_games wrote:
my program reads the command and does the wash automatically
Yes, this is easy and commonly done. You can store parameters for program in INI file, in Registry, or even read them for command line - see XGetopt for an example of reading command line.
azi_games wrote:
without opening the actual program
I do not understand what you mean. If the user clicks on a program, he expects to see something happen. If nothing happens, he will probably click again. After three or four times, he will probably think your progam doesn't work, and will delete it from system.
Of course, if this is really what you want to do, then there are ways to make a program invisible - e.g., on NT, make it a service. Or make your program's main window the child of an invisible window - it will not even show in the taskbar.
Best wishes,
Hans
|
|
|
|