|
Hi I solved it this way..
Disable the button.
Spawn a thread.. Within that thread do some processing And once its over enable the button back again..
E.G:
On ButtonClick()
{
GetDlgItem(IDC_Button1)-> EnableWindow(falsE);
AfxBeginThread(runThread,this);
}
static UINT runThread(LPVOID param)
{
((Class *)param) ->runFunc();
return 0;
}
void Class::runFunC()
{
// Do proceddgin or Sleep...
GetDlgItem(IDC_BUTTON1)->EnableWindow(true);
}
So no message Loops needed.
But i still don't understand how a button can generate clicks once it is disabled...
|
|
|
|
|
Hi,
I'm trying to use FtpFindFirstFile to know if a file is on server, and FtpGetFile to retrieve it.
The problem is when I try to download or list something that is not there. It just returns me an "operation was completed sucessfully", no matter what I do.
Is there any way of retrieve the error the FTP throws? Any sample?
tia
sms2k
|
|
|
|
|
Try using FtpOpenFile in conjunction with InternetSetStatusCallback to get more infomation.
|
|
|
|
|
dear all,
i want to pass a CArray object (newTask which is an array of a struct TASKS) in a function.
so how do i define a function which takes
1) CArray object (newTask) as parameter.
2)pointer to CArray object (&newTask)
thanx
rishabhs
|
|
|
|
|
Using std::vector this would be easy:
void wobble (const std::vector<TASKS>& tasks);
and
void wobble (const std::vector<TASKS>* pTasks);
but using MFC CArrays, I have not the slightest clue.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
[edit] first I'd bartered the function declarations .. but now it's ok
rishabhs wrote:
CArray object (newTask) as parameter.
I think passing as an object won't work. Use references instead:
void MyFunc( CArray(int, int)& array) {...}
...
CArray<int, int> myArray;
myArray.Add(1);
myArray.Add(111);
MyFunc(myArray);
rishabhs wrote:
2)pointer to CArray object (&newTask)
Pass it as you'd do with any other object:
void MyFunc( CArray(int, int)* pArray) {...}
...
CArray<int, int> myArray;
myArray.Add(1);
myArray.Add(111);
MyFunc(&myArray);
|
|
|
|
|
thanx Schlaubi,
but i want to pass my own structure (type) instead of int.
so this is the problem!
any ideas!!!
|
|
|
|
|
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
|
|
|
|