|
I have created a microsoft chart graph. I need to plot around 1400 rows in x- axis which makes graph unclear. Can anybody suggest what solution i can find out to solve the problem?
How can i add a scroll bar to graph so that all the 1400 values can be seen clearly....?
OR is there any other active-x control in MFC which i can use to plot a 3D and 2D graphs.?
Please let me know ASAP.
Thanks in advance
vidya
|
|
|
|
|
Hai frens,
I dono how to insert an JPG image file in the picture control of MFC in VC++.If possible give me an example.
Any one knows plz help.
baljeedurai
|
|
|
|
|
not possible with default image control
look around CP for a subclass which does this...
Actually, thats a darn good idea for a control if one doesn't already exist
Cheers
How do I print my voice mail?
|
|
|
|
|
Do we Have Any Chance of using "Picture" class and loadpicture function as in VB here.If so How to use that class.
Thanks
Balajeedurai
|
|
|
|
|
Probably not using the picture tool inside the dialogbox editor...you'd have to use an activex or subclass that picture tool and render a jpeg instead
How do I print my voice mail?
|
|
|
|
|
I have an MFC executable and an ATL DLL which supports MFC as well.
When the DLL calls AfxGetModuleState it gets the EXE's ModuleState class instead of it's own.
Why does this happen ? What am I missing ?
|
|
|
|
|
is it causing a problem ?
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Yes because when loading resources (AfxFindStringResourceHandle for example), AfxGetModuleState is called.
So, my DLL tries to load a String resource for example, and tries to run through all of the EXE's resource-handles (because AfxGetModuleState returns the EXE's module object) instead of it's own list of resource-handles (stored in it's own module-object).
Am I missing something ?
Does the DLL really have it's own moduleobject ? I'm pretty sure it does, but why isn't it returned then ?
thanks
|
|
|
|
|
When you are loading the resource string, dont you think you need module instance handle of the dll???
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
You can, but the better way is to use AfxFindStringResourceHandle which not only looks in your resource-hinstance but also traverses the CDynLinkLibrary list and any other relevant resource-handles, that's the way to use several resource-dlls at the same time.
Only that it doesn't work in this specific scenario because the module returned is the EXE's one and not the DLLs one...
|
|
|
|
|
Did you insert
AFX_MANAGE_STATE(AfxGetStaticModuleState());
before any MFC call you do from within a DLL function?
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
|
|
|
|
|
Nope
Can you tell me more about this ?
What does it do exactly ? Is it possible to do it once per module and not before every call ?
thanks
|
|
|
|
|
|
|
Ok I'm starting to get it,
There is no other solution except for placing this in all my methods that perform MFC calls ? Isn't this abit weird ?
|
|
|
|
|
AFAIK this is the only solution. I don't think it's weird cause you only want to change the module state during the function call, and then set it back to the main application. And adding one line of code isn't too bad, is it ?
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
|
|
|
|
|
In the begining of every function that uses an MFC method which in turn uses this DLL's own resources ?
I think it sounds terrible Having to remember to do this, and having other people rememebr to do this. Not to mention having my code cluttered by this line all the time...
I want my module to always use the same AFX_MODULE_THINGY, why can't the AFX methods do AfxGetStaticModuleState() , that is my question actually. Why did they leave it this way ?
|
|
|
|
|
ohadp wrote:
I want my module to always use the same AFX_MODULE_THINGY, why can't the AFX methods do AfxGetStaticModuleState(), that is my question actually. Why did they leave it this way ?
Unfortunately (?) I was never a part of the development teams that invented MFC and the related techniques.
So I fear this is a question I can't answer you - I just take it as is, and every time my DLL does some weird things the 'AFX_MODULE_THINGY' is the first thing that comes to me. Hope you'll reach that state soon, too.
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
|
|
|
|
|
ohadp wrote:
There is no other solution except for placing this in all my methods that perform MFC calls ?
No, it is only needed by those functions that load resources from the DLL. Your DLL can use MFC all day long, but if it ever needs to load one of its own resources, it must use the AFX_MANAGE_STATE() macro.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi All,
I was trying to make a code similar to this work.
template <class t=""> class myclass
{
private:
t num;
public:
myclass() {}
~myclass() {}
};
class myclass1
{
public:
void abc(myclass <class t="">* obj)
{
}
};
int main(int argc, char* argv[])
{
myclass <int> obj;
myclass1 obj1;
obj1.abc(&obj);
return 0;
}
My basic idea is to have a template class myclass (which will take structure as template parameter). Now have another class myclass1 which will have a function taking this template class as one parameter. I want to make this member function of class myclass1 generic. i.e depending on the object of class myclass I create, this function should work.
Am getting compilation error.
Can we do such a thing at all with templates?
Thanks
Rajdeep
|
|
|
|
|
Can we do such a thing at all with templates?
Yup, I think you may be having problems with your syntax though. You need to specify a type parameter for template declarations and instanciations. Also you will need to make myClass1 a template class or derive myclass from a base and pass that to your function. Otherwise the compiler will not be able to figure out the type of the pointer.
template<class T>
class MyClass
{
private:
T Num_;
}
template<class T>
class MyClass1
{
public:
void abc(MyClass<T>* obj)
{
}
}
myClass<int> obj;
myClass1<int> obj1;
obj1.abc(&obj);
Good luck, templates are great stuff once they 'click'. Have a look for some introductory articles, bound to be some around here.
Ryan
|
|
|
|
|
You can make 'abc' a template function,
#include <iostream>
template <class t> class myclass
{
private:
t num;
public:
myclass( t n ) : num ( n ) {}
~myclass() {}
void Fn ()
{
std::cout << num << std::endl ;
}
};
class myclass1
{
public:
template <typename T> void abc(myclass <T>* obj)
{
obj->Fn () ;
}
};
int main()
{
myclass <int> obj ( 10 ) ;
myclass <double> objd ( 3.14159 ) ;
myclass1 obj1;
obj1.abc(&obj);
obj1.abc(&objd);
return 0;
}
There's no need to use pointers in abc, it would be preferable to use references, the functionality here doesn't change.
Paul
|
|
|
|
|
Hi, All...
I am writing a COM container using MFC OLE classes. The purpose of the
container is to display and/or print MS Word doc as portion of a bigger
display/plot. For this I am trying to get the Enhance Metafile representation of the word doc file using MSWord as COM Server. I have had limited success in the sense that only first page of the document is visible in the metafile.
Here is what I have tried:
CMyContainerDoc* pDoc = new CMyContainerDoc; //derived from
COleDocument
CMyCtrlItem* pCtrlItem = new CMyCtrlItem(pDoc); //derived from
COleClientItem
pCtrlItem->CreateFromFile("mytestfile.doc"); //path and name of a MS
word file
CSize clientSize;
BOOL bRet = pCtrlItem->GetCachedExtent(&clientSize, DVASPECT CONTENT);
HDC hDC = ::CreateEnhMetaFile(NULL, "c:\\drawtest.emf", 0, NULL);
CDC::FromHandle(hDC)->HIMETRICtoLP(&clientSize);
CRect rect( 0, 0, clientSize.cx, clientSize.cy);
pCtrlItem->Draw(CDC::FromHandle(hDC), &rect, DVASPECT CONTENT);
HENHMETAFILE hMetaFile = CloseEnhMetaFile( hDC );
DeleteEnhMetaFile( hMetaFile);
This results in just the first page of document to be represented in the
metafile.
How could I get the whole document in the metafile?
2. Alternatively, I tried to use GetData function of IDataObject
interface .
It returns success status code, but when I try to use the metafile
handle, returned through STGMEDIUM structure, it still contains only the first page.
Here is the relevant code:
FORMATETC fmtetc;
fmtetc.cfFormat = CF METAFILEPICT;
fmtetc.dwAspect = DVASPECT CONTENT;
fmtetc.ptd = NULL;
fmtetc.tymed = TYMED MFPICT;
fmtetc.lindex = -1;
STGMEDIUM stgMed;
memset(&stgMed, 0, sizeof(stgMed));
LPDATAOBJECT lpDataObject = 0;
pCtrlItem->m lpObject->QueryInterface(IID IDataObject,
(void**)&lpDataObject);
sc = lpDataObject->GetData( &fmtetc, &stgMed );
LPMETAFILEPICT pMF = (LPMETAFILEPICT)GlobalLock(stgMed.hEnhMetaFile);
//Draw the picture.
HDC hDC2 = ::CreateEnhMetaFile(NULL, "c:\\testGetdata.emf", 0, NULL);
BOOL bRetPlay = PlayMetaFile(hDC2, pMF->hMF);
GlobalUnlock(stgMed.hEnhMetaFile);
ReleaseStgMedium(&stgMed);
HENHMETAFILE hMetaFile = CloseEnhMetaFile( hDC2 );
DeleteEnhMetaFile( hMetaFile );
Here again, the metafile testGetData.emf contains just the first page of
the document.
Is there something I am missing here? Or if there is another better way
of achieving the intended results.
any suggestion appriciated !
Thanks in Advance
Vishal
|
|
|
|
|
|
Probably a bad idea...you should look into shell programming probably...
If nothing in there will solve your issue...then get the bitmap your user has set as a background, draw on it, save a new bmp (background w/ your text on it) and set it as the new background. If there not using any bmp for backgrounds, then make them
How do I print my voice mail?
|
|
|
|