|
Dear All,
My requirement is to change the bitmap of the button on mouse move and mouse over. I have used TrackMouse event to do this. But I have problem in this, that is, when I place a mouse over the button the bitmap is changed and again when I take mouse over the button the bitmap is again changed. This looks bad due to painting and re-painting continously. Please advice me a good way. The code is below :
void Test::OnMouseMove(UINT nFlags, CPoint point)
{
TRACKMOUSEEVENT trackmouseevent;
if(!click2)
{
trackmouseevent.cbSize = sizeof(trackmouseevent);
trackmouseevent.dwFlags = TME_LEAVE;
trackmouseevent.hwndTrack = GetSafeHwnd();
trackmouseevent.dwHoverTime = HOVER_DEFAULT;
_TrackMouseEvent(&trackmouseevent);
}
GetDlgItem (IDC_BUTTON3)->GetWindowRect (&rect);
ScreenToClient (&rect);
if ((!rect.PtInRect(point)))
{
bool val=but2.LoadBitmaps(IDB_BITMAP23,0,IDB_BITMAP23,0);
but2.Invalidate();
but2.UpdateWindow();
}
GetDlgItem (IDC_BUTTON2)->GetWindowRect (&rect);
ScreenToClient (&rect);
if ((!rect.PtInRect(point)))
{
bool val=input.LoadBitmaps(IDB_BITMAP22,0,IDB_BITMAP22,0);
input.Invalidate();
input.UpdateWindow();
}
CDialog::OnMouseMove(nFlags, point);
}
LONG Test::OnMouseLeave(WPARAM , LPARAM)
{
POINT point;
GetCursorPos(&point);
ScreenToClient(&point);
CRect rect;
GetDlgItem (IDC_BUTTON2)->GetWindowRect (&rect);
ScreenToClient (&rect);
if (rect.PtInRect(point))
{
bool val=input.LoadBitmaps(IDB_BITMAP57,0,IDB_BITMAP57,0);
input.Invalidate();
input.UpdateWindow();
click2=false;
}
GetDlgItem (IDC_BUTTON3)->GetWindowRect (&rect);
ScreenToClient (&rect);
if (rect.PtInRect(point))
{
bool val=but2.LoadBitmaps(IDB_BITMAP58,0,IDB_BITMAP58,0);
but2.Invalidate();
but2.UpdateWindow();
click2=false;
}
|
|
|
|
|
Unless I'm mistaken, you're reloading the button's bitmap each and every time the mouse sends a move event. Why don't you only draw the bitmap when it changes?
You could either keep a track of the mouse position last move, and compare the last pos to the current pos, to see if the mouseOver status has changed for either button.
Or, you simply could add some flags to hold the current mouseOver status of each button. Comparing the current status with the last to determine if the bitmap needs to be changed to reflect the mouse position.
|
|
|
|
|
Hi
I am creating plugin for VS2005 in which i want to handle the Click event of Window->New Vertical Tab. i.e. Whenever user click on plugin icon, "New Vertical Tab's events should call. So Is there any API for handling above events.
Regards
aaa
|
|
|
|
|
HI,
in CString Find Function can i use variable insted of fixed text.
Just for example .
CString str = _T("ABCD edbd CDE ~");
int nPosition = str.Find("~",0);
instead of passing " ~ " can i use any varible ?
Just like this CString EndDelimeter = _T("~");
int nPosition = str.Find(EndDelimeter ,0);
Because user can change any special charecter as End delimeter.
Plz advice me
Preethi
|
|
|
|
|
Hi,prithi
U can use Replace() function of CString Class.
|
|
|
|
|
hi Atul,
I dont want to Replace The string , I just want to find the Special character position.
|
|
|
|
|
Yes, you can use any text variable with the CString::Find() method. Are you not able to do something? What do you need advice with?
|
|
|
|
|
Thank u , Iam able to do that now. while i run first time i got errors. Sorry to disturb u .
|
|
|
|
|
I am creating object for CStatic, but I am not able to set the Text for that CStatic control through another function of ButtonClicked.
I am getting an error as :
Unhandled exception at 0x7c2399ba (mfc71d.dll) in hit.exe: 0xC0000005: Access violation reading location 0x000042ba.
In short I am getting Access violation error.
Please reply.
|
|
|
|
|
Member 4370385 wrote: I am creating object for CStatic
How did you do that ?
|
|
|
|
|
Member 4370385 wrote: ...but I am not able to set the Text for that CStatic control...
How are you doing this?
Member 4370385 wrote: In short I am getting Access violation error.
Have you used the debugger to step through the code to find out where the access violation is happening?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Member 4370385 wrote: Please reply.
Done.
BTW no code => no help.
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
[My articles]
|
|
|
|
|
Hi ,
Current we have #import "msxml.dll" named_guids raw_interfaces_only. This was working in Windows-2003. Now our current OS is Vista. We are getting a compilation error like Cannot open type library file: 'msxml.dll': No such file or directory. I know that msxml.dll is deprecated in vista. But what could be the alternative . I tried replaceing msxml3 in above statement but I getting error C2653: 'MSXML' : is not a class or namespace name
|
|
|
|
|
Possibly msxml3.dll doesn't define such a namespace. And you have to adapt your code to use the MSXML2 one.
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
[My articles]
|
|
|
|
|
Hi All,
I am trying to use the Date Time picker with the CDateTimeCtrl but seem to be having some difficulties.
I have added a Date Time Picker to my dialog box, used the microsoft ClassWizard to add a CDateTimeCtrl for the Date Time Picker but nothing seems to work correctly.
I have copied the code below.
I am getting the correct time information in 'Release' mode, but the same is crashing (Debug assertion failure)
in 'Debug' mode.
Pls tell me how to make this code works in 'Debug' mode ???
CDateTimeCtrl m_StartTimeCtrl;
BOOL CLicenseGeneratorDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CTime time = CTime::GetCurrentTime();
m_StartTimeCtrl.SetTime(&time);
}
void CLicenseGeneratorDlg::OnOK()
{
UpdateData(true);
CTime time1;
if (GDT_VALID == m_StartTimeCtrl.GetTime(time1))
{
CString strDate = time1.Format("%d.%m.%Y");
MessageBox(strDate);
}
}
Regards,
Sanjeeva K Kanakam.
|
|
|
|
|
How did you create the date/time control ?
|
|
|
|
|
I placed the DateTimeCtrl on the dialog box.
|
|
|
|
|
Sanjay K wrote: ...the same is crashing (Debug assertion failure)
in 'Debug' mode.
When does this "crash" occur? What line of what file is asserting?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
HI all,
How can remove this error?
fatal error C1093: API call 'ImportFile' failed '0x80070003' : ErrorMessage: The system cannot find the path specified.
What can do?
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: What can do?
Provide the correct path, perhaps.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hi I have done a Client Server Program using MPI. While calling one of the API MPI_Open_port() in server side iam getting an error "Fatal error in MPI_Open_port: Other MPI error".. Can any body tell why this happens and solution for that.. Iam attaching the code snippet for that
#include <mpi.h>
#include <string.h>
#include <stdio.h>
#include <windows.h>
#include <iostream.h>
#pragma comment( lib, "msmpi.lib" )
int main( int argc, char* argv[] )
{
MPI_Status Status;
char Buffer;
char Message;
int NumProcess, Rank;
int SendRecStatus;
char myport[MPI_MAX_PORT_NAME]={0};
MPI_Request Request;
MPI_Comm intercomm;
// Initialize the MPI execution environment
MPI_Init( &argc, &argv );
// Determines the size of the group associated with a communicator
MPI_Comm_size( MPI_COMM_WORLD, &NumProcess );
// Determines the rank of the calling process in the communicator
MPI_Open_port(MPI_INFO_NULL, myport);
printf("port name is: %s\n", myport);
MPI_Comm_accept( "10.1.27.64:3210", MPI_INFO_NULL, 0, MPI_COMM_WORLD, &intercomm);
printf("client connected\n");
MPI_Recv( &Message, 5, MPI_CHAR, MPI_ANY_SOURCE, MPI_ANY_TAG, intercomm, &Status);
cout<<Message;
MPI_Comm_free(&intercomm);
MPI_Close_port("10.1.27.64");
// Terminates MPI execution environment
SendRecStatus = MPI_Finalize();
return 0;
}
Thanks
|
|
|
|
|
It could be a bug. It depends on the position that GDI+ initializes.
Based on experience, initilize GDI+ after LoadFrame seems ok.
Still not know why.
=========================
By deleting ddeexec in the register, no error.
Or else, it'll reports an error when open a file by double clicking it, said "Windows cannot find 'somefile path'...". However, the file is opened correctly, and the error message seems senseless.
If I drag the data file onto the app file, it's all right, no such an error message.
I also use GetCommandLine to check the command line in both cases above, they are the same.
It seems the problem of the explore.
How to make it correct?
system
modified on Thursday, July 24, 2008 3:51 AM
|
|
|
|
|
Hi!
I've developed a VC++ project. In this project I've displayed a message to the console Window ising the folowing code:
LOG_INFO("The Character is collided with something");
The application closes without any notice. I've to see whether this message is dsiplayed to the console window or not. I've tried this with the following codes:
(i)
LOG_INFO("The Character is collided with something");
system("PAUSE");
(ii)
printf("The Character is collided with something");
getchar();
Both of these codes didn't work. How do I check whether the message is displayed to the console window before the application closes?
|
|
|
|
|
T.RATHA KRISHNAN wrote: The application closes without any notice.
If the application crashes, nothing will be able to show the console window (your code won't be executed because your application crashed). Instead, try to debug your application using the debugger, it is much more powerfull than what you could print in the console.
|
|
|
|