|
hey wait !!! you say you are already working on a project, which go live date is planned, and you don't know anything to C++ ?! WTF !!!
man, go prepare gallons of coffee, you gonna spend nights to read book to get up to date...
for my part, i cannot help more than that :
class CMyClass : public CAnotherClass {
};
|
|
|
|
|
come on! i know that much!! just dont know how to implement the stuff...i mean..i think that inheritance is really easy but the teacher was like the program should be really complex and stuff...so i was wondering whats so difficult abt it...and i cant figure out what to do...
and if u cant give me a code then suggest a topic on which i should start thinking at least
|
|
|
|
|
ahhh, so you're at school, and you didn't learnt your lessons...
what do you find hard in writing a class ? have you checked the code i wrote in my previous post ?
|
|
|
|
|
i know how to define stuff and everything but i cant uderstand why use inheritance in the first place..and i cant get the use of private members in a program...what do they do???
|
|
|
|
|
inheritence ? that's the essence of object oriented programmation !
you define objects, which have properties (stored internally as private members) and which can do certain actions.
imagine you have a class car. you define there everything that is sommong to cars... an engine, a color, tyres, etc...
but do every car look same ? certainly not. and that's where inheritence come.
you could have a class formulaOne, a class RallyCar, a class MonsterTruck... all inheriting from Car, but all different. by the way, they all are cars, aren't they ?!
|
|
|
|
|
i guess!$^@#$
ok if i want to make a program that has the info of all the students in a university, like roll no, grades, courses, instructor, address, phone no, department, degree name, etc etc, then what should i do??...ill probably make the program...but i dont know what the program should say when i run it..
should it ask for my user name and password..? and when i enter this should the program display the info corresponding to that particular user name??
i mean is this scenario possible?? and another thing..where will the info of the students be stored?? i mean will i call a file that has the info of every student or will the user enter his/her info first and then itll save that info and then display???
|
|
|
|
|
i cannot say, and i guess nobody here will either.
no one but you know the specs... you know what your teachers asked you to write, and assuming that you've been at school from the beginning of the year, that shouldn't be that hard to code...
sorry to be rude, but if you can't find by yourself, then go back in your lessons.
|
|
|
|
|
ok just tell me this...whatever i wrote in the last post..is it possible?? through inheritance??
|
|
|
|
|
inheritence wont do the whole job for you... it's just an add to designing yout objects, and to reuse code that logically belongs to it...
man, seriously ; where were you this year ?
|
|
|
|
|
man i was at uni the whole time beleive it!
but mostly i was ..
|
|
|
|
|
|
killthecherry wrote: but mostly i was
believe it or not, we ALL knew this one !
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
killthecherry wrote: i cant figure out what to do..can anyone plz mail me a project in c++ that uses a lot of inheritance?? plz submit on killthecherry@yahoo.com ...thnks!
google is best friend of yours dude!
"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
Support CRY- Child Relief and You
|
|
|
|
|
Hello All,
I am trying to automate a word document for saving programatically so for that i am trying as follows:
first i am loading the document as follows after that i am unable to save document which is modified so how can i do that if anybody have idea about that please share with me.
i am giving the code for loading the document it is correctly working also code for saving but it is not saving that document:
int CAutoWord::InitAutomation()
{
// Get the CLSID for Word's Application Object
CLSID clsid;
CLSIDFromProgID(L"Word.Application", &clsid);
// Create an instance of the Word application and obtain the pointer
// to the application's IUnknown interface
IUnknown* pUnk;
HRESULT hr = ::CoCreateInstance( clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IUnknown, (void**) &pUnk);
if (FAILED(hr))
{
OutputDebugString("Error in creating Word application instance\n");
Destroy();
return -1;
}
// Query IUnknown to retrieve a pointer to the IDispatch interface
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&m_pDispApp);
// Get pointer to Documents interface.
DISPPARAMS dp = { NULL, NULL, 0, 0 };
DISPID dispID;
LPOLESTR szDoc = L"Documents";
IDispatch* pDocuments = NULL;
VARIANT varRetVal;
hr = m_pDispApp->GetIDsOfNames(IID_NULL, &szDoc, 1, LOCALE_SYSTEM_DEFAULT, &dispID);
hr = m_pDispApp->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dp, &varRetVal, NULL, NULL);
if (!SUCCEEDED(hr))
{
Destroy();
return -1;
}
// keep the Dispatch pointer in the member variable for later use.
m_pDocuments = varRetVal.pdispVal;
return 0;
}
int CAutoWord::SaveDocument()
{
VARIANT varRetVal;
EXCEPINFO excepInfo;
VARIANTARG varg;
varg.vt = VT_BSTR;
varg.bstrVal = _bstr_t("c:\\doc1.doc"); // this is the MS-word document filename, must be changed to a valid filename that exists on disk
DISPPARAMS dpSave = { &varg, NULL, 1, 0 };
DISPID dispSaveID;
LPOLESTR szSaveDoc = L"Save";
HRESULT hr = m_pDocuments->GetIDsOfNames(IID_NULL, &szSaveDoc, 1, LOCALE_SYSTEM_DEFAULT, &dispSaveID);
hr = m_pDocuments->Invoke(dispSaveID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dpSave, &varRetVal, &excepInfo, NULL);
printf("hello2\n");
if (FAILED(hr))
{
OutputDebugString("The document could not be printed\n");
Destroy();
return -1;
}
}
|
|
|
|
|
hi all!
i have a list control in a dialog, i override the OnSize() function of the dialog so that the list change size with the dialog, but i got flickering screen when i drag the border of the dialog, how can i improve this?
Thanks!
|
|
|
|
|
Hi, i try to help you, because i had/currently have the same problems.
Try to add at the creation of the Dialog a ModifyStyle(0,WS_CLIPCHILDREN|WS_CLIPSIBLINGS);
Then, size the list-control with a "MoveWindow", not a "SetWindowPos"
I hope it helps
|
|
|
|
|
i tried ur method, didn't help, i found that the problem is actually because i have a group containing the list ctrl, if i don't update the position of the group, then list won't fliker, but i do need the group, any idea?
|
|
|
|
|
You call "Group" a groupbox?
If yes: Welcome to my world of problems LOL
If i set the groupbox to transparent it works, but flickers
if i set the groupbox to non-transparent, i doesn't flicker, but i have old groupbox-lines in the groupbox.
For that i opened the thread about drawing controls into the Double-Buffering some lines under your thread.
|
|
|
|
|
nathan7 wrote: i all!
i have a list control in a dialog, i override the OnSize() function of the dialog so that the list change size with the dialog, but i got flickering screen when i drag the border of the dialog, how can i improve this?
overide OnEraseBkgnd method
"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
Support CRY- Child Relief and You
|
|
|
|
|
Hi
I am trying to display tool tip text on icons placed on CFormView. I am using these functions:
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
BOOL CDashboardView :: OnToolTipText (UINT id,
NMHDR *pNMHDR,
LRESULT *pResult)
{
BOOL result = TRUE; /* Operation result */
CString strTipText; /* tool tip text */
UINT nID = -1; /* Identifier */
TOOLTIPTEXTA* pTTTA = NULL;
TOOLTIPTEXTW* pTTTW = NULL;
CPoint point; /* current cursor point */
pTTTA = (TOOLTIPTEXTA*)pNMHDR;
pTTTW = (TOOLTIPTEXTW*)pNMHDR;
nID = pNMHDR->idFrom;
if (nID != 0 )
{
// Identify button rect, copy text
for (long ii = 0; ii < m_arrLineupBtnRect.GetSize(); ii++)
{
GetCursorPos (&point);
ScreenToClient (&point);
if (m_arrLineupBtnRect[ii].PtInRect(point))
{
strTipText = m_sButtLineups[ii].m_strToolTip;
}
}
// Copy tool tip text
if (pNMHDR->code == TTN_NEEDTEXTA)
{
lstrcpyn(pTTTA->szText, strTipText, strTipText.GetLength());
}
else
{
_mbstowcsz(pTTTW->szText, strTipText,strTipText.GetLength());
}
*pResult = 0;
}
return result;
}
My problem is that the tool tip text has about 280characters. The program crashes at the line lstrcpyn(pTTTA->szText, strTipText, strTipText.GetLength()); It works fine for about 80 characters in tool tip text.
Is there any limit for the tool tip text.
Thanks
Madhavi
|
|
|
|
|
|
Dear All
I should write one program which uses parallel port of computer in ECP mode.
I should use CreateFile and DeviceIOControl routines for this purpose.
Is there any resource that help me about this project.
another problem :
When I include both stdafx.h and ntddk.h in my project, I find that some redefinition errors and warnings occured.
some variables and structures are defined in both ntddk and some header file which is defined in some other header files.
Does anyone have any idea to remove this problem.
REgards
Mahdi
|
|
|
|
|
ntddk.h is a file used in driver development - it should not be included in user-mode programs. Use CreateFile to open a handle to the parallele port, then control it via commands you issue with the DeviceIOControl. You need to be looking for a document that describes the available IOCTL commands that can be issued via DeviceIOControl. And, no, I don't know where one is.
Judy
|
|
|
|
|
Hello everyone!
I'm sure this is just me missing something really stupid but I can't see what it is. I'm trying to play around with non-client drawing on top level windows, so I found the MSDN page for WM_NCPAINT and it said the following snippet will retrieve the window DC and set the clipping region:
case WM_NCPAINT:
{
HDC hdc;
hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);
ReleaseDC(hwnd, hdc);
} However, I've entered this into my program and GetDCEx always returns NULL and what's stranger still is that GetLastError always returns ERROR_SUCCESS!
I'm running Windows Vista with the DWM enabled so I checked MSDN for anything DWM related that may be stopping me and found you need to set the DWMWA_ALLOW_NCPAINT to TRUE. So I did that and still GetDCEx and GetLastError return NULL and ERROR_SUCCESS respectively. I tried calling without the DCX_INTERSECTRGN flag or the clipping region and still it returns NULL.
Eventually I became lazy and used GetWindowDC as a hack which did actually return a device context that allowed me to paint on the frame. I was under the impression that GetWindowDC(hWnd) is just a wrapper for GetDCEx (hWnd, NULL, DCX_WINDOW) but obviously this isn't the case.
Has anyone else experienced anything like this before? Or does anyone have any idea what may be happening?
I'm using MFC7 with VC7 and latest version of the Windows SDK.
Many thanks,
Kier.
|
|
|
|
|
According to MSDN, If DCX_CACHE is not specified and the window is neither CS_OWNDC nor CS_CLASSDC, this function returns NULL.. Have you use Spy++ to look at the window properties?
BTW, thanks for formatting your code with PRE - makes it a lot easier to read.
Best wishes,
Hans
|
|
|
|
|