|
I have an SDI project which has a dialog. I want to write the code for one of the buttons (MyButton) in the dialog in CMyProjectDoc class. I can create the function by going to classwizard then selecting the CMyProjectDoc class and then MyButton BN_Click. And clearly I have a function for the button in CMyProjectDoc class (see below).
void CMyProjectDoc::OnMyButton() <br />
{<br />
COtherDlg dlg;<br />
dlg.DoModal();<br />
}
However, there is no communication apparent between the button and the function. That is, I click the button and nothing happens. Does anyone know why?
Thanks,
Ruben
|
|
|
|
|
Hi Ruben,
I have a few question
1. Why you need to Create DialogBox in Document Class?
Its always advice to separate Document and view (or
dialog) classes. You Can Move that code to CMainFrm class
or CMyProjectView Class.
2. How did you create OnMyButton function in CMyProjectDoc Class
using class wizard?. I think you can't assign Dialog box button event
to document Class.
Thanks,
Uma Mahes
|
|
|
|
|
one possible reason is that you have a handler for the same button in your view class.
|
|
|
|
|
Hello,
I'm struggling with the following problem; at my job here, we use a database of texts for easy translation in our apps. Inside the source, we put IDs, which look like this:
CString tmp = pLang->String(1005);
for instance. Now, this is impossible to read and inconvenient when editing someone else's source. My idea was to create something that would show a tooltip with the actual text when moving the cursor over the ID.
I tried to build a hook working with EM_CHARFROMPOS, EM_LINELENGTH and EM_GETLINE, to then feed it to a regexp and filter out the IDs. Problem is, the VC++ 6 source editbox reacts to none of these messages. I tried WM_GETTEXT, also no go.
My next try will be to create an actual VC++ 6 addin, but I have NO idea where to start. And before I spend another few hours for nothing, I would first like to know if it's even POSSIBLE to create an addin that would generate a tooltip on mouseover.
If anyone has an idea, I'd be glad to hear it.
Thanks,
- Fahr
|
|
|
|
|
I just installed SP5 for Visual Studio 6.0 and I still get a "Can not save file. File may be in use by another application." error almost every time I try to save the file, or when I compile the project. For instance, I modify a source file in the project. I save it. I save it again and I get the error. I save a 3rd time okay, 4th I get the error.
I'm running XP Pro on a Gateway laptop 512MB ram, and 10GB HD space remaining.
Signed,
Trying to save face_h
|
|
|
|
|
I'm sure like hell you have Norton Anti-virus installed on your machine, and you are using Win2000 or WinXP, am I right?
There are some severe conflicts between Norton anti-virus and VC++ 6.0 on Win2000/Xp, what happened to you is nothing, usually it could be much worse: your C++ files could be deleted by norton anti-virus from time to time with no valid reason, and there is no way to get back those deleted files. Be very careful, I would suggest you to stay away from Norton anti-virus if you are using VC++ 6.0 on Win2000/Xp.
So you have been warned.
|
|
|
|
|
I do have norton antivirus and this happens to me several times a day. Just hit the save button again and all is well.
John
|
|
|
|
|
Hi Bengi
Today I have gone through your article "Using TreeControl (TreeView) under Win32 API". It's a good article. But did you ever notice NM_RDBLCLK message ?
If you double click ( right mouse button ) on any item windows never send NM_RDBLCLK message. Windows sends all other message but not NM_RDBLCLK. This happens only for treeview control not for others. I have tested on NT4.
I think this is a microsoft bug. Also don't know any workaround. Do you have any idea ?
Thanks
Partha Kr. Chakraborti
|
|
|
|
|
According to MSDN (a great source for answers to these types of questions) a tree control does not send NM_RDBLCLK notifications. An easy work around is to write your own subclassed tree control and handle the WM_RBUTTONDBLCLK message and get it to send an NM_RDBLCLK notification yourself.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks for the reply.
But I can't find this info in MSDN. I have searched "www.msdn.microsoft.com". Could you pls send me the url.
Thanks
|
|
|
|
|
Hello,
I have a dialog based application and I have a custom control on it. I want to draw things in the custom control but outside of the OnPaint() function, something like:
void SomeFunc()<br />
{<br />
CPaintDC dc(this);<br />
.....<br />
......<br />
}
But this doesn't work. SO I think I've forgotten something but what ?? Any idea ?
Thanks
|
|
|
|
|
Ooops, sorry, I've forgotten to tell that the function is a member of my custom control class (of course )!
|
|
|
|
|
All drawing has to be done in OnPaint(). Any drawing done anywhere else will be erased whenever OnPaint() is called.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Yes I know, but let me explain my problem:
this custom control is in fact a 2D chart control. And I want to plot lines in it in a real-time mode (a point is plotted every 13 msec, so that's really fast). So, I don't want to redraw the complete control every time I add a point. In the OnPaint function, I draw the background (axes and grid) and I have a function (AddPoint), that draw directly on the screen with a transparent background everytime I receive a new point. The OnEraseBkgnd function has been overidden also: it does nothing.
So, OnPaint is just called when the control needs to be redrawn and in this function, I redraw also the complete lines. But this function is normally called only once at start and when, for example, a part of the control has been hidden by another window.
So, if I draw in the AddPoint function, why isn't it working? Is there a call to the OnPaint function ???
Thanks
|
|
|
|
|
cedric moonen wrote:
Is there a call to the OnPaint function ???
Add a line MessageBeep(1); at the start of OnPaint() and you will get a beep every time OnPaint() is called.
I took a closer look at your problem, and I believe it stems from your using CPaintDC. You should be using CClientDC instead. CPaintDC should only be used in OnPaint().
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks a lot !!
That works fine with CClientDC
This solves a lot of problems !
|
|
|
|
|
Glad I could help
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
i derived a dialog class named "CDlgBase" from CDialog,and then derived a
dialog class named "CDlgLogon" from "CDlgBase".
When i use the following to show CDlgLogon,the dialog showed on the screen is
CDlgBase instead of CDlgLogon. What' wrong with the code?
.....
CDlgLogon dlg;
dlg.DoModal();
.....
gucy
|
|
|
|
|
in the CDlgLogon class constructor, are you passing the dialog template ID to the CDlgBase class constructor so that it can pass it on to CDialog? I think not!
CDlgBase::CDlgBase (UINT IDD, CWnd* pParent)
: CDialog (IDD, pParent)
{
...
}
CDlgLogon::CDlgLogon(CWnd* pParent)
: CDlgBase(CDlgLogon::IDD, pParent)
{
...
}
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
yes.i does not.
and thanks a lot!
gucy
|
|
|
|
|
You are greate! This is commom error for beiginners
|
|
|
|
|
Hi,
In a dialog-based application, i have a menu, a toolbar and also in order to accelerate the process i make some keyboard functions by using PreTranslateMessage. I used the Keys from F2 to F12.
The keys worked just fine except for the F10.
I note that when the key F10 is pushied the menu also show push a little at the top-left menu title, but it don't implement my expected command.
Here is the PreTrans function i used.
BOOL CEfmraDlg::PreTranslateMessage(MSG* pMsg)
{
switch(pMsg->message)
{
if(pMsg->hwnd = m_ListBox.m_hWnd)
{
case WM_KEYDOWN:
{
switch((WORD)pMsg->wParam)
{
case 'n':
case 'N':
{
m_updown = 1;
m_spinValue.SetPos(m_spinValue.GetPos()+1);
return TRUE;
}
case 'p':
case 'P':
{
if(m_secNum <= 0)
return FALSE;
else{
m_updown = 0;
m_spinValue.SetPos(m_spinValue.GetPos()-1);
return TRUE;
}
}
case VK_F2:
{
OnEfmLamp();
return TRUE;
}
case VK_F3:
{
OnEfmRead();
return TRUE;
}
case VK_F4:
{
OnEfmAbort();
return TRUE;
}
case VK_F5:
{
OnTocInfoFile();
return TRUE;
}
case VK_F6:
{
OnTocInfoCD();
return TRUE;
}
case VK_F7:
{
OnEfmCode();
return TRUE;
}
case VK_F8:
{
OnBinaryCode();
return TRUE;
}
case VK_F9:
{
OnBlock();
return TRUE;
}
case VK_F10:
{
OnSubQ();
return TRUE;
}
case VK_F11:
{
OnSubCode();
return TRUE;
}
case VK_F12:
{
OnSubRW();
return TRUE;
}
default : break;
}
break;
}
}
}
return CResizableDialog::PreTranslateMessage(pMsg);
}
How to deal eith this?
Thanks in advance!
chen
|
|
|
|
|
I think you must try to handle a F10 key in WindowProc procedure instead PreTranslateMessage
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Try handling F10 Message in WM_SYSKEYDOWN.
Please refer MSDN WM_SYSKEYDOWN help.
Regards,
Uma Mahes
|
|
|
|
|
Hi,
Thanks a lot!
It worked by using WM_SYSKEYDOWN.
chen
|
|
|
|