Non-modal dialog pParent initialization (and warning C4355)

I have read several posts about "warning C4355: 'this' : used in base
member initializer list", and I understand about the object of 'this'
not being fully initialized, but that it is common 'safe' practice to
use this method to only save a pointer for future use..
OK, my question is;
What is the proper or best way to initialize a non-modal dialog?

I have used two methods:

1.)

CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
   : CDialog(IDD, pParent)
{
   // pParent is not set here, See Create
   pCV=NULL;
}

BOOL CFooDlg::Create(CWnd * pParent)
{
   pCV=(CMyBar *) pParent;
}

2.)

CMyBar::CMyBar(CWnd* pParent /*=NULL*/)
   : CDialog(CMyBar::IDD, pParent),
   CFooDlg( this ) // <---- Warning C4355
{
}

CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
   : CDialog(IDD, pParent)
{
   pCV=(CMyBar *) pParent;
}

But method (2) seems more natural but it gives me warning C4355.
Is there a simpler cleaner way?
TIA,
Harvey

0
harveyab (125)
3/11/2007 3:23:22 AM
vc.mfc 33608 articles. 0 followers. Follow

12 Replies
675 Views

Similar Articles

[PageSpeed] 6

On Mar 10, 7:23 pm, "Harvey" <harve...@juno.com> wrote:
> I have read several posts about "warning C4355: 'this' : used in base
> member initializer list", and I understand about the object of 'this'
> not being fully initialized, but that it is common 'safe' practice to
> use this method to only save a pointer for future use..
> OK, my question is;
> What is the proper or best way to initialize a non-modal dialog?
>
> I have used two methods:
>
> 1.)
>
> CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
>    : CDialog(IDD, pParent)
> {
>    // pParent is not set here, See Create
>    pCV=NULL;
>
> }
>
> BOOL CFooDlg::Create(CWnd * pParent)
> {
>    pCV=(CMyBar *) pParent;
>
> }
>
> 2.)
>
> CMyBar::CMyBar(CWnd* pParent /*=NULL*/)
>    : CDialog(CMyBar::IDD, pParent),
>    CFooDlg( this ) // <---- Warning C4355
> {
>
> }
>
> CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
>    : CDialog(IDD, pParent)
> {
>    pCV=(CMyBar *) pParent;
>
> }
>
> But method (2) seems more natural but it gives me warning C4355.
> Is there a simpler cleaner way?
> TIA,
> Harvey

To answer my own question...
I now use GetParent() in each function that I need it, as in:

  CMyDlg * pP = (CMyDlg *)GetParent(); // If used many times in a
function
  pP->m_bSwitch = false;
  pP->m_X = X1; // Etc.
or
  ((CMyDlg *)GetParent())->m_Var = Val; // If used once in a function

The documentation says:
 "The returned pointer may be temporary and should not be stored for
later use."

So that would mean that both of my previous methods should be
dangerous because they return the same pointer.
However, when is this not the case?
Or when is it dangerous (or not) to use the pointer "later"?
TIA,
Harvey

0
harveyab (125)
3/16/2007 3:31:25 PM
On Mar 16, 7:31 am, "Harvey" <harve...@juno.com> wrote:
> On Mar 10, 7:23 pm, "Harvey" <harve...@juno.com> wrote:
>
>
>
> > I have read several posts about "warning C4355: 'this' : used in base
> > member initializer list", and I understand about the object of 'this'
> > not being fully initialized, but that it is common 'safe' practice to
> > use this method to only save a pointer for future use..
> > OK, my question is;
> > What is the proper or best way to initialize a non-modal dialog?
>
> > I have used two methods:
>
> > 1.)
>
> > CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
> >    : CDialog(IDD, pParent)
> > {
> >    // pParent is not set here, See Create
> >    pCV=NULL;
>
> > }
>
> > BOOL CFooDlg::Create(CWnd * pParent)
> > {
> >    pCV=(CMyBar *) pParent;
>
> > }
>
> > 2.)
>
> > CMyBar::CMyBar(CWnd* pParent /*=NULL*/)
> >    : CDialog(CMyBar::IDD, pParent),
> >    CFooDlg( this ) // <---- Warning C4355
> > {
>
> > }
>
> > CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
> >    : CDialog(IDD, pParent)
> > {
> >    pCV=(CMyBar *) pParent;
>
> > }
>
> > But method (2) seems more natural but it gives me warning C4355.
> > Is there a simpler cleaner way?
> > TIA,
> > Harvey
>
> To answer my own question...
> I now use GetParent() in each function that I need it, as in:
>
>   CMyDlg * pP = (CMyDlg *)GetParent(); // If used many times in a
> function
>   pP->m_bSwitch = false;
>   pP->m_X = X1; // Etc.
> or
>   ((CMyDlg *)GetParent())->m_Var = Val; // If used once in a function
>
> The documentation says:
>  "The returned pointer may be temporary and should not be stored for
> later use."
>
> So that would mean that both of my previous methods should be
> dangerous because they return the same pointer.
> However, when is this not the case?
> Or when is it dangerous (or not) to use the pointer "later"?
> TIA,
> Harvey

For functions that "may" return a temporary pointer:
Can I determine if a pointer is temporary?
If it isn't, can I trust that it never will be?
TIA,
Harvey

0
harveyab (125)
3/21/2007 6:26:21 PM
Hi Harvey,

A pointer is a pointer.  You'll have to know more about where it's coming 
from to make those kinds of determinations.  You're better off querying for 
the pointer whenever you need it.  However, I often do things like:

CDocument *pDoc = GetDocument();

or CWnd *pParent = GetParent();

and use it for a whole function.  I've never had any problems.

Tom

"Harvey" <harveyab@juno.com> wrote in message 
news:1174501581.549816.198110@y66g2000hsf.googlegroups.com...

> For functions that "may" return a temporary pointer:
> Can I determine if a pointer is temporary?
> If it isn't, can I trust that it never will be?
> TIA,
> Harvey
> 

0
tom.nospam (3240)
3/21/2007 6:36:10 PM
On 10 Mar 2007 19:23:22 -0800, "Harvey" <harveyab@juno.com> wrote:

>I have read several posts about "warning C4355: 'this' : used in base
>member initializer list", and I understand about the object of 'this'
>not being fully initialized, but that it is common 'safe' practice to
>use this method to only save a pointer for future use..
>OK, my question is;
>What is the proper or best way to initialize a non-modal dialog?
>
>I have used two methods:
>
>1.)
>
>CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
>   : CDialog(IDD, pParent)
>{
>   // pParent is not set here, See Create
>   pCV=NULL;
>}
>
>BOOL CFooDlg::Create(CWnd * pParent)
>{
>   pCV=(CMyBar *) pParent;
>}
>
>2.)
>
>CMyBar::CMyBar(CWnd* pParent /*=NULL*/)
>   : CDialog(CMyBar::IDD, pParent),
>   CFooDlg( this ) // <---- Warning C4355
>{
>}
>
>CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
>   : CDialog(IDD, pParent)
>{
>   pCV=(CMyBar *) pParent;
>}
>
>But method (2) seems more natural but it gives me warning C4355.
>Is there a simpler cleaner way?

You can ignore C4355. Myself, I routinely disable it. The only way you can
get into trouble by simply storing a pointer is if it must be converted to
a base class whose construction hasn't begun in a multiple inheritance
setting; this is undefined, IIRC, but it shouldn't be an issue for MFC
window classes since they don't normally use MI anyway, and if they do, the
CWnd part is the left-most base.

BTW, unless CFooDlg is a private nested class of CMyBar or access to it is
otherwise restricted, casting to CMyBar as above is suspect and should be
replaced with a dynamic_cast or verified with MFC-style RTTI. Better still,
you can make CFooDlg's ctor take a CMyBar* instead of CWnd*. I would not do
this for Create or recommend writing Create as you have above.
CDialog::Create is a virtual function, but you are not overriding it in
CFooDlg, because you've changed its signature. This is bad because anyone
can call one of the CDialog::Create overloads through a pointer or
reference to the CDialog part of your CFooDlg object, bypassing what you do
in your Create.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
3/21/2007 6:53:38 PM
On 16 Mar 2007 08:31:25 -0700, "Harvey" <harveyab@juno.com> wrote:

>To answer my own question...
>I now use GetParent() in each function that I need it, as in:
>
>  CMyDlg * pP = (CMyDlg *)GetParent(); // If used many times in a
>function
>  pP->m_bSwitch = false;
>  pP->m_X = X1; // Etc.
>or
>  ((CMyDlg *)GetParent())->m_Var = Val; // If used once in a function
>
>The documentation says:
> "The returned pointer may be temporary and should not be stored for
>later use."
>
>So that would mean that both of my previous methods should be
>dangerous because they return the same pointer.
>However, when is this not the case?
>Or when is it dangerous (or not) to use the pointer "later"?

If the parent window is bound to a CWnd-derived object, GetParent returns a
pointer to the CWnd part of that object. This pointer remains valid as long
as the binding is valid. Temporary CWnds are reclaimed during idle-time
processing, so it is not safe to store pointers to temporary windows across
idle-time boundaries, such as occurs when you return from a message
handler, and MFC resumes its message loop. Again, casting as above is
fragile; if I couldn't eliminate it entirely, I'd try to arrange to do it
in one place, using dynamic_cast or MFC RTTI to ensure it's valid.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
3/21/2007 7:02:47 PM
On 21 Mar 2007 11:26:21 -0700, "Harvey" <harveyab@juno.com> wrote:

>For functions that "may" return a temporary pointer:
>Can I determine if a pointer is temporary?

I can't recall ever needing to do that, but I would start by reviewing the
documentation for FromHandle and FromHandlePermanent.

>If it isn't, can I trust that it never will be?

The C++ object will remain valid until it's destroyed. Since it isn't a
temporary CWnd, MFC won't destroy it during idle-time processing. However,
it may be destroyed when the HWND bound to it is destroyed, depending on
what it does in PostNcDestroy. Otherwise, normal C++ object lifetime rules
apply.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
3/21/2007 7:07:39 PM
On Mar 21, 11:02 am, "Doug Harrison [MVP]" <d...@mvps.org> wrote:
> On 16 Mar 2007 08:31:25 -0700, "Harvey" <harve...@juno.com> wrote:
>
>
>
> >To answer my own question...
> >I now use GetParent() in each function that I need it, as in:
>
> >  CMyDlg * pP = (CMyDlg *)GetParent(); // If used many times in a
> >function
> >  pP->m_bSwitch = false;
> >  pP->m_X = X1; // Etc.
> >or
> >  ((CMyDlg *)GetParent())->m_Var = Val; // If used once in a function
>
> >The documentation says:
> > "The returned pointer may be temporary and should not be stored for
> >later use."
>
> >So that would mean that both of my previous methods should be
> >dangerous because they return the same pointer.
> >However, when is this not the case?
> >Or when is it dangerous (or not) to use the pointer "later"?
>
> If the parent window is bound to a CWnd-derived object, GetParent returns a
> pointer to the CWnd part of that object. This pointer remains valid as long
> as the binding is valid. Temporary CWnds are reclaimed during idle-time
> processing, so it is not safe to store pointers to temporary windows across
> idle-time boundaries, such as occurs when you return from a message
> handler, and MFC resumes its message loop. Again, casting as above is
> fragile; if I couldn't eliminate it entirely, I'd try to arrange to do it
> in one place, using dynamic_cast or MFC RTTI to ensure it's valid.
>
> --
> Doug Harrison
> Visual C++ MVP

I think I am getting the picture.
So, if my Dialog app has a non-modal dialog that is created at the
beginning and lasts the whole time, and is only hidden and shown as
needed, then a pointer to it will never change. Is that correct?
Windows doesn't move things like this behind my back does it?
Thanks Doug,
Harvey

0
harveyab (125)
3/21/2007 8:36:01 PM
On Mar 21, 10:53 am, "Doug Harrison [MVP]" <d...@mvps.org> wrote:
> On 10 Mar 2007 19:23:22 -0800, "Harvey" <harve...@juno.com> wrote:
>
>
>
> >I have read several posts about "warning C4355: 'this' : used in base
> >member initializer list", and I understand about the object of 'this'
> >not being fully initialized, but that it is common 'safe' practice to
> >use this method to only save a pointer for future use..
> >OK, my question is;
> >What is the proper or best way to initialize a non-modal dialog?
>
> >I have used two methods:
>
> >1.)
>
> >CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
> >   : CDialog(IDD, pParent)
> >{
> >   // pParent is not set here, See Create
> >   pCV=NULL;
> >}
>
> >BOOL CFooDlg::Create(CWnd * pParent)
> >{
> >   pCV=(CMyBar *) pParent;
> >}
>
> >2.)
>
> >CMyBar::CMyBar(CWnd* pParent /*=NULL*/)
> >   : CDialog(CMyBar::IDD, pParent),
> >   CFooDlg( this ) // <---- Warning C4355
> >{
> >}
>
> >CFooDlg::CFooDlg(CWnd* pParent /*=NULL*/)
> >   : CDialog(IDD, pParent)
> >{
> >   pCV=(CMyBar *) pParent;
> >}
>
> >But method (2) seems more natural but it gives me warning C4355.
> >Is there a simpler cleaner way?
>
> You can ignore C4355. Myself, I routinely disable it. The only way you can
> get into trouble by simply storing a pointer is if it must be converted to
> a base class whose construction hasn't begun in a multiple inheritance
> setting; this is undefined, IIRC, but it shouldn't be an issue for MFC
> window classes since they don't normally use MI anyway, and if they do, the
> CWnd part is the left-most base.
>
> BTW, unless CFooDlg is a private nested class of CMyBar or access to it is
> otherwise restricted, casting to CMyBar as above is suspect and should be
> replaced with a dynamic_cast or verified with MFC-style RTTI. Better still,
> you can make CFooDlg's ctor take a CMyBar* instead of CWnd*. I would not do
> this for Create or recommend writing Create as you have above.
> CDialog::Create is a virtual function, but you are not overriding it in
> CFooDlg, because you've changed its signature. This is bad because anyone
> can call one of the CDialog::Create overloads through a pointer or
> reference to the CDialog part of your CFooDlg object, bypassing what you do
> in your Create.
>
> --
> Doug Harrison
> Visual C++ MVP

How did I change the signature? If I remember correctly (and typed it
correctly), this is the way the wizard wrote it. I only put the line
in the body. (But that was 11 days ago :-> ).

Thanks,
Harvey

0
harveyab (125)
3/21/2007 8:44:26 PM
On 21 Mar 2007 13:44:26 -0700, "Harvey" <harveyab@juno.com> wrote:

>How did I change the signature? If I remember correctly (and typed it
>correctly), this is the way the wizard wrote it. I only put the line
>in the body. (But that was 11 days ago :-> ).

You tell me. :) I'm going by the documentation:

CDialog::Create
http://msdn2.microsoft.com/en-us/library/yhth57kd(VS.80).aspx
<q>
virtual BOOL Create(
   LPCTSTR lpszTemplateName,
   CWnd* pParentWnd = NULL 
);
virtual BOOL Create(
   UINT nIDTemplate,
   CWnd* pParentWnd = NULL 
);
</q>

Did the wizard really create a new function in your derived class named
Create with signature:

>>>BOOL CFooDlg::Create(CWnd * pParent)
>>>{
>>>   pCV=(CMyBar *) pParent;
>>>}

Note also that it's bad to overload virtual functions as CDialog does with
Create, but this wasn't too evident 15 years ago when MFC was being
written. Just avoid doing it in new code.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
3/22/2007 4:26:36 AM
On Mar 21, 8:26 pm, "Doug Harrison [MVP]" <d...@mvps.org> wrote:
> On 21 Mar 2007 13:44:26 -0700, "Harvey" <harve...@juno.com> wrote:
>
> >How did I change the signature? If I remember correctly (and typed it
> >correctly), this is the way the wizard wrote it. I only put the line
> >in the body. (But that was 11 days ago :-> ).
>
> You tell me. :) I'm going by the documentation:
>
> CDialog::Createhttp://msdn2.microsoft.com/en-us/library/yhth57kd(VS.80).aspx
> <q>
> virtual BOOL Create(
>    LPCTSTR lpszTemplateName,
>    CWnd* pParentWnd = NULL
> );
> virtual BOOL Create(
>    UINT nIDTemplate,
>    CWnd* pParentWnd = NULL
> );
> </q>
>
> Did the wizard really create a new function in your derived class named
> Create with signature:
>
> >>>BOOL CFooDlg::Create(CWnd * pParent)
> >>>{
> >>>   pCV=(CMyBar *) pParent;
> >>>}
>
> Note also that it's bad to overload virtual functions as CDialog does with
> Create, but this wasn't too evident 15 years ago when MFC was being
> written. Just avoid doing it in new code.
>
> --
> Doug Harrison
> Visual C++ MVP

Oh, now that I go actually look at the code... :)
Well, you are quite right.
I have this in several Dialogs, I obviously copied the bad code from
one class to another several times. Now I see that the signature is
not the same as even the base class that the function calls. So I
guess I better go fix them all :-)
Thanks for your help - it's much appreciated.
Harvey

0
harveyab (125)
3/22/2007 8:11:46 AM
On 22 Mar 2007 01:11:46 -0700, "Harvey" <harveyab@juno.com> wrote:

>On Mar 21, 8:26 pm, "Doug Harrison [MVP]" <d...@mvps.org> wrote:
>> On 21 Mar 2007 13:44:26 -0700, "Harvey" <harve...@juno.com> wrote:
>>
>> >How did I change the signature? If I remember correctly (and typed it
>> >correctly), this is the way the wizard wrote it. I only put the line
>> >in the body. (But that was 11 days ago :-> ).
>>
>> You tell me. :) I'm going by the documentation:
>>
>> CDialog::Createhttp://msdn2.microsoft.com/en-us/library/yhth57kd(VS.80).aspx
>> <q>
>> virtual BOOL Create(
>>    LPCTSTR lpszTemplateName,
>>    CWnd* pParentWnd = NULL
>> );
>> virtual BOOL Create(
>>    UINT nIDTemplate,
>>    CWnd* pParentWnd = NULL
>> );
>> </q>
>>
>> Did the wizard really create a new function in your derived class named
>> Create with signature:
>>
>> >>>BOOL CFooDlg::Create(CWnd * pParent)
>> >>>{
>> >>>   pCV=(CMyBar *) pParent;
>> >>>}
>>
>> Note also that it's bad to overload virtual functions as CDialog does with
>> Create, but this wasn't too evident 15 years ago when MFC was being
>> written. Just avoid doing it in new code.
>>
>> --
>> Doug Harrison
>> Visual C++ MVP
>
>Oh, now that I go actually look at the code... :)
>Well, you are quite right.
>I have this in several Dialogs, I obviously copied the bad code from
>one class to another several times. Now I see that the signature is
>not the same as even the base class that the function calls. So I
>guess I better go fix them all :-)
>Thanks for your help - it's much appreciated.
>Harvey

You're welcome. In case it isn't clear, I said it's bad to overload virtual
functions because to get Create to do your thing no matter which overload
is called, you have to override all the overloads.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
3/22/2007 3:14:59 PM
On Mar 22, 7:14 am, "Doug Harrison [MVP]" <d...@mvps.org> wrote:
> On 22 Mar 2007 01:11:46 -0700, "Harvey" <harve...@juno.com> wrote:
>
>
>
> >On Mar 21, 8:26 pm, "Doug Harrison [MVP]" <d...@mvps.org> wrote:
> >> On 21 Mar 2007 13:44:26 -0700, "Harvey" <harve...@juno.com> wrote:
>
> >> >How did I change the signature? If I remember correctly (and typed it
> >> >correctly), this is the way the wizard wrote it. I only put the line
> >> >in the body. (But that was 11 days ago :-> ).
>
> >> You tell me. :) I'm going by the documentation:
>
> >> CDialog::Createhttp://msdn2.microsoft.com/en-us/library/yhth57kd(VS.80).aspx
> >> <q>
> >> virtual BOOL Create(
> >>    LPCTSTR lpszTemplateName,
> >>    CWnd* pParentWnd = NULL
> >> );
> >> virtual BOOL Create(
> >>    UINT nIDTemplate,
> >>    CWnd* pParentWnd = NULL
> >> );
> >> </q>
>
> >> Did the wizard really create a new function in your derived class named
> >> Create with signature:
>
> >> >>>BOOL CFooDlg::Create(CWnd * pParent)
> >> >>>{
> >> >>>   pCV=(CMyBar *) pParent;
> >> >>>}
>
> >> Note also that it's bad to overload virtual functions as CDialog does with
> >> Create, but this wasn't too evident 15 years ago when MFC was being
> >> written. Just avoid doing it in new code.
>
> >> --
> >> Doug Harrison
> >> Visual C++ MVP
>
> >Oh, now that I go actually look at the code... :)
> >Well, you are quite right.
> >I have this in several Dialogs, I obviously copied the bad code from
> >one class to another several times. Now I see that the signature is
> >not the same as even the base class that the function calls. So I
> >guess I better go fix them all :-)
> >Thanks for your help - it's much appreciated.
> >Harvey
>
> You're welcome. In case it isn't clear, I said it's bad to overload virtual
> functions because to get Create to do your thing no matter which overload
> is called, you have to override all the overloads.
>
> --
> Doug Harrison
> Visual C++ MVP

Yes, I can see what you mean. So I scrapped the Create() functions in
my app and used the class wizard generated WM_CREATE handler which is
OnCreate() instead. The idea is the same as in my original post
(method 1) but hopefully it is correct. Here is the code from one of
my six Non-modal dialogs. what do you think? Can it be improved?
Thanks Doug,
Harvey

// CMultDlg dialog

// CMultDlg is a NON-modal Dialog Box

CMultDlg::CMultDlg(CWnd* pParent /*=NULL*/)
	: CDialog(IDD, pParent)
{
	// pParent is not set here for NON-modal dialog, See OnCreate()
	pCV = NULL;
	//{{AFX_DATA_INIT(CMultDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}

int CMultDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	pCV = (CChildView *)FromHandlePermanent(lpCreateStruct->hwndParent);
	return 0;
}

0
harveyab (125)
3/22/2007 10:55:43 PM
Reply:

Similar Artilces:

MDI menu and dialogs fail #3
I have this MDI app. Every child window draws some data (looks like a windows task manager). Everything seems to work just fine but if I let this app running from one day to another, main menu doesn't work as well as context menues, and every dialog I try to invoke (using DoModal) seems to fail too. Processor is not busy and when I push a tool bar button seems to attend right away (The break point shows that any dialog fails as well as LoadMenu calls). GUI is responding well and redrawing correctly. Another important issue : I get and invalid hWnd (0xfefefe..) after a call to Create over ...

What's a dialog box? How do I close it?
In Outlook, when I try to send a message, I get a window that says: "Open dialog box. Close dialog box and try again." I have no idea how to close a dialog box. What are you doing when you are sending the message? a dialog box is a message box reminding you to do something or telling you of problems. See if you can bring it forward using Alt+Tab. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook 2007: http://ww...

non-recurring payroll checks
Help! I have a problem setting up. Wanted to set up back to 01/01/03 to track the entire year. Put in the first payroll check. Money apparently assumes this amount is a recurring amount, but it isn't--every payroll check is a very different amount. How do I get the program to allow me to enter each payroll check amount separately? On Sun, 21 Sep 2003 20:53:05 -0700, "Lisa Durant" <durantfamily@gwi.net> wrote: >Help! I have a problem setting up. Wanted to set up back >to 01/01/03 to track the entire year. Put in the first >payroll check. Money appare...

Visio File Summary Dialog Box is showing wrong file name and size
Hi all, I am using Visio 2003 ActiveX Control in my application using VB.NET 2005. I am calling "visCmdFileSummaryInfoDlg" Command to open File Summary Dialog Box. Dialog Box is open successfully but it always showing Template file size instead of open file size in General Tab. The information it shows is: Type: Microsoft Visio Drawing Location: Size :(928 bytes) Based on: Template - ValueStreamMap.vst Can any one let me know about any property or way so that it shows correct file size? Thanks Asif Can we assume that the new drawing has been saved to disk before you call th...

Help Calling A Function from a 32-bit non-.NET DLL
In my VB.NET application, I'm trying to call a function from a 32-bit, non-.NET dll file and I'm having problems. I believe I have the correct signature for the dll with: <System.Runtime.InteropServices.DllImportAttribute("asdHTMLCompare.dll")> _ Public Shared Function BuildCompositeFile(ByVal szOldFile As System.IntPtr, _ ByVal szNewFile As System.IntPtr, _ ByVal szCompositeFile As System.IntPtr, _ ByVal szOldPrefix As System.IntPtr, _ ByVal szNewPrefix As System.IntPtr, _ ByVal szCompositePrefix As System.IntPtr, _ ByVal bCheckForChangedImages As System...

Payroll should warn of GL accounts that have been inactivated.
Payroll posting accounts can be inactivated in general ledger, but you are not warned anywhere in payroll that you are continuing to post to those accounts. The problem doesn't show up until the GL doesn't post. The Build or Calculate report in Payroll should warn you of the problem. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web...

Running number not initializing (Dexterity)
I have customised a window to key in transactions. A new payment number is created every time window is opened. But in this case, if I don't save the trx and just cancel, the program considers the no as used and skips to the next no when I reopen. The following is my code in the WIN_PRE. How can I fix this? pragma (disable warning LiteralStringUsed); local boolean l_success; local 'User ID' in_user_ID; local 'Receipt Prepayment Number' l_repay; local long count,i; release table REPAY_NUMBER; clear table REPAY_NUMBER; Key = "1"; set Key of table 'Student...

Eliminate macro warning when you open a workbook
I have a shared workbook that everytime someone opens it the macro warning comes up. I cannot find a macro in the workbook and wish to prevent the pop up box. Karlene Check out this link to explain what's happening and how to stop it: http://www.contextures.com/xlfaqMac.html#NoMacros Hope this helps. Pete On Jan 13, 4:35=A0pm, Karlene <Karl...@discussions.microsoft.com> wrote: > I have a shared workbook that everytime someone opens it the macro warnin= g > comes up. =A0I cannot find a macro in the workbook and wish to prevent th= e pop > up box. &...

Derived Dialog Does Not Work, am I doing it wrong?
Hi, All: I am very new to MFC programming, but have experience in C++, Java and C#. I have this C++ appl with 20-ish tabPages on a dialog, all these pages have some same controls, let's say on the left area are a CListBox and Buttons, right areas are different in every page. I am thinking create a base tabPage class, which contains the left area (CListBox and Buttons) and basic members, then derive all my tabPages from this base tabPage class so that I only need to add controls and members on the right area. Theoritically, this is a sample OO design, isn't it? I created my base tabPa...

ASSERT I don't understand (modeless dialog and posting messages)
I am hitting an intermittent ASSERT when I post a message from a modeless dialog to it's main window that I don't understand. Initially I thought it screamed of a memory corruption issue, but I have enabled all of the CRT debug heap checking options and tested with Boundschecker and no heap issues are being reported. Is there something inherently wrong with this?: #1- The main window has an edit control IDC_MESSAGES #2- Just before a lengthy operation is about to occur, a modeless dialog is created via new() and its Create() method called. There is a progress ctrl and an abort butt...

capturing windows messages to parent dialog box
Hey All, i have a CDialog based application taht communiates with a centralized server application written by a colleague. (it's essentially an internal network monitoring app, can anyone say NIH? :) ) We're now adding in functionality to monitor ups devices. The server sends me a packet that says the UPS has lost power. I popup a modal message box (using this class from codeproject -> http://www.codeproject.com/dialog/MessageBoxDialog.asp) telling the user he has X seconds to shutdown the network or the server will do it for him. This of course can simply be cause someone...

Data Field in Pivot Table is Non-numeric
The data field of my pivot table is non-numeric and hence it is shown as '0' when Sum or Average is selected as the summarization option. I know that there will be only a single value for each cell in the data area of the pivot table and hence do not require summarization. How do I show the value (non-numeric) instead of showing a summarization Copy of the source data and the resultant pivot table are shown below Regards R. Ven Kochi Refineries Limite Indi Source Data Sample Property Time Valu CV17 Naphtha Density 01/15/04 8:00 >.783 CV17 Na...

Can I install Office 2003 on a non-boot partition?
I have partitioned my hard drive into boot drive C and separate Programs and Data partitions. I'm running out of space on C and want to move Office 2003 to the Programs partition. Can this be done? I didn't notice an option to install Office 2003 anywhere but on the C drive. "Phil Reed" <philecreed@yahoo.com> wrote in message news:#hG#s3YZKHA.4268@TK2MSFTNGP05.phx.gbl... > I have partitioned my hard drive into boot drive C and separate Programs > and Data partitions. I'm running out of space on C and want to move Office > 2003 to the...

Suggestion to add ability to merge non-adjacent cells in Excel.
I would like to see the ability to merge non-adjacent cells. In essence, I am talking about tying two or more cells together so that they behave like the same cell: you would be able to change data in EITHER ONE and it will automatically show up in the other cell AND vice-versa. -- Doyle_D ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-...

changing settings to non-standard work week
Hello, I need to change the working week to start on Sunday, and end on Thursday, so that Friday and Saturday are days off. When I change this in "Change Working Time", this has no effect on the calendar itself. I see Saturdays/Sundays as days off. Is there any way to change also the visual settings of the calendar to reflect this change. I can set those manually with non-standard working time, etc. But it's a lot of work for multi-month projects. I'd like this option to be set as default. This is a multi-part message in MIME format. --------------070308080606...

Need Help with Busy Dialog Thread
my application would perform a task. I want to stop the user from using the application's GUI untill the the BG task is finished. At first using Modal Dlg did not do the trick as every one now (apart from me) the the CDialog::DoModal() function has to return some how. So, I made a bit of research on the net and found a trick to display the Dialog using CWinThread derived class without stoping the main app window for executing the background task as follows: (1) In your header file define a CWinThread-derived class... class CDialogThread : public CWinThread { DECLARE_DYNCREATE(CDial...

non CRM posts
Sorry to inject this, but is MSFT still trying to fix the issue with all the non-CRM posts to this NG? Seems like they're trying, but now we're getting Media Player and a lot of Excel questions. (And, in case a MSFT person does read this or follow-up, I don't use the web interface to post or read the newsgroup, use a news reader) -jim I've contacted Microsoft direct about this. May be able to get something done about it. I just wish they would give someone the ability to delete posts that are not crm related as I know MS are a bit too busy to be monitoring this group all...

win32 programming: how to ooen a webbrowser in a win32 dialog?
All, I have a win32 dialog application (not use MFC nor ATL). When I click the button of a dialog, I want to open a browser with a specified URL. There are a few requirements: 1. I do not want to use IE to open the URL. I want to open this one in a Webbrowser control (I.e. IWebBrowser2). 2. The webbrowser control is not embedded in the dialog. It will be dynamically created when I clicked the button Any tips how to do this? Which class should I use? This is a pure win32 application so I could not use MFC or ATL libraries. thanks in advance, Qiang http://msdn.microsoft.com/library/defaul...

STL warnings
Hi, all; I made a parser using STL <vector> I get the following warnings, en masse, in the MS created files: C4786 C4100 C4244 C4018 The definition isn't important (yet). Now,the first of these is mention in MSDN, and they show the use of #pragma warning (disable : 4786) as required. OK But the others are strange: many are for unreferenced variable (args for method), type mismatches, and such. Again, this is MS's headers and code. Using #pragma warning (disable : 4786 4100 4244 4018) // a problem with VC++ I knock down the warning load to 24 (from about 80) TWO QUESTIO...

Dialog window size
Hi, Is there a way to change the size of dialog window without editing in text editior, the resource file ? i don't want too, to increase size with mouse using handle. something like property editor could be very interesting. tia, Maileen "Maileen" <nospam@nospam.com> wrote in message news:OeIK63i9DHA.2392@TK2MSFTNGP11.phx.gbl... > Hi, > > Is there a way to change the size of dialog window without editing in > text editior, the resource file ? > i don't want too, to increase size with mouse using handle. > > something like property editor could...

Getting access to dialog data
Context: VC++ 6 , MFC Dialog-based App The basic classes created by AppWizard are three utility classes CChildFrame, CMainFrame, , CAboutDialog and three (I'll call them) program classes, CMyApp, CMyDoc, CMyView. What's visible when the program starts is a dialog that's an instantiation of the CMyView class. Using File | New or the New-File button on the toolbar invokes CWinApp::OnFileNew() which instantiates another member of the CMyView class with data initialized in CMyView::OnInitialUpdate(). This seems to be a perfect way to allow the user to clone an existing dialog ...

Virus Warning
CNN announced. PLEASE SEND THIS TO EVERYONE ON YOUR CONTACT LIST !! A new virus has just been discovered that has been classified by Microsoft as the most destructive ever! This virus was discovered yesterday afternoon by McAfee and no vaccine has yet been developed. This virus simply destroys Sector Zero from the hard disk, where vital information for its functioning are stored. View: http://urbanlegends.about.com/library/bl_a_card_for_you.htm http://www.snopes.com/computer/virus/card.htm Uhm, if you actually READ the urbanlegends site you'd know it was false, you meathead >:-( ...

Non-microsoft tracking
Can the Journal track items from files from AutoCAD (DWG files)? -- Bill DeShawn bdeshawn@nospamsterling.net http://my.sterling.net~bdeshawn No. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Bill DeShawn asked: | Can the Journal track items from files from AutoCAD (DWG files)? ...

Color Dialog Help
I am calling the Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As CHOOSECOLORS) As Long to work with colors but I cannot figure out how to work it as follows: (1) i save and reload the custom colors. this all works. (2) i pass a current color using ColorDialog.rgbResult = CLng(vCurrentColor) this sets the matrix to the correct color properly (3) now i want to tweak that incoming color using the matrix or Lum slider. this i can do. (4) now i want to add it as a custom color. BUT cannot because, if I click a vac...

Word dialog box not fully visible
Can anyone tell me how to fix this? Apparently my screen is too small. The dialog box is moved to the top of the screen, but the bottom is not visible; so I've made changes to the track changes options and am unable to click on "okay", "apply changes", etc. (I can't see what's there to click on.) Has anyone had this problem and been able to fix it? Thanks for any help you can provide. * gg wrote, On 20-1-2010 18:29: > Can anyone tell me how to fix this? Apparently my screen is too small. The > dialog box is moved to the top of the scre...