|
Add 'operator T* () { return _p; }'
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Thanks! That worked! However, how is it that we do not have to supply any return type? Does C++ automatically determine the return type according to the casting operator. Also, I did not know that a class function could be without a return type. However, it works! So obviously I need to learn a lot! Any input on this will be greatly appreciated!
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Without wishing to sound nasty or dificult or stupid...is this smart pointer implementation giving you anything more than auto_ptr in the Standard C++ Library - and if not, why not just use that?
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
I know I can use auto_ptr. I am not really using it in any project. It just feels good to know that you can implement this behavior sometime. Also, gives me a better understanding of the language and everything. Basically, just for educational purposes. That is all
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hey, that's cool - I've often done things to educate myself - experience IS the best way to learn. Just wanted to make sure you weren't implementing it because you didn't know about the already written alternatives!!
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi!
I recently ported several my projects from VC6 to VC7. I have noticed large memory leaks. After some debugging, I have found out that ExitInstance is not called any more. This is due to fact, that window is destroyed far more earlier (I think) than before. Application exits (quits ,immediately) in CFrameWnd::OnClose() during DestroyWindow() - last line in this method.
What is the reason?
I cannot find any document which describes this issue.
|
|
|
|
|
hi!!
anyone can help me?
i want to know that thru consloe program can we pass the values to windows program & can invoke the windows application to display the output.
plz help me
thanks!!
|
|
|
|
|
Yes it depends on the task u want to do, but to launch an application Nishat S has a good article on code project
|
|
|
|
|
thanks for replying!
but from where can i get this article.
plz tell me.
|
|
|
|
|
thanks for replying!
but from where can i get this article.
plz tell me.
|
|
|
|
|
http://www.codeproject.com/system/newbiespawn.asp
|
|
|
|
|
How I can use "BindDefaultProperty" of an editbox
to bind a field of a disconnected recordset.
|
|
|
|
|
Hi all,
How can i change the font of Text Box (Edit Box) ?.
With regards
|
|
|
|
|
Did you try with SetFont?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Hi all,
I have plced a Bitmap in my control in a static frame using the Load Image Function.Now the bitmap is seen as a compressed or expanded one depending on the bitmap selected to load in that frame. How can i make the bitmap to fit in my frame with the full size in such a manner that the visible part of the image is seen on the static frame and the remaining portions are seen when a scroll bar at bottom or side is moved?. In short how can i show a bitmap in a static frame with scrolling using load Image Function?.
With regards
|
|
|
|
|
Shibu wrote:
In short how can i show a bitmap in a static frame with scrolling
You can't. You'll have to create your own window which supports loading images and scrolling.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
I was attempting to use ATL attributes in VS.NET in a MFC project (to hook to an event fired by a COM object) but in order to get it to compile had to include the [module(name="SomeName")] attribute. AFAIK this generates DllMain, DllRegisterServer, and whatnot code, but as an MFC app it already has a WinMain?! Well the app compiles and works, but I am wondering if this is correct or I am doing something wrong?
|
|
|
|
|
I have a small dialog window that is a child of my parent dialog. It has the topmost window style set so I can be doing things in other windows and have my small child window of my app still visible on top of everything. When I click on the title bar to move it around the screen, upon releasing the mouse button, the parent dialog box pops up to right under the child dialog. This isn't the behaviour I'm desiring (I'd like to be able to move the child window around without seeing the parent, but I'm not sure how to get around it, or what to do. Any ideas?
Also, i'm taking a plain dialog resource for it (no controls), and in my OnPaint function for that dialog, calling GetClientRect() and drawing right to that rect. Is this wise?
- Jason
(SonorkID 100.611)
The Code Project - Orange makes the art grow fonder
|
|
|
|
|
hu?
CParentDlg::ShowChild()
{
dialog dlg
ShowWindow(SW_HIDE)
if( dlg.DoModal()== IDOK)
{
//bla bla
}
ShowWindow(SW_SHOW)
-Drawing on that plain dlg that OnPaint (WM_DRAW) message should do no harm
Daniel O
|
|
|
|
|
Can I create a popup menu (context menu) and make it apear at once, no animation.
Can I get the height of the created menu, I'd like to position it exatcly above a button?
Thanks for help!
|
|
|
|
|
1) I think you can't. There is only one way to solve this problem - switch "menu effects" options off in Windows Settings. Of course, you can paint menu manually, but is it worthy of that efforts?
2) Point is that Windows can place popup menus in different directions relative to point that you indicated to menu. It depends on how close this menu is to bounds of screen. If you will adjust menu position manually, it may result a bug in some particular case
|
|
|
|
|
Roman Fadeyev wrote:
1) I think you can't. There is only one way to solve this problem - switch "menu effects" options off in Windows Settings. Of course, you can paint menu manually, but is it worthy of that efforts?
I used BCMenu class, but any other ownerdraw menu works too. I need to figure out what makes it non sliding here on WIn9x, but at least it works.
void CBCDialogMenuDlg::OnButtonMenu()
{
BCMenu menu;
menu.LoadMenu(IDR_MYTYPE);
BCMenu* pPopupMenu = (BCMenu*) menu.GetSubMenu(0);
ASSERT(pPopupMenu != NULL);
CRect rect;
m_away.GetWindowRect(rect);
pPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, rect.left, rect.top, this);
}
Roman Fadeyev wrote:
2) Point is that Windows can place popup menus in different directions relative to point that you indicated to menu. It depends how close this menu is to bounds of screen. If you will adjust menu position manually, it may result a bug in some particular case
good point. I'll make sure my window is big enough to hold the menu over the button.
|
|
|
|
|
When I said "paint menu manually" i indeed meant a ownerdraw menu. But remember that using of ownerdraw menus may lead to refusing from some Windows abilities as WinXP Themes and etc.
Somehow or other, we have found consensus
|
|
|
|
|
well.. I tried a bit with CButtonST. I can at least meassure the height of the menu there. Some code.... not finsihed yet, but seems to work:
void BCMenu::GetClientRect(LPRECT lpRect)
{
lpRect->left=0;
lpRect->top=0;
lpRect->bottom=0;
lpRect->right=0;
MEASUREITEMSTRUCT MIS;
BCMenuData *mdata;
UINT nID;
int num = GetMenuItemCount();
for(int i=num-1;i>=0;--i)
{
nID=GetMenuItemID(i);
mdata=FindMenuList(nID);
MIS.itemData = (DWORD) mdata;
MeasureItem(&MIS);
lpRect->bottom += MIS.itemHeight;
if(MIS.itemWidth > (unsigned) lpRect->right) lpRect->right = MIS.itemWidth;
}
lpRect->bottom+=5;
}
PS: I have choosen ownerdraw menu because I like the possibility bitmaps in menus
|
|
|
|
|
sliding is away, I used a onwerdraw menu.
Now I need to find out how to exactly position my menu... I think I will also figure that out now. thx
|
|
|
|