|
Dear all,
can any body explain me what is the need of interface
are they just be usefull only for COM application...
Thanks in advance..
Vikas da
vikas da
|
|
|
|
|
tasumisra wrote: are they just be useful only for COM application...
Use of interfaces increases the modularity and maintainability of the code. Once COM components are developed the entire system is seen as a set of blocks that gel together to provide some functionality. Usually if you want to use third party softwares/functionality interfaces provide you the mechanism for achieving this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi All,
I want to display files huge files (Hexedit display format)in MFC. Any idea about doing this...
Manjunath S
GESL
Bangalore
|
|
|
|
|
If i have a triangle with following angles(in degree) and lines
A(57),B(62),C(61)
say line between A and B is c
line between B and C is a
line between C and A is b
Now suppose i divide angle B in two equal parts by drawing line on line b from angle B. i.e. i draw a line from point of angle B to line b
then i want to get the coordinates of point where new line touch line b
please suggest if there is any formula or algo to get it
Manoj Kumar Chauhan
|
|
|
|
|
use vector to determine the new line,
then get the cross point of the two lines.
|
|
|
|
|
How to use the vector?
please give any example or sample
Manoj Kumar Chauhan
|
|
|
|
|
It is a mathematical problem.
It can be found in google.
For example, A is at (x1,y1), then vector A,Va=x1+y1i, so Vb=x2+y2i
You can use AxB A.B, hope it helps.
|
|
|
|
|
hi
i have a application to disable the popupmenu start button when it is started at the same time stop buton should be enabled ,like same case for stop button also(disable when it is in on)
with advanced thanks
k.guru moorthy
k.guru moorthy
|
|
|
|
|
Could you please rephrase? I didn't get you...
|
|
|
|
|
i hav a application in system tray based i.e when click the minimise button icon will be moved to system tray .
i finished all (i.e minise to tray and popup menu )
now the problm is there r two button called start ,stop button
when i clicked start button , corresponding function is doing well and the button should be disabled (stop button - enabled)
when i clicked stop button corresponding function is doing well and this button should be disabled (start button - enabled )
u say how to disable.
i tried using getting id of the button but run time error ocurs (NO SYMBOLS ARE LOADED FOR ANY CALL STACK FRAME )
please help me
k.guru moorthy
|
|
|
|
|
If you are using MFC, then you can do it as follows
GetDlgItem(IDC_BUTTON1)->EnableWindow( FALSE );
OR
m_btnButton1.EnableWindow( FALSE );
But why it crashes? How did you disable it?
|
|
|
|
|
Cbutton* newbutt=((CButton *)getdlgitem(id_popupmenu_start);
newbutt->enablewindow(true);
k.guru moorthy
|
|
|
|
|
Where are you calling this? And did you verify that the pointer is valid?
|
|
|
|
|
Did you want to disable button?
|
|
|
|
|
My program would crash when it goes to CListCtl::InsertItem().The codes like bellow:
//get_wstring() will return a std::wstring object here,count is the rows I want to insert
for(int i=0;i<count;++i){>
std::wstring str = get_wstring();
CString temp(str);
//m_list is a CListCtl control
AfxMessageBox(temp);
m_list.InsertItem(i,temp);//crash here
}
the codes would crash when str string is not in my local language page(so the content of temp would be a strang string).But AfxMessageBox works well.
Someone would like to tell me why and how to fix such errors?
Thanks.
Merry Chrismas!
|
|
|
|
|
The cause might be the std::wstring, or the construction of CString from std::wstring. Please try this and see if it also crashes?!
m_list.InsertItem(i, "test");
Maxwell Chen
|
|
|
|
|
Of course not.
No matter what content of temp(CString object),AfxMessageBox() would show the real content of temp.But when its content like "ß??z???"(string like this were read from some file),InsertItem() would crash.
modified on Tuesday, December 25, 2007 11:57:34 PM
|
|
|
|
|
kcynic wrote: the codes would crash when str string is not in my local language page
Make your application UNICODE compatible and then try.( by defining _UNICODE in the project settings )
|
|
|
|
|
Yes,I compiled the project as UNICODE version,I forgot to say.
|
|
|
|
|
ok. check whether your strings are null terminated.
|
|
|
|
|
my strings are null terminated.If not,I think the CString constructor would crash too.
In addition,AfxMessageBox works well.
In fact,the codes work well for a PC,crashs for another!
|
|
|
|
|
Now,I found that,the problem is not InsertItem,but is CString or std::wstring.
//
std::wstring get_wstring(int tag)
{
wchar_t * s = NULL;
int len = function_ret_wstring(tag,&s);//return the characters in s,s is null terminated
std::wstring ss = s;
free(s);//s was alloced by function_ret_wstring() on heap
return ss;
}
//in the UI
void SomeClass::ShowItems()
{
for(int i=0;i<item_count;++i)>
{
CString temp(L"");
temp = get_wstring(tag1).c_str();
m_list.InsertItem(i,temp);
temp = get_wstring(tag2).c_str();
m_list.SetItemText(i,1,temp);
temp = get_wstring(tag3).c_str();
m_list.SetItemText(i,2,temp);
}
}
It is very strang,the codes work well on some computers,but would crash on some computers,too.
Because,the computer which run the codes crashedly have no VC installed,I could not debug.But I think the problem is the deconstructor of CString or std::wstring,Someone would like to give me some advise I will be very appreciate.
Thanks
|
|
|
|
|
Still i didnt get any idea...
<blockquote class="FQ"><div class="FQA">kcynic wrote:</div>free(s);//s was alloced by function_ret_wstring() on heap</blockquote>
How ever you are using free() to deallocate the memeory. was that memory allocated using the malloc()?
|
|
|
|
|
Yes,the memory was allocated using malloc()
|
|
|
|
|
What compiler and what CString (MFC, ATL, other?) are you using?
there should be no conversion from std::wstring to CString
(and there isn't in VC2005)
|
|
|
|