|
These casting operators are C++ standard
|
|
|
|
|
This basically is "saying" the following:
"Regardless of the type of the variable m_pDlg points to treat it as if it was a CEchoServerDlg ; call the OnAccept method through this pointer."
This will obviously cause problems if you cast an object into something its not.
For example:
CRect rc;
CRect *pNotAWindowAtAll = &rc;
DWORD dwStyle = ((CWnd*)pNotAWindowAtAll)->GetStyle();
This code will compile and run. At best it will crash at runtime and at worst it will not: it will not work correctly and it makes no sense whatsoever. A C-style cast like this just pretends that a CRect is a CWnd but the two classes are not related and it will end in tears. A cast like that is saying to the compiler, "just do what I say".
I often go on about this, but in my opinion (and that of most modern C++ programming books) the C-style cast has no place in modern C++ code. You should use something like this instead:
static_cast<CEchoServerDlg*>(m_pDlg)->OnAccept();
A static_cast will limit the type of cast. It will only cast between related classes, perform standard conversions and call user defined conversion operators. If used in my "bad code" example it will not compile - this is good: nonsense shouldn't compile.
Steve
|
|
|
|
|
If user create's some Button controls dynamically using create and assign them some perticular function and settings,how to reload this settings after restarting the application.Because If I restart the application all the dynamic controls will be lost.
Nilesh Korpe
|
|
|
|
|
Nilesh Korpe wrote: how to reload this settings after restarting the application
Simply save the data in a file and load the data at application startup.
|
|
|
|
|
Thank you
I think that is the only solution ,
Nilesh Korpe
-- modified at 4:19 Thursday 11th May, 2006
|
|
|
|
|
I checked many functions to do the same but i could not... i want the help to copy a folder and a file to another folder using a FTP connection... can any one help to do the same...awaiting your reply
|
|
|
|
|
|
i tried it but unable to copy a file in the specified folder.pls send me example if possible.
|
|
|
|
|
|
PLease see MSDN:
CInternetSession and
CFTpConnection
CFtpFileFind
You will get everything in MSDN with the samples....
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Hi,
Is there any way to set the backgroud as an Image to a Dialog?
|
|
|
|
|
Sure... you can do it by drawing the image on OnEraseBkgnd or OnPaint, or by placing a picture static control with the same size of the dialog.
- NS -
|
|
|
|
|
Hi,
It is working. But when I try to add 'Microsoft FlexGrid Control, Version 6.0' on that dialog & run the application; then FlexGrid Control is not visible on that dialog.
Do you have any solution to show FlexGrid Control on a Dialog having background image.
Thanks,
Aniket
|
|
|
|
|
What did you do? I think you used a picture static control, right?
- NS -
|
|
|
|
|
Hi,
Yes, you are right. I use Picture Contol with 'Bitmap' Type & on that I place 'FlexGird' Control.
What is the proper way to do it?
I dont what to write in OnEraseBkgnd or OnPaint & how to use them.
Thanks,
Aniket
|
|
|
|
|
Try this
GetDlgItem(IDC_STATIC_BMP)->ModifyStyle( 0, WS_CLIPSIBLINGS );
- NS -
|
|
|
|
|
Try this
GetDlgItem(IDC_STATIC_BMP)->ModifyStyle( 0, WS_CLIPSIBLINGS );
I forgot to say that it should be placed in OnInitDialog
- NS -
|
|
|
|
|
Hi,
Thanks for
GetDlgItem(IDC_STATIC_BMP)->ModifyStyle( 0, WS_CLIPSIBLINGS );
What this statement do?
I add this line in 'OnInitDialog()', but there is no any progress.
'FlexGrid' control is not visible. Actually it is behind that image. And I am trying to display 'FlexGrid' on that image.
Thanks,
Aniket
|
|
|
|
|
I didnot try it using FlexGrid, but it is working for ListBox and Picture control.
WS_CLIPSIBLING style will make the picture control to be clipped by the other sibling controls.
Now you can:
1. Make sure that there is no transparency style is set to picture control.
2. Try to change the tab order also.
3. If it does not fix the problem, try to set the FlexGrid to top of the picture control in zorder using SetWindowPos.
And please let me know the status
- NS -
|
|
|
|
|
Hi,
Thanks, atlast it work by changing Tab Order & changing style of picture control to WS_CLIPSIBLING. But I can't do it by setting Z-Order of 'FlexGrid' in SetWindowPos().
Thanks once again for giving your valueable time.
Aniket.
|
|
|
|
|
Try looking on a wonderful site called codeproject!
A simple search[^] with the terms dialog and bitmap gives a nice list - the first item is an article by Nish, which means its guaranteed to be good.
Iain.
|
|
|
|
|
Hi,
Can any one give me the link for VC++ questions and answers that are import for the interview.
Cheers
Archana
|
|
|
|
|
|
RajArchana wrote: Can any one give me the link for VC++ questions and answers that are import for the interview.
please follow to link mentioned just beneath my name!
"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
|
|
|
|
|
Look at the links on my previus post
you are on position number 2 and 3,... but it wasn't a Formula1 race!
|
|
|
|