|
rishabhs wrote:
but i want to pass my own structure (type) instead of int.
so this is the problem
Well, the only thing you'd have to do is replacing int by TASKS. The rest wouldn't change. I took int for my example because .... I read over your TASKS - struct;)
|
|
|
|
|
You need to decide if the function will have read/write access to the array or just read access to it.
If it's going to have read/write access, you would just pass it by reference or pointer. By reference is easier since you can use the value semantics (dot notation), however I prefer to pass by pointer since it becomes more obvious that the function is going to change the array.
If it's only going to read the array, then the best way is to pass it by const reference. This gives you the benefits of value semantics while ensuring the array won't be changed (at least not without some ugly casting).
I also recommend creating an alias for the CArray< TASKS, TASKS& >, to make it easier to read (and write). You do that with typedef:
typedef CArray< TASKS, TASKS& > TaskArray;
rishabhs wrote:
1) CArray object (newTask) as parameter
void f1(TaskArray& tasks)
{
}
void f2(TaskArray* pTasks)
{
ASSERT(pTasks);
}
void f3(const TaskArray& tasks)
{
}
rishabhs wrote:
2)pointer to CArray object (&newTask)
TaskArray tasks;
f1(tasks);
f2(&tasks);
f3(tasks);
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
thanx, for a great gesture!
regards
|
|
|
|
|
Hai all
Iam working on a telelcom project...while reading from or wroting to a node we use to show a progress control and a "Cancel" button on it.Focus will be set ot this button while the process goes on in order to give the user to cancel the process at any time.but my button is not working(not responding) for the mouse click and is working fine if we press the space bar.can anybody solve my problem??
ThomasKennedyBose
|
|
|
|
|
Could you give some more information?
Is this a dialog box you are talking about, in which case did you create it using MFC, Class Wizard etc. and using the default id IDCANCEL for it?
Debbie
|
|
|
|
|
ya.....this is a dialog box , using the default id IDCANCEL for it....progressbar will be running in special thread....
ThomasKennedyBose
|
|
|
|
|
Sounds weird then. Are you sure the OnCancel is being called by the spacebar action? I'd override it to double check. Are there any other buttons on the dialog? Are they similarly affected?
Debbie
|
|
|
|
|
ya....OnCancel is being called by the spacebar action......there are no other buttons on it....
ThomasKennedyBose
|
|
|
|
|
Is the mouse working at all in the rest of the dialog box? Could you try putting in, say, a radio button and seeing whether that works?
Debbie
|
|
|
|
|
no debbi..... no other control is responding.
ThomasKennedyBose
|
|
|
|
|
Well, I'm stating the b. obvious here, so apologies, but at least you've got the cancel button out of the equation! You could try GetCapture to see which window has the mouse capture, but other than that I'm all out of ideas, I'm afraid.
Debbie
|
|
|
|
|
Hi,,
I tried with this code and it is working fine now
AfxGetMainWnd()->GetTopLevelParent()->GetLastActivePopup()->EnableWindow(TRUE);
ThomasKennedyBose
|
|
|
|
|
really strange...
did I oversee something? Those WinAPI stuff confuses me sometimes... but i see no reason why it can't be const. I needed a const version so I did this:
BOOL CMyFonts::GetLogFont(const CFont& Font, LOGFONT* pLogFont) const
{
ASSERT(pLogFont);
HFONT hFont = Font;
return ::GetObject(hFont, sizeof(LOGFONT), pLogFont);
}
|
|
|
|
|
Just look what I do. The important line can work on a const method! I am following Scott Meyers recommendations!
CSomeClass& CSomeClass::operator=(const CSomeClass& source)
{
m_name=source.m_name;
LOGFONT lf;
(const_cast<CFont&>(static_cast<const CFont&> (source.m_font)).GetLogFont(&lf)); m_font.Detach();
m_font.CreateFontIndirect(&lf);
return *this;
}
|
|
|
|
|
Hello,
I'm writing an application which displays physical units for velocity, density etc in a Dialog. Some require parts of the units to appear in superscript e.g. m/^s and kg/m^3.
I have access to some source code which contains the superscript characters for 1 ,2 , and 3, so I'm able to copy and paste these characters when I need them.
I now need the superscript for '4'. I'm hoping to avoid Unicode fonts for as long as possible. Can anybody help me?
Thanks,
John
|
|
|
|
|
If your app is a non-commercial one, GipsySoft's QHTM Ultra small Win32 HTML control[^] can be used for free and seems a good option.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks but unfortunately it is a commerical app
|
|
|
|
|
John Oliver wrote:
thanks but unfortunately it is a commerical app
No it's not. The dll is free to use, only the source code costs money.
Joel Lucsy
|
|
|
|
|
sorry, I meant my application is commercial
|
|
|
|
|
John Oliver wrote:
sorry, I meant my application is commercial
Ok, then I've missed your point. We use in our commercial apps.
Joel Lucsy
|
|
|
|
|
You could write your own variant of CStatic which could display superscipt characters. When it comes to captions in dialogs take a look at customcaption.asp[^]. This oculd be adapted to draw superscipt characters as well.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
thanks, i can use this sort of thing for lots of issues I've been having
|
|
|
|
|
I always work in SDI projetc an now
I'm working in MDI project, i have a combobox in the toolbar.when I enter a URL i would like navigate in the active window (window with the focus).
i do this :
CString strURL;
m_wndURL.GetEditCtrl()->GetWindowText(strURL);
CBrowserMDIView* pView = (CBrowserMDIView*)GetActiveView();
ASSERT(pView);
pView->Navigate2(strURL,NULL,NULL);
i have an error with "ASSERT(pView)" and if i delete this line i have an error with "pView->Navigate2(strURL,NULL,NULL)"
i'm under WinXP and the error is when the message want send the error to microsoft.
PS i'm sorry for my english
|
|
|
|
|
MDI frame windows don't have active views. Instead, there's the CMDIChildWnd which has associated views. Thus you first need the active child window, then being able to get the active view:
CMDIChildWnd *pChild =
(CMDIChildWnd *) GetActiveFrame();
CMyView *pView = (CMyView *) pChild->GetActiveView();
|
|
|
|
|
Ok thank you very much , it's works perfectly !
now i must remember i must get the activate frame before get activate view.
|
|
|
|