|
But not for any inheriting classes, as the compiler has to construct the base classes first. If you call a virtual function in a base class constructor, the inherited class constructor has yet to complete, so it does not have a valid vtable pointer to the inherited class functions.
MS put this very problem into the CDocTemplate class, where they call a virtual function in the base class constructor.
Roger Allen - Sonork 100.10016
Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...
|
|
|
|
|
Roger Allen wrote:
as the compiler has to construct the base classes first
yeah true, so when the consturctor body is executing the base class initialation is over.
So again i didnt find the code problematic.
eg:
class CDerived: public CBase
{
public:
CDerived() : m_somethingofbaseclass(56) //Wrong
{
};
CDerived()
{
m_somethingofbaseclass = 0; //Perfectly Rite.
pBase->SomeMethod(); //Correct;
}
.
.
.
}
You see constructor is used for initialaztion of the class, wheather the derived class or the base class. So When the body of the constructor is executing, the lower leve or the invisible level like vtables initialazation is over.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
I have been searching and searching and haven't been able to find a good resource on how to work with images on dialog application I am building.
I figured out how to set the background image and stretch it - but as soon as I set the dialog to full screen I can't seem to figure out how to get my Dialog Content Centered - it just hangs out in the top left corner.
The other issue that I am having is trying to set an image as a frame with buttons on top of it - all the images, buttons and other dialog items end up behind the image - if I float over the image then I the buttons pop to the front.
Any pointers to an existing article, thread or even some hints as to how I can make this work would be muchly appreciated.
Dan Morris
|
|
|
|
|
use blitting codes in dialog's OnEraseBkgnd(...) routine
.....
CBitmap m_BackGroundBitmap;//... global variable
.....
m_BackGroundBitmap.LoadBitmap(IDB_AppMainSkin_Ion);
.....
BOOL xxx::OnEraseBkgnd(CDC* pDC)
{
if(!m_BackGroundBitmap.m_hObject) return TRUE;
CDC dc;
dc.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = dc.SelectObject(&m_BackGroundBitmap);
pDC->BitBlt(0, 0, GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN), &dc,0, 0, SRCCOPY);
dc.SelectObject(pOldBitmap);
return TRUE;
}
|
|
|
|
|
HI , i want a tooltip which has the constant behaviour instead of like normal tooltip which appear on Mouse Over and disappears on mouse out.
An example this kind of tooltip is windows update tooltip , which comes without mouse over and remains constant untill u click it.
so any body has some clue.
No Worries!
|
|
|
|
|
Hi,
I'm sorry to disappoint by asking you a question rather than giving you a solution.
The problem is :
I have a dialog based application in which i have created a toolbar . now i want to display tooltips for each of the items in the toolbar.
I have tried the following :
CToolTipCtrl Tips;
Tips.Create(this);
Tips.AddTool(GetDlgItem(ID_TEST),"Click to start transferring e-mails");
Tips.Activate(TRUE);
In PretranslateMessage:
Tips.RelayEvent(pMsg);
i have also tried:
CWnd *pwnd=AfxGetApp()->m_pMainWnd->GetDlgItem(IDR_TOOLBAR);
Tips.Create(this);
Tips.AddTool(pwnd->GetDlgItem(ID_TEST),"Click to start transferring e-mails");
Tips.Activate(TRUE);
but to no success .... can you please help me...
Thanking you
Regards
Satadru Karjee.
|
|
|
|
|
i searched google for "tootip toolbar CDialog" and it gave me this
http://www.codeproject.com/docking/display_dialog_tooltips.asp
hopefully it will help u.
No Worries!
|
|
|
|
|
I tried to use ::ExitWindowsEx(EWX_POWEROFF, 0) but it did not shut down the pc, instead, it logs off the current user. On Win2000/XP it worked properly though.
|
|
|
|
|
Hello,
use InitiateSystemShutdown function.
With Regards,
R.Selvam
|
|
|
|
|
InitiateSystemShutdown : Win95/98 unsupported.
|
|
|
|
|
Hello,
The SetSystemPowerState function suspends the system by shutting power down.
With Regards,
R.selvam
|
|
|
|
|
Hello, sir:
I have a matter that how to detect the vendor of audio codec. I want to know the vendor of my sound codec, just Reltek, C-Media or Ati and so on. But I don't know how to detect it by Micorsoft API. Can you tell me some about it? I hope your help, thanks.
|
|
|
|
|
Hi,
I utilize Visual C++ 6.0 and MFC for many years.
I want to know a few suggestions of books to do a transition toward Visual Studio. NET, preferably C++.
I don't need web development now. I have remark that many books about Visual Studio.NET include web development. I am looking for a bok specifically for Visual C++ in the .NET IDE.
Thanks for any suggestions,
Claude
|
|
|
|
|
Hello,
Did you mean Managed C++ or unmanaged C++ ?
With Regards,
R.Selvam
|
|
|
|
|
Sorry, i post this question in here. But i really cant find any other discussion board related to assemble language.
now i am trying to use inline assemble of C++ to access the parallel port. But the problem is my platform is windows NT, so what i want to ask is if there is any method for me to access the parallel port by inline assemble in C++. btw i hv the admin right of my PC.
thank u guys in advance!!!!!!!!!!! =)
|
|
|
|
|
You need to write a device driver for that. There should be several free ones on the net that already do the work for you.
John
|
|
|
|
|
|
We had some success using winio from http://www.internals.com/[^] last time we were doing this at uni.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
hi:
I want to read the CD_ROM MODE2 sectros,but I don't know what's wrong with the code.The "Result" is TRUE and "error" is 0,but there is no data in the "lpSector".
who can help me.
thank you very much
hCD = CreateFile ("\\\\.\\M:", GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
RAW_READ_INFO raw_info;
ZeroMemory(&raw_info,sizeof(raw_info));
raw_info.DiskOffset.QuadPart =2000*2352 ;
raw_info.SectorCount = 10;
raw_info.TrackMode = YellowMode2;
Result=DeviceIoControl(hCD, IOCTL_CDROM_RAW_READ,
&raw_info, sizeof(RAW_READ_INFO),
lpSector, dwSize,
&dwNotUsed, NULL);
DWORD error=GetLastError();
WriteFile (hFile, lpSector, dwSize, &dwNotUsed, NULL);
|
|
|
|
|
How about ReadFile() instead of WriteFile()?
John
|
|
|
|
|
Using ReadFile can't read CD_ROM MODE2 FORM2,
First all ,thank you very much
|
|
|
|
|
I am a little confused. You can not expect to read anything with a WriteFile()?
[EDIT]
Oh... I see you are trying to do the read with DeviceIoControl.. I got confused by the WriteFile part..
[/EDIT]
John
|
|
|
|
|
Sorry for the confusion. I am not sure of the answer. And it looks like it will be a difficult question to find an answer as there are not too many hits when I search the net for IOCTL_CDROM_RAW_READ.
John
|
|
|
|
|
I want to do another thing with WriteFile,
I have used ReadFile,but it can read MODE1 and MODE2 FORM1,can't read MODE2 FORM2.
So I want to read MODE2 with DeviceIOContrl and IOCTL_CDROM_RAW_READ
but there is no data in the buffer
|
|
|
|
|
I am trying to constrain the resizing of a MDIChildWnd to maintain a given aspect ratio. I am having no luck. The best I have been able to do is in the CWnd::OnSize function to look at the new size, calculate what a properly proportioned frame should be and call CWnd::SetWindowPos. I almost get what I need, it is just there is no frame around the client area. Annyone have any ideas?
|
|
|
|