|
Ok, I reviewed the implemention of Instance(), and I'm still having trouble.
interface:
class S {
public:
static S* Instance();
protected:
S();
private:
static S* _instance;
};
implementation:
S* S::_instance = 0;
S* S::Instance(){
if (_instance==0){
_instance = new S;
}
return _instance;
}
Am I using the static member function wrong?
Thanks.
|
|
|
|
|
Have you *defined* the constructor (not merely declared it)?
|
|
|
|
|
Thanks. That did it. I will try to refrain from posting completely idiotic questions here in the future, if at all possible.
|
|
|
|
|
We need more accurate information - the linker won't give you errors about protected members; only the compiler can do that.
I looked at your code and it seems fine.
|
|
|
|
|
Hi,
I'm pretty new to VC++.
I've got an MFC dialog app, and have a system tray icon. I'm trying to capture when a user clicks on it, but I'm struggling to actually find the info i need in the documentation.
When fillinh out my NOTIFYICONDATA struct, I'm seting
m_SysTrayIcon.uCallbackMessage=WM_SYSTRAY;
where WM_SYSTRAY is defined as WM_USER + 1.
I've used Spy and can see the messages being sent to the dialog window. What I can't work out is the proper way to get MFC to handle this message. I want a sort of OnSysTray() function where i can retrieve the lparam and wparam of the message and do my stuff.
Help please!
Also, currently I'm not bothering removing my icon from the system tray. This is someting that i ought to do, so it goes when the app is closed. Where is the best place to implement this?
Thanks for your help
Jon
|
|
|
|
|
|
Hi,
this might be a real nebiew question but it would be really nice if you could help me a liitle bit out with that.
I have got a Dialog based App where two dialogs are shown at the same time,
I need to know how to change for example the Value of the Statusbar on Form2 at the time a Button on Form1 is clicked. I hope that you can understand what I want to do. Sorry for my bad english.
I hope you can help me.
sign Jakob W.
|
|
|
|
|
Make use of modeless deialog boxes. I believe MSDN has a sample.
Hope that helps
|
|
|
|
|
GREETINGS
Example: In the OnButton event write
dlgForm2.m_text="LOVE & PEACE to everyone";
1) The header of Form2 Dialog must be included.
2) The member of CdlgForm2 must be created:
CdlgForm2 dlgForm2;
3) dlgForm2 must be attached to existing dialog;
Good Luck!
LOVE & PEACE to everyone
LOVE & PEACE to everyone
|
|
|
|
|
thx.
But what do you mean by dlgform2 must be attached to existing dialog?
sign Jakob W.
|
|
|
|
|
GREETINGS
If you have the second dialog created and it is already on the screen, only creating a new member for it is useless. So you need to attach the member to the dialog. But if you have the member that you used to create the dialog, you should use it without any attachments.
For example:
CdlgForm2 dlgForm2;
dlgForm2.DoModal();
dlgForm2 is now attached to Dialog2. There are different ways how to do it.
Good Luck!
LOVE & PEACE to everyone
LOVE & PEACE to everyone
|
|
|
|
|
GREETINGS
If you have the second dialog created and it is already on the screen, only creating a new member for it is useless. So you need to attach the member to the dialog. But if you have the member that you used to create the dialog, you should use it without any attachments.
For example:
CdlgForm2 dlgForm2;
dlgForm2.DoModal();
dlgForm2 is now attached to Dialog2. There are different ways how to do it.
Good Luck!
LOVE & PEACE to everyone
LOVE & PEACE to everyone
|
|
|
|
|
GREETINGS
If you have the second dialog created and it is already on the screen, only creating a new member for it is useless. So you need to attach the member to the dialog. But if you have the member that you used to create the dialog, you should use it without any attachments.
For example:
CdlgForm2 dlgForm2;
dlgForm2.DoModal();
dlgForm2 is now attached to Dialog2. There are different ways how to do it.
Good Luck!
LOVE & PEACE to everyone
LOVE & PEACE to everyone
|
|
|
|
|
GREETINGS
If you have the second dialog created and it is already on the screen, only creating a new member for it is useless. So you need to attach the member to the dialog. But if you have the member that you used to create the dialog, you should use it without any attachments.
For example:
CdlgForm2 dlgForm2;
dlgForm2.DoModal();
dlgForm2 is now attached to Dialog2. There are different ways how to do it.
Good Luck!
LOVE & PEACE to everyone
LOVE & PEACE to everyone
|
|
|
|
|
<small><br />
void CProfessionClsDlg::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
DDX_Control(pDX, IDC_CATEGORIES, m_Categories);
DDX_Control(pDX, IDC_MAKEGROUPCHOICE, m_MakeGroupChoice);<br />
DDX_Control(pDX, IDC_LINKSKILLTODATABASE, m_LinkSkillToDatabase);<br />
...<br />
}<br />
</small>
It seems that I have a problem with the DoDataExchange during the InitDialog procedure. The program will always crash, no matter how I stack the DDX_Control calls, on the very first call. This really doesn't make sense to me why it would be crashing and that it was working only a few days ago. I have other dialogs in the program that function like it and they work fine which makes me believe that the solution is a rather obscure and simple one.
Thanks for the help.
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
You forgot to post the details of the crash - is it an ASSERT? GPF? The monitor explodes and all files on HD are deleted?
Are you sure that control with id == IDC_CATEGORIES is defined in the dialog template?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
<small><br />
HWND CDataExchange::PrepareCtrl(int nIDC)<br />
{<br />
ASSERT(nIDC != 0);<br />
ASSERT(nIDC != -1);
HWND hWndCtrl;<br />
m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);<br />
if (hWndCtrl == NULL)<br />
{<br />
TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);<br />
<big>ASSERT(FALSE); </big> <br />
AfxThrowNotSupportedException();<br />
}<br />
m_hWndLastControl = hWndCtrl;<br />
m_bEditLastControl = FALSE;
ASSERT(hWndCtrl != NULL);
return hWndCtrl;<br />
}<br />
</small>
Actually, it's a bug that causes the dog to eat my homework.
It asserts out on the line I bolded above. I'm going to try and create a new dialog just for kicks and see if that dialog gives me problems.
Thanks for the help.
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
Check nIDC passed to PrepareControl - you may have some #define conflict and symbol that you're using in DDX_Control resolves to number other than used in dialog template resource.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
With a program which has a few DLL projects and one EXE project is it okay to have #define values that are the same between the DLL's and EXE. For example one DLL project has a value for 1000 while another DLL has a value for a 1000, however both are different ID's. Is it wise to make all #defines in
a project different regardless?
Thanks again.
"Why are we hiding from the police, Daddy?"
"We use VI, son. They use Emacs."
|
|
|
|
|
Yes, especially if you plan to create context help someday This also applies to duplicated values mapped to different IDC_xxx inside single DLL or EXE.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
How to develop mailclient application in VC++ which uses pop3 protocol to retrew mails from serverlike MSExchange.
Where i have to create database to usersid and password.
how the application can be done.
Pavan ch.
|
|
|
|
|
How to develop mailclient application in VC++ which uses pop3 protocol to retrew mails from serverlike MSExchange.
Where i have to create database to usersid and password.
how the application can be done.
Pavan ch.
|
|
|
|
|
There's some usefull classes (By PJ Naughter) for playing with POP3 & SMTP :
http://www.codeproject.com/internet/cpop3conn.asp
http://www.codeproject.com/internet/csmtpconn.asp
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com
|
|
|
|
|
How to develop mailclient application in VC++ which uses pop3 protocol to retrew mails from serverlike MSExchange.
Where i have to create database to usersid and password.
how the application can be done.
Pavan ch.
|
|
|
|
|
Hmmm, if I should answer all those questions, I would have to write the program for you.
Search around here at CodeProject, I think there a couple of classes that receives POP3 mail.
If you want to write it yourself, you should start to look at the WinSock functions (which you would use to connect to the mailserver), and then look at the POP3 protocol, so you know what commands to send to the server...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|