|
In that code Wait cursor not stops appearing,
even EndWaitCursor() callled,
(until I move mouse)
<br />
CFromview::Method()<br />
{<br />
BeginWaitCursor();<br />
<br />
WORK();<br />
<br />
<br />
EndWaitCursor();<br />
<br />
<br />
this->Invalidate();<br />
this->UpdateWindow();<br />
<br />
}<br />
Why ?
how to correct
|
|
|
|
|
Is CFromview::Method() called frequently?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Only once.
Problem probable happen when it finished until,
butoon is relalized.
::SetCursor(AfxGetApp()->LoadStandardCursor (IDC_ARROW ));
can help.
Cursor probably not refreshed due to unknown reason,
when standard Wait/End sequence is proceed.
|
|
|
|
|
If you use MFC, you could use a CWaitCursor object:
<code>CFromview::Method()
{
{
CWaitCursor waitCursor;
WORK();
}
RedrawWindow();
}
HTH,
K.
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
Works same.
In usual method- yes,
in this - no any difference in problem.
|
|
|
|
|
It sounds like something else is setting the cursor, then.
You could also try to catch WM_SETCURSOR, and use a boolean set to true when your application is working:
BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if(m_bMyAppIsWorking){
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
return TRUE;
}
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
return CView::OnSetCursor(pWnd, nHitTest, message);
}
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
Please explain what nature of error that was happen?
First is need to understand fully,
than to solve by try and error.
|
|
|
|
|
In the example I gave, the processing of WM_SETCURSOR by the view leads to set the cursor either at IDC_WAIT or at IDC_CROSS, whatever another part of your code set the waitCursor.
vgrigor wrote:
First is need to understand fully,
than to solve by try and error
IMHO, not always, sometimes it doesn't worth the time to learn it.
Silence Means Death
Stand On Your Feet
Inner Fear
Your Worst Enemy
|
|
|
|
|
Of course,
Worth - when it is possible.
It is usually (or often ) possible - to understand something, than only try and error.
that is often proposed.
|
|
|
|
|
Ensure that in your WORK() method nothing is trying to steal the capture of the mouse. Check for SetCapture() API calls.
|
|
|
|
|
how to replace char array[15] with string field?
|
|
|
|
|
Simply move the array into the string.
char array[15];
string str = array;
William
Fortes in fide et opere!
|
|
|
|
|
But I do I deal with indexes in array after I move everything into string?
|
|
|
|
|
Use the [] operator.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Like this?
char array[15];
string str[] = array;
|
|
|
|
|
No, like this:
char array[15];
string str = array;
if (str[3] == array[3])
...
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i don't understand what does"replicated servers" mean
|
|
|
|
|
There are several functions whose prototypes are the same. Because each is dependent on the preceding one to return a certain value, I thought, puttting them (the functions) in an array, and executing them from the array would be easier.
The syntax of the statements are correct, but when the program executes, the functions don't get activated.
Might someone see why this is happening? Here's the code.
class MyClass
{
enum PStatus { NoError, InvalidCode, OutOfRangeAmt, etc. };
PStatus Func1();
PStatus Func2();
PStatus Func3();
};
================
later in the program, I do this.
...
PStatus PS = NoError;
const int n = 3;
typedef bool (MyClass::*PTF)();
PTF FuncArr[n] = { MyClass::Func1, MyClass::Func2, MyClass::Func3 };
...
for(int i=0; i<n && PS==NoError; ++i)
FuncArr[i]; Even when I removed the "PS==NoError" part of the condition, the functions still didn't get activated.
Perhaps I should also mention, when I coded:
PS = FuncArr[i]; in the "for" statement, the compiler complained. (FWIW, I put certain message in each function to let me know they were entered. No such messages were shown.)
Thanks for any insight.
William
Fortes in fide et opere!
|
|
|
|
|
you cannot call a member function of C++ class without an object
you have to have an object and through that object you can call the member functions
if
class A {
void DoStuff();
};
then A a;
a.DoStuff();
now DoStuff knows from which object it was instantiated throug a hidden this pointer
we cannot simply call DoStuff() , if DoStuff is not a Static Function
|
|
|
|
|
Thanks for replying.
If I'm correct, I believe ALL objects of a certain type, share the same functions of that particular type, which means by qualifying the functions with its class name, I am specifying its type.
This does not hold true for the data portion of objects of the same type. To reference the data portion of an object, you must qualify it with that specific object.
In any case, even when I do the following, the functions still do not get activated.
PTF FuncArr[n] = { this->Func1, this->Func2, this->Func3 };
William
Fortes in fide et opere!
|
|
|
|
|
I can think of two things here:
1) AFAIK you have to put the paranthesis on the pointer before calling:
PS = (*(FuncArr[n]))() (I'm not too sure on the syntax, see MSDN)
your code FuncArr[n] only returns the adress stored in FuncArr.
2) Your Func1() (or Func2() etc) expects a this pointer as a parameter, so you'll corrupt your stack by not having an instantiated object. If you don't want this object you should make your Func's static.
happy hunting
Steen
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
you can do the following;
PTF FuncArr[] = { &CMyClass::Func1, &CMyClass::Func2, &CMyClass::Func3 };
int n = GetDesiredFunc();
CMyClass anObj;
bool retval = (anObj.*FuncArr[n])();
I think that should do the job..
Greetz,
Davy
|
|
|
|
|
How to enumerate pnp devices by their type? Subject of interest - unknown and unsupported devices.
|
|
|
|
|
Perhaps this article from MSDN will be of help. Not really one of my strong points, this one, but happy reading nevertheless: Enumerating Current Devices[^].
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thank you for you trying to help me, but
this sample enumerates devices with properly installed drivers. I need to enumerate devices of "Unknown" or "Unsupported" type. These devices has no GUID in the system registry, and I guess I can't enumerate them using this SetupAPI. Anyway it seems they are not appeared in the HKLM\System\CurrentControlSet entry in the System registry.
But I can be wrong.
|
|
|
|