|
I have a class which i use as a base class for my other views.. it has a base class of CFormView.. i hope to convert this view into a .dll .. it currently is dependent on the resource.h because of the line:
enum { IDD = IDD_DISPLAY };
this is then used in the CFormView constructor.. the other option for the constructor is to pass it LPCTSTR lpszTemplateName which i guess is what i need to do? how could i get rid of this dependency, and how could i maybe make this view into a .dll?
thanks for any suggestions!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
One solution (assumes CYourFormView is your CFormView derived class):
1. Take out the "enum { IDD = IDD_DISPLAY };" from the CYourFormView.
2. Change the constructor of CYourFormView to accept a resource ID, and to not pass IDD into the CFormView constructor, but rather, pass in the value you get in CYourFormView's constructor.
3. In each .exe that uses CYourFormView, change the base initializer to pass in the appropriate resource ID to CYourFormView.
It could be something like this:
class CYourFormView : public CFormView
{
public:
CYourFormView( UINT p_uiTitleID );
CYourFormView( LPCTSTR p_pszTitle );
};
CYourFormView::CYourFormView( UINT p_uiTitleID ) :
CFormView( p_uiTitleID )
{
}
CYourFormView::CYourFormView( LPCTSTR p_pszTitle ) :
CFormView( p_pszTitle )
{
}
class CYourMoreSpecialFormView : public CYourFormView
{
public:
CYourMoreSpecialFormView();
enum { IDD = IDD_WHATEVER_YOU_WANT_IT_TO_BE };
};
CYourMoreSpecialFormView::CYourMoreSpecialFormView() :
CYourFormView( IDD )
{
}
I hope I have been clear enough. If not, I can try to explain better.
Chris Richardson
|
|
|
|
|
how can i know how many elements the vector has?
|
|
|
|
|
size_type size() const;
this is in all manuals and MSDN documentation.
Max.
|
|
|
|
|
|
Hi Folks,
can anybody tell me how the read a standard windows cfg file and access its sections and parameters ? Like
[My Section]
something = 1
I suppose there has to be a mfc class ???
Many Thanks
murphman
|
|
|
|
|
Look at GetProfileString, ReadProfileString, and related functions; they are Win32 API functions.
Max.
|
|
|
|
|
Great && Fast help ...
Regards
murphman
|
|
|
|
|
Hello All,
I am using one function, IDiscRecorder::GetPath(); Which returns the path for the CDRecorder, this function either gives OS Path, like \Device\CDRom0 or E:\. I am using this function which returns OS Path, and I want it to return the Drivetype its mapping to.
Is there anyway, someone can tell me, how can I find that what this OS path is mapping to. And I am doing it programmatically. So, it will be very helpful,if someone can suggest me how to get the drivetype with given OS path.
Thanks,
|
|
|
|
|
For drive-letter you can use GetDriveType (too obvious? ).
For the NT-only device specifications ("\Device\Xxx") I think you'd have to either get the drive-letter for that device or use some DDK function (AFAIK it's only the DDK that documents NT-only, non-Win32, functions).
|
|
|
|
|
I created a database, now I want to fill in the fields. The way I've seen is to do an AddNew with the recordset. But I have no records! Is it okay to do a SQL query (select * from Table) to retrieve a recordset object?
Appreciate your help,
ns
|
|
|
|
|
|
as far as i know, it`s ok to do that.
|
|
|
|
|
I've made an application to get meteo data from a server and to draw a graphic, it is possible to save it to a file. Well, when I download and draw a file, the first item of MRU files never works, neither if I try to open it with the 'File Open Dialog', but the another three items in MRU work fine. I suppose it assumes than the first item is the one loaded at screen but it's not true. What could be the problem?
|
|
|
|
|
I'm trying to use sendmessage to a button in a dialogbox. It seems its not working. I must have the parameters wrong or something. Any ideas.
Thanks
|
|
|
|
|
It should be defined something like this:
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );
How are your parameters set up?
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
Try this solution.
::SendMessage(m_Button.GetSafeHwnd(), Message, WPARAM, LPARAM)
Kuphryn
|
|
|
|
|
There's no way to know what's wrong unless you post your code.
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi
try
{
}
catch(...)
{
}
this catch will catch any error. how to get this error information which cause the catch
Gau..
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
That is the problem with the ... catch all operator, there is no way to get the error information. This should be used as a just in case mechanism.
Hopefully you know what type of error will be thrown and you can look for that particular type of exception.
try
{
}
catch (CException &err)
{
}
catch (DWORD &err)
{
}
catch (...)
{
}
You can catch class objects, native data types or do the catch all. The most important thing to remember is to place the exception catch code that is the most detailed or most important to you first in the chain. Because if it is possible for the exception to be casted or converted into one of the other forms in order for the handler to work, it will.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
To add to Paul's excellent comments:
It's best to derive all your exception classes from one base class, such that you can simply catch any of them in one clause. Then you can leave the catch(...) clause for things that would not otherwise happen if your code were bug-free, such as access violations.
try
{
...
}
catch (BaseExceptionClass& e)
{
}
catch (...)
{
}
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
I have two sets set1, set2. They have some elements in commmon. I want to make a set3 which is the unique elements from both set1 and set3.
What i mean is if set1 has a,b,c,d,e
set2 has b,c,e,f,g,
Then I want set3 to have in it: a,b,c,d,e,f,g. I'm using a set because it wont have duplicate elements. But I dont know if you can do:
set3 = set1+set2?
Do I have to use iterators and do something like copy both set1, set2, into set3?
Appreciate your help,
ns
|
|
|
|
|
|
Daniel Turini wrote:
You can use STL's set_union available in #include <algorithm>
You can still run into duplication with set_union, here is an example I found showing this:
inline bool lt_nocase(char c1, char c2) { return tolower(c1) < tolower(c2); }
int main()
{
int A1[] = {1, 3, 5, 7, 9, 11};
int A2[] = {1, 1, 2, 3, 5, 8, 13};
char A3[] = {'a', 'b', 'B', 'B', 'f', 'H'};
char A4[] = {'A', 'B', 'b', 'C', 'D', 'F', 'F', 'h', 'h'};
const int N1 = sizeof(A1) / sizeof(int);
const int N2 = sizeof(A2) / sizeof(int);
const int N3 = sizeof(A3);
const int N4 = sizeof(A4);
cout << "Union of A1 and A2: ";
set_union(A1, A1 + N1, A2, A2 + N2,
ostream_iterator<int>(cout, " "));
cout << endl
<< "Union of A3 and A4: ";
set_union(A3, A3 + N3, A4, A4 + N4,
ostream_iterator<char>(cout, " "),
lt_nocase);
cout << endl;
}
The output is
Union of A1 and A2: <font color="red">1 1 2 3 5 7 8 9 11 13</font>
Union of A3 and A4: <font color="red">a b B B C D f F H h</font>
I suppose you could sort your two maps and create a third where you use an interator and the find function to make sure that you have only added the value from either maps when it is not in map number 3 based on the iterator. A simple for loop should do the trick, however maybe someone else has a more efficient method to do this.
HTH
Nick Parker
The greatest lesson in life is to know that even fools are right sometimes. - Winston Churchill
|
|
|
|
|
|