kinos83

Hello:

I am programming an application using C++, Mfc and dialog-based. Every 5 seconds, this app makes some operation which I would like them to be invisible for the user, but automatically a Wait Cursor (The colourfull wheel, like the hourglass cursor) appears.

I dont want this wait cursor to appear. How can I manage to avoid it I have tried overrinding DoWaitCursor(), but I haven't been able yet.

Thanks in advance, any help would be helpful.


Re: Smart Devices Native C++ Development Hide wait cursor wm2003 mfc dialog-based app

Zero Dai - MSFT

Hi kinos,

If you use CeRunAppAtTime to launch your application every 5 seconds and want to hide the wait cursor when loading, you can add the code as following:

Code Snippet
CMFCSPDemoApp::CMFCSPDemoApp()
: CWinApp()
{
AfxGetApp()->DoWaitCursor(-1);
}

Or you can override the virtual function DoWaitCursor() with empty implementation.

If your application will be alive during the operations, you can add the following code in your callback funcion:

Code Snippet

AfxGetApp()->DoWaitCursor(-1);

// do some more lengthy processing

Regards,

Zero Dai - MSFT






Re: Smart Devices Native C++ Development Hide wait cursor wm2003 mfc dialog-based app

kinos83

Hello:

Its me again. Thank you very much for your quick answer. However, I tried using both methods mentioned, but nothing worked.

I will explain my problem again: mine is a multiple-thread application. While a thread is "visible" to the user, another, which is just a timer, has to make some operations. Then, the hourglass is automatically displayed. It is not my application who does it, there is no instruction of BeginWaitCursor() or DoWaitCursor(1), or CWaitCursor object declaration, and I don`t want this hourglass to be displayed.

I tried calling AfxGetApp()->DoWaitCursor(-1); in the thread of the timer, also in the implementation of DoWaitCursor using CWinApp:: DoWaitCursor(-1); and also in the constructor, as you mentioned. Nothing worked either.

Can you make me any other suggestion Thank you very much in advance!

Marcos Sacristan





Re: Smart Devices Native C++ Development Hide wait cursor wm2003 mfc dialog-based app

kinos83

Sorry, I wanted to add that I am programming a PDA,hp 6515, Windows Mobile 2003. Thank you very much in advance.




Re: Smart Devices Native C++ Development Hide wait cursor wm2003 mfc dialog-based app

Zero Dai - MSFT

Hi kinos,

If possible, could you please tell me what operation you do in this timer callback function Are you trying to call another application to do some tasks Could you please attatch some code snippet here

Thanks,

Zero Dai - MSFT






Re: Smart Devices Native C++ Development Hide wait cursor wm2003 mfc dialog-based app

kinos83

Hello:

Well, the code in the OnTimer function is quite long, but I can post some important operation. I am not calling any other application in that code, just a new thread, for example. I post here "special operations" which take place in that code section, to summarize:

Code Snippet

...

if ( !leyendo_info_gps ) {

hilo_GPS = AfxBeginThread(StaticLecturaGPS,this);

}

::PostMessage(HWND_BROADCAST,UWM_MATAR_MENSAJES,0,0);

...

KillTimer(1);

SetTimer(1,periodo_timer,NULL);

...

send(s_cliente,mensaje,strlen(mensaje),0);

...

There are also some Sleep() operation, but not too long.

Another thing I have observed: I have put a MessageBox into the DoWaitCursor() function which I have overridden and it is never done. I mean, it is not in the function when the hourglass is displayed. The way I have declared this function was:

Code Snippet
void
CNameApp:: DoWaitCursor(int nCode);

Is this correct

Thank you very much again.





Re: Smart Devices Native C++ Development Hide wait cursor wm2003 mfc dialog-based app

kinos83

Sorry, the way I declare the DoWaitCursor() function was not correct in the previous post.

In the NameApp.h:

Code Snippet

void DoWaitCursor(int nCode) ;

And then in the NameApp.cpp:

Code Snippet

void CHolaMundo2App::DoWaitCursor(int nCode) {

}

Than you.





Re: Smart Devices Native C++ Development Hide wait cursor wm2003 mfc dialog-based app

kinos83

Hi:

Its me again. I have located where the hourglass is displayed: I am accessing the GPS port of the PDA (hp 6515) using a serial port communication, which can be accessed using a CreateFile instruction. It is during this CreateFile operation that the hourglass is displayed.

My code is as follow:

manejador_comm = CreateFile(TEXT("COM7:"), GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);

Is there any way of avoiding this hourglass appearance

Thanks in advance.