|
Thanks for help, I post two messages one at the beginning of thread and one when all the work is done. My 'PreTranslateMessage' loks like this:
BOOL CUsageAccView::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if(pMsg->message == WMU_WORK_START)<br />
{<br />
::SetCursor(LoadCursor(NULL,IDC_WAIT));<br />
}<br />
else if(pMsg->message == WMU_WORK_END)<br />
{<br />
::SetCursor(LoadCursor(NULL,IDC_ARROW));<br />
}<br />
return cdxCDynamicFormView::PreTranslateMessage(pMsg);<br />
}<br />
This works fine if I don't move mouse, but when I do cursor restores it self!
Why?
|
|
|
|
|
From MSDN , SetCursor reference
If your application must set the cursor while it is in a window, make sure the class cursor for the specified window's class is set to NULL. If the class cursor is not NULL, the system restores the class cursor each time the mouse is moved.
you may also change the class cursor of your window:
SetClassLong( hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Another thanks man!
Where do you suppose I include this line of code, in 'OnInitialUpdate' of my view?
Thanks.
P.S.
I included this line:
SetClassLong( this->m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
at my view-s OnInitialUpdata and still no change, my cursor still reset from hourglass to arrow when I move the mouse!
modified on Tuesday, March 18, 2008 12:08 PM
|
|
|
|
|
josip cagalj wrote: Where do you suppose I include this line of code, in 'OnInitialUpdate' of my view?
Thanks.
Nope. You need to change your SetCursor(... lines with corrensponding SetClassLong(... ones.
Good luck.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi
i have one c++ source code.This code was good compiling in windows XP (The output of the code was return value '0')
and then i was changed into windows Vista its also compiling but it gives the return value '255'..
i am using the compiler visual studio 2005
i dont know not much of idea this problem ...
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
What function returns you '0' or '255'?
Maxwell Chen
|
|
|
|
|
Thanks to your replay ...
HRESULT datatype function retun in 0 (in XP) and 255(in vista)
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
You have two different options:
1. Hard-code your function to return 0 always.
(or)
2. Let us know what is the 'function' that you are talking about, why should it return 0 and not 255, show us any relevent piece of code, why would you still want to continue programming, etc.,
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi this is my sample code .
STDMETHODIMP CFileIO::VerifyUser(SAFEARRAY* userCredential, SAFEARRAY* appCredential, BYTE* result)<br />
{<br />
*result = (BYTE)false;
try<br />
{<br />
validateCredential(appCredential);<br />
validateUser(userCredential);
*result = (BYTE)true;<br />
}<br />
catch (std::exception& e)<br />
{<br />
log("Verify User", e.what(), EVENTLOG_ERROR_TYPE);<br />
}<br />
return S_OK;<br />
}
#define S_OK ((HRESULT)0x00000000L)//winerror.h
#define S_FALSE ((HRESULT)0x00000001L)//winerror.h
return S_OK ;
return S_FALSE;
this is perfectly running in windows XP and it gives return value '0'but in vista it running good but it gives the retun value 255.
whats the problem about that?
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
rowdy_vc++ wrote: whats the problem about that?
The problem is that you are not showing what function is returning 255. VerifyUser() returns either 0 or 1.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Actually in Windows Xp in this source code successfully compiled with return value '0'.But in vista its successfully compiled but it gives return value '255'.This is the problem.
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
Actually in Windows Xp in this source code successfully compiled with return value '0'.But in vista its successfully compiled but it gives return value '255'.This is the problem.
how to solve it
*****THANKS N ADVANCE****
Mathen.K
(I WILL TRY MY LEVEL BEST )
|
|
|
|
|
rowdy_vc++ wrote: This is the problem.
Indeed, since you have not shown any code that returns a value of 255.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
1. I have created a MFC single dialog based project
2. I have inserted Microsoft WebBrowser Control Activex
3. I am now able to open any web pages
But i can't suppress the javascript error. I have seen after inserting this activex control it has created a class CEXplorer1.
On VB i can set a property name suppressScript error but i can't find any property when i am using VC++ and MFC.
I am using visual studio 2005in windows XP with service pack 2 and have internet explorer 6.0
I have seen some tutorial they are saying i have to implement IOLECOMMANDTARGET::EXEC()
i want some simple solution if possible.
|
|
|
|
|
|
Hi,
I would like to use the RAS implementation in Win XP to make a dial up to my ISP and to establish the PPP link between my laptop and PDA phone.
I cannot use RASDial as the phone is not recognized by Win XP as a hardware connected even though the 2 devices are linked using Bluetooth.
I read that using RasCustomScriptExecute allows me to dial out through a specific com port. I would like to seek for assistance on some samples to get me started, as the MSDN examples are not enough for my understanding.
Thanks and regards,
PS
|
|
|
|
|
Hi,
Anyone know whether Open button in a MS office Open file dialog is a "BUTTON" or not. Why the spy++ is also not identifying it as a window? . And if it is a button it implements all button messages such as BN_CLICK etc.
thanks
Nitheesh
|
|
|
|
|
Hi,
I have a function in which I am passing to a character pointer (char *) by reference e.g. make_num(char *& str)
the first data variable I declare in my Function is a 255 byte character array e.g. char hold_area[255}
So my my code looks like this
Make_num(char *& str)
{
char hold_area[255]
When I refrence the address of the begining of thiis area e.g. &hold_area[0] it seems to be off by 4 bytes meaning when I look at the actual address in code hold_area[0 - 3] has some value maybe a pointer where my actual data starts in hold_area[4] ???
I prototype make_num( char *&); ???
A compiler glitch ???
thankx
|
|
|
|
|
ForNow wrote: Make_num(char *& str)
{
char hold_area[255]
How do you copy str to hold_area ?
Maxwell Chen
|
|
|
|
|
Its a = assignment e,g,
if ((char *) dtr >= 0x30 || (char) *str <= 0x39)
hold_area[i] = (char) *str
Hey just had a thought when I looked at the assembly code this data was referenced by the ESP reg
If I am calling by reference then there is no need to push to variable on the stack
maybe I should declare make_num with stdcall (I think ??) I am going to have to test this out
thankx
|
|
|
|
|
ForNow wrote: if ((char *) dtr >= 0x30 || (char) *str <= 0x39)
with bad casts like that, I wouldn't be surprised if a pointer gets
written to your char array
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Something must of happened when I cut and paste the code as I missed to * beforte str
However here is my code
{
if((char) *str >= 0x30 || (char) *str <= 39)
{
holdstr[i] = (char) *str;
i++;
}
}
holdstr[i] = NULL;
number = atoi((const char *)&holdstr[0]);
Is there any special calling method I need when calling by reference e.g stdcall/fastcall as it seems that the ESP reg is not pointing to where it should on entry
Thankx
|
|
|
|
|
hmmm....I'm not sure why you are expecting a certain esp value.
If there was a compiler bug with this, then I bet millions of apps
would be affected, and I, for one, couldn't trust local character arrays at all.
The implementor of the compiler is free to use the stack (or whatever other memory it wants to use)
for local variables in any way, as long as when we use the proper C++ syntax, we get access to the data
in a way the C++ specification states we should.
That aside, do you have a complete function example you can post along with
what you're seeing and what you're expecting to see with the esp register?
I'd be happy to look at it
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This only happens... the bug in my release version of the the DLL when I run my debug thru VS its fine
Just so I understand the ESP or Stack pointer points to the Top of the Stack which has the paramters
to the functions afterwards are the Local Varibles of the Function
Global Variables are pointed to by the data segment register
(I am a Mainframe Assembler programmer by trade) knowing Assebmler or X6 Masm I guess helps especially when
There is a bug only in release version of the app as that seems to be the only way to see the values of the
Variables
Below is the Function.... This the fuction definition --> int make_num(char *&);
int make_num(char *& str)
{
char holdstr[255]; // allocate a large buffer
int i =0, number;
for (; *str != ','; str++)
{
if((char) *str >= 0x30 || (char) *str <= 39)
{
holdstr[i] = (char) *str;
i++;
}
}
holdstr[i] = NULL;
number = atoi((const char *)&holdstr[0]);
return number;
}
Thanks much
|
|
|
|
|
---> holdstr[i] = NULL; This is the culprit how come this statement didn't generate any MASM instructions ??
number = atoi((const char *)&holdstr[0]);
0037147D lea eax,[esp+4]
00371481 push eax
00371482 mov byte ptr [esp+esi+8],0
00371487 call dword ptr [__imp__atoi (37204Ch)]
|
|
|
|