|
As far as I'm aware, you can't overload any of the _cast methods.
Use of const_cast can be tricky to do safely (which is why it's generally preferable to avoid it if you can), but I don't think there's a way to stop someone using it to remove the const'dness (!?) from an object.
It's worth checking out the C++ FAQ Lite[^] for some useful do's and dont's, and it may give you some ideas about how you could protect your class.
|
|
|
|
|
Hello,
I don't have VStudio installed here so I don't know if this works:
#ifdef const_cast
#undef const_cast
#endif // const_cast
#define const_cast \
char* const_cast(const char* psArg) \
{ \
\
}
Note here that you influence the global namespace here and other developers might dislike this "feature". Also remember that using cons_cast to manipulate objects that shouldn't be manipulated is asking for trouble. So it's the responsibility of the developer who is using your class, that he is using it wisely. So don't bother too much to make your class "fool proof" somehow someone will find a way to prove you wrong!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
-- modified at 16:40 Thursday 6th October, 2005
|
|
|
|
|
I want to check an IP against the NAT table mappings . Any ideea how to do this programmaticaly using MF C? A starting point ( or example) will be apreciated !
|
|
|
|
|
When running a console application from a command window which has the quickedit option enabled, a user could inadvertently click in the window text area of the command window, placing it in edit mode. This can suspend a running console application.
Is there a way for the console application to disable/enable quiickedit for the window it's running in? If not, is there another workaround?
-kg
Ken Goguen
|
|
|
|
|
Have you found an answer?
|
|
|
|
|
How can I identify a font is unicode or not, programatically?
I have the facename only.
Thanks in advance!
- NS -
|
|
|
|
|
Hi
I have done with my application that I was building using MFC.
Now i want to change the ICON of the EXE which is right now Standard MFC Icon. I have *.ico file and I want to load that Icon to my EXE. Is there a way to do this...?
Regards,
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Go into the resource editor, and modify the IDR_MAINFRAME icon (Be sure to change all sizes (16*16, 32*32, ...)
~RaGE();
|
|
|
|
|
first import an Icon into your resource, then note down its ID , by default it'll be set as IDI_ICON1,2,3, etc. so if u want your IDI_ICON1 to be the ICON for ur EXE, in the constructor, change this line
[code]
//m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
//to
m_hIcon = AfxGetApp()->LoadIcon(IDI_ICON1);
[/code]
Every man should marry. After all, happiness is not the only thing in life.
--[v]--
|
|
|
|
|
Thankx Vivek
It helped ....
Regards
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
as David said, if you replace the icon in the res folder, you wont face a problem, which when you view your folder in 'list' mode, it'll switch back to that old MFC icon. check your Exe's icon , after creating the .Exe, by chaning the view mode(thumbnail,list,details,etc) in the folder option. if its ok then leave it. if not change the MFC icon in the RES folder.
Every man should marry. After all, happiness is not the only thing in life.
--[v]--
|
|
|
|
|
Vivekuniq wrote:
if not change...
... just edit the different sizes of the icon...!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
The simplest way is to replace the .ico file in the res folder and then rebuild the project.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
using the class wizard i added the following function for a class derived from CListCtrl.
When i rename the lable i want that to be displayed there after.
If i could get the text, row and column i can use SetItemText function. What are these parameters(NMHDR *pNMHDR, LRESULT *pResult) and what does they contain.
void CWifiMdsView::OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
{
NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
*pResult = 0;
}
Thanks a lot.
|
|
|
|
|
|
Hi,
I'm writing a batchmanager which launches some jobs (processes as children). Is there a good book about processes? What's the best way to know when children have done executing? Is there any good book available for this?
Greetings,
Jens
|
|
|
|
|
Well i don't know if you want to know this. I don't have much idea about doing this using pure c++. but if you are using VC++ or MFC you can use GetExitCodeThread(hThread, &dwWaitReturn); function to get the exit code of the thread. there r various exit codes.
eg.
STILL_ACTIVE: you can use not-STILL_ACTIVE to know that the thread has done (Actually i don't remeber the other exit codes--Check out in MSDN).
Cheers.
|
|
|
|
|
Why are you asking a Linux question on what is the preeminent Windows programming site?
Software Zen: delete this;
|
|
|
|
|
Hi,
I have a list control with five column and many rows.
On Left button double click i can detect the row number using CListCtrl::HitTest() function.
I also want to find the column index.
How should I do this?
|
|
|
|
|
There is a CListCtrl::SubItemHitTest() function that you can also call. Does the same thing as HitTest, but for subitems.
I Dream of Absolute Zero
|
|
|
|
|
Hi,
We have NDOC Documentation Generator for .NET Applications in C# (or with an addin for VB.NET) right. In the same way, can you suggest a documentation tool for VC++ application, preferably an opensource or a freeware stuff.
Thanks and Regards,
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
doxygen[^] is a great tool.
There's also a codeproject article[^] related.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
If you r using VISUAL STUDIO .NET have you tried "Bild Comment Web Pages"
In VC++ under tools menu you will find it.
|
|
|
|
|
karmendra_js wrote:
If you r using VISUAL STUDIO .NET have you tried "Bild Comment Web Pages"
Nop, I haven't but I'll do it. Do you feel it's better than dOxygen + graphViz visualization component?
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|