|
Hi,
I have a program to debug a proprietary mapping language. The window contains a CToolBar that will generate tooltips. When the program runs, it stops at each mapping command, waiting for the user to press all kinds of keys. During this, I have the messages processed using the following code:
while (m_bLoop)
{
WaitMessage ();
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
if (!PreTranslateMessage (&msg))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
}
During this message pump, everything works just fine (keys, menus, sizing or moving the window, etc), except that the tooltips on the toolbar don't show. When the program ends, and hence reverts to the standard message pump, the tooltips will show again.
Does anyone have an explanation for this?
Thanks in advance for any help
William Engberts
|
|
|
|
|
If you overrode PreTranslateMessage, did you call the base class PreTranslateMessage or not? Since it relies upon calling
AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
if (pModuleState->m_pfnFilterToolTipMessage != NULL)
(*pModuleState->m_pfnFilterToolTipMessage)(pMsg, this);
to get the tooltips processed.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Thanks for the remark. I do indeed override the PreTranslateMessage, but I also do include a call to the base class version:
BOOL CView32Dlg::PreTranslateMessage(MSG* pMsg)
{
BOOL r = TRUE;
if ( m_hAccel == NULL
|| !TranslateAccelerator(this->m_hWnd, m_hAccel, pMsg))
r = CDialog::PreTranslateMessage(pMsg);
return r;
}
As a test, I have also already tried to only call the base class PreTranslateMessage (so ignoring the accelerators):
BOOL CView32Dlg::PreTranslateMessage(MSG* pMsg)
{
BOOL r = TRUE;
// if ( m_hAccel == NULL
// || !TranslateAccelerator(this->m_hWnd, m_hAccel, pMsg))
r = CDialog::PreTranslateMessage(pMsg);
return r;
}
This indeed resulted in my accelerators not functioning, but I still did not get any tooltips (of course, only until my mainloop ended and the program falls back into the Microsoft message pump, wherever that may be)
Thanks
|
|
|
|
|
One idea, then might be to call this from your own PreTranslateMessage
void CWnd::FilterToolTipMessage(MSG* pMsg)
and if the tooltips don't appear, then maybe they are disabled.
You can try calling
BOOL CWnd::EnableToolTips(BOOL bEnable)
to make sure tooltps are activated for your window.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
I am facing few compilation errors,while importing Adobe Acrobat SDK 7.0 into VC++ 5.0 from Adobe Acrobat SDK 4.0 such as 1.Due to ENDHEADER and STARTFOOTER (
2. #error 64-bit integer type not supported (COREEXPT.h)
3. Warning: Using older Acrobat SDK. Define ACRO_SDK_LEVEL to 0x00070000 (ASExpT.h)
Any solution?
|
|
|
|
|
HI,
Using CFile i have created a file and write the data in it also using modeNoTruncte flag., Now when again the control come to that code , if the file already exist there then i want to write the data in that file from start and there should be no previous data in the file
Regards.
|
|
|
|
|
Then don't use the modeNoTruncate flag. Use only the modeCreate flag.
|
|
|
|
|
In first iteration of filw writing I have to right data gain that on line each in each inner loop .
While 2nd iteration of outer lop i have to write data from scratch in the inner loop
Regards.
|
|
|
|
|
Hi
I know my answer is a stupid one... but still
You want to write again from beginning. its equal to close the previous handle. Open is any other mode that delete the file and create it. then close again.( this is equal to close the handle and delete the file). then open in notruncate mode again.
souds funny I know. I will try to find out better options...
|
|
|
|
|
Hi,
Another option would be to set the filecursor back to the beginning using CFile::SeekToBegin (); and then emptying the file by CFile::SetLength (0);
Regards
William Engberts
|
|
|
|
|
Yes your one is a better solution.
I have no idea about SetLenght funtion.
Thanks
|
|
|
|
|
In continuation with Cedric.. combined CFile::modeWrite with CFile::modeCreate too
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Can anyone tell me the api needed to check if there is connection with the network(that is if the connection is maintained or disconnected) ?
dont want,dont want thinking,climbing on head and jumping grass!
(venda venda ennu vicharikumbol thellayill keyaree chadunnoda pulle!)
|
|
|
|
|
got it!....thanx!!!!!
dont want,dont want thinking,climbing on head and jumping grass!
(venda venda ennu vicharikumbol thellayill keyaree chadunnoda pulle!)
|
|
|
|
|
namaskaaram wrote: got it!....thanx!!!!!
iSensLogin!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi!!
I m working on an mfc sdi application.
I hav a dialog in which , i have "SHOW FILE" button. On it`s click event, i want to show the file on the same dialog. But, before clicking the "SHOW FILE" button, i want a small dialog only. Now, I hav two problems:
1. In which control, should I display(show) the file to the user?
2. How to set the dialog size at run time?
Thanx a lot
"If you change then change for the good."
|
|
|
|
|
ABout your first question which type of file do you want to display? image file, text file, HTML file....
for changing the dialog box size...
MoveWindow()
SetWindowPos()
...
|
|
|
|
|
Hello!!
I want to display text file.
Thanx a lot
"If you change then change for the good."
|
|
|
|
|
Hello
For Text File you can use CEdit Control with Multiline option set.
Or if your file size is large and you want some extra thigs to display like changing the colour of text ...
you car use RichEditControl.
Regards
Anil
|
|
|
|
|
Hi ,
I want to display vertical text in a CStatic text box which has the word wrap facility.
can anyone help me with an example.
Thanks,
Gayathri
|
|
|
|
|
Hi
Try to find out at this site...
http://www.codeguru.com/Cpp/controls/staticctrl/article.php/c2927/
Regards
Anil
|
|
|
|
|
Hello Friends,
Can any one tell where I can find the study materials (on the internet) for function pointer in C and C++ ?
How function pointer are used in the implementation of callback function in c and c++?
Where I can complete details of function pointer on the internet(where I can freely download demo codes for function pointers in c OR CPP).
I would be gratefull if anybody can help me in this matter
From
Philip.
-- modified at 4:26 Monday 6th February, 2006
|
|
|
|
|
|
why don't you ask here particuliar questions about function pointers ?
there are definitely several C/C++ experts which can help much than reading lines on the internet...
for demos also, there are plenty of examples on CodeProject too...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|