|
HI ,
This is what i'm doing :
OnButtonClick event ,I spawn a thread and while the thread is executing i just want to change the mouse cursor to busy...Is it possible??
InitDialog()
{
hBusyCursor = LoadStandCursor(IDC_WAIT);
hOldCursor = ::GetCursor();
}
MyClass::OnButton1()
{
::SetCursor(hBusyCursor);
AfxBeginThread(runThread,this);
}
UINT MyClass::runThread(LPVOID param)
{
((MyClass *)param)-run();
return 0;
}
void MyClass::run()
{
::SetCursor(hBusyCursor);
// do some thing;
::SetCursor(hOldCursor);
return;
}
//
But the cursor never changes.. Why so??
Could anyone help me .. Thanks very much.
|
|
|
|
|
Use must use thread communication between your class and thread.
before using AfxBeginThread() change your mouse cursor to IDC_WAIT, then when thread goes to finished, send a message to class (by using ::SendMessage() .
In message handler, change cursor to IDC_NORMAL.
A. Riazi
|
|
|
|
|
Hi!!
Thanks for your reply..
I tried as you told .
One thing i observerd was- Irrespective of thread spawning and all that --
If you change the cursor from within OnButtonClick(), then once the OnButton1() function is exited the cursor is automatically reset to Normal Cursor.
SO Generally.. Is there any way to set the Cursor globally throughout .. (i.e) on a Button click or some other control's event , the cursor change remains valid throught the rest of the execution..
THanks so much..
|
|
|
|
|
define a member variable with variable type CWaitCursor to your dialog class. Use member function of CWaitCursor for changing mouse cursor.
A. Riazi
|
|
|
|
|
I added adox ccp and .h and dbclass cpp and .h to my project (these work in another project)., But even after rebuilding all I get:
C:\DbClass.cpp(1540) : fatal error C1010: unexpected end of file while looking for precompiled header directive
AdoX.cpp
C:\AdoX.cpp(794) : fatal error C1010: unexpected end of file while looking for precompiled header directive
What am I doing wrong?
Appreciate your help,
ns
|
|
|
|
|
You must have forgotten to add an #endif somewhere.
~RaGE();
|
|
|
|
|
1. first line in DbClass.cpp and AdoX.cpp should be "#include "stdafx.h""
OR
2. you should disable precompiled headers for those files in compiler settings
|
|
|
|
|
The only diff in my working project that uses these files and my new one is that the od one had YX, not YU in the C++ tab of settings. I made this change manually and it works but I am nervous....
In my old project even the offending files were "automatic use of precompiled headers..."
ANyways after I looked at what doing the YU --->YX did toi my current project - it said not to use precompiled headers. I looked at my old program -- it said to usre automatic precompiled headers EVEN THOUGH it has YX......so in my currrent I selected "automatic use " and looked back in my c++ tab and its till YX...."
What I'm trying to say is that (in my new proj) it was set to "dont use precompiled" (maybe because I changed the Yu to a YX...dont know). Things worked then. Next I selected "automatic use..." and the YU change I made to YX didnt change back to YU...
GEt a warning :Command line warning D4025 : overriding '/Ycstdafx.h' with '/YX/FoDebug/'
Is this dangerous?
Appreciate your help,
ns
|
|
|
|
|
/Yu - it means that file specified (usually "stdafx.h") already precompiled into ".pch". It also means that it MUST BE FIRST INCLUDE in your .cpp.
/YX - in simple terms compiler try to guess which header to make into precompiled. There is bunch of "if", "but" and other conditions - usually it defeats the whole purpose of precompiled headers.
|
|
|
|
|
Inspite of the stadfx being first in my files it was still unahppy till I said automatic use...
Appreciate your help,
ns
|
|
|
|
|
add following line at top DbClass.cpp and AdoX.cpp:
#include "stdafx.h"
A. Riazi
|
|
|
|
|
|
Thanks!
Appreciate your help,
ns
|
|
|
|
|
I was created Toolbar using CToolBarCtrl class.But I was unable change the state of the button?
How to change the state of the Button?
|
|
|
|
|
Use OnCommandUpdate message handler.
A. Riazi
|
|
|
|
|
I was created Toolbar using CToolBarCtrl class.But I was unable change the state of the button?
|
|
|
|
|
Hi,
I want to list all the application running in my machine currently. Is there any API which gives me that information. I used Process32First() and Process32Next() APIs to get the process list. Anything similar to this for the Application list?
Kindly help....
Vini
|
|
|
|
|
Are you speaking about the TaskManagers tab "Applications"? Then EnumWindows is possibly what you're looking for.
|
|
|
|
|
Mike Nordell wrote:
Are you speaking about the TaskManagers tab "Applications"? Then EnumWindows is possibly what you're looking for.
yes.. I want all the currently running application like in the taskmanager. Tnx for the help. I'll try this .
Vini
|
|
|
|
|
Look at he code provided in this article[^]. The functions FillList and ListWindows should help you retrieving the app names.
~RaGE();
|
|
|
|
|
Rage wrote:
Look at he code provided in this article[^]. The functions FillList and ListWindows should help you retrieving the app names.
Got it!!! Thank you very much..
Vini
|
|
|
|
|
Use EnumProcess!
There are some articles on CP.
A. Riazi
|
|
|
|
|
Hi,
I'm macking a Container application that hosts Activex Controls. I'm trying to provide scripting facility to my application using IActiveScriptSite. How do i expose the interfaces of the ActivexControl (i.e properties and methods) to the Scripting engine. any help would be highly appreciated.
|
|
|
|
|
IActiveScript::AddTypeLib
|
|
|
|
|
I have a class A{ public :CString m_str;}
static int func()not in the class. How can I acess m_str in this function func()
|
|
|
|