|
Hy.
I'm developing a plugin based application.
My problem is that i need to define some dialogs in the plugins that later i can use from the main application to configure each plugin (something like Winamp3's Config Dialog).
If i export pointers to CPropertyPage's from the plugins and use the AddPage of the CPropertySheet in the main app, everything works well, but if i export pointers to CDialog and try to position such a dialog in another dialog created by the main application, it gives me some errors at run time.
Anybody has a clue on how to create the dialogs in the plugins so i can still handle the controls from that dialog in the plugin but still be able to position it in another dialog in the main application ???
|
|
|
|
|
Are the plug-ins being dynamically linked or statically linked to?
If dynamically (i.e. LoadLibrary) then when the dialog is created (Create/DoModal()), you need to make sure that the resources of the DLL are setup as the default at that time.
Take a look at the AFX_MANAGE_STATE() macro or the AfxSetResourceHandle() commands which will allow you to change to the correct resources when the dialog is created from its resources.
Also, you may be interested in my plug-in article thats listed in the Projects/Libraries section here at CP.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Hy.
The plugins are dinamically created (i load them with LoadLibrary) and all the plugins are MFC Extension DLL.
I found another way, it's working perfectly, i use a component named : EzOptionsDlg wich uses CPropertyPages, exactly what worked for me. (you can find it here at C.P. http://www.codeproject.com/dialog/ezoptionsdlg.asp.
My only problem with this is that i have to make shure each plugin uses different resource numbers ore the wrong dialogs will appear.
Anyway, i solved the problem, i wanted to make something similar to this.
Thanx for the help.
|
|
|
|
|
Hi,
do you now some good starting place for this?
Thanks
Bunburry
|
|
|
|
|
Bunburry wrote:
do you now some good starting place for this?
This place perhaps? (next time you should considering to do your own googling)
|
|
|
|
|
Hi,
I have a listbox on a skinned window using MFC. There are no problems with it on 98SE/Me/2000/XP but when I use the first release of 98 the list box does not show yet everything in the CListCtl class returns success when creating the window, adding colums and items.
does anybody know why?
Thannks
Ceri
|
|
|
|
|
I have brought up this question before but havn´t solved it yet
The question is:
Does someone know how to convert from a bitmap to a DIB and use the function StretchDIBBits() and implementet it in the article PrintingTricksAndTips in the printing section.
plese help.
-Tom
|
|
|
|
|
Sure, but I'm at loss why anyone would want to use the slowest GDI function available - StretchDIBBits - when there are alternatives. Any particular reason for this masochism you'd like to share with us?
|
|
|
|
|
It may be slow, but its guaranteed to work on printers compared to BitBlt() etc. So its the way to go when printing.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Tom,
I think you need it for a bitmap loaded from a file from as mentioned in a previous post. This does it from the resources, but if you can load the bitmap from a file, the rest of the technisue should be the same:
CBitmap bitmap;
bitmap.LoadBitmap(ID_BITMAP);
HANDLE hDib ;
hDib = ImageToDIB(&bitmap, iImage, this) ;
BITMAPINFOHEADER *pBMI ;
pBMI = (BITMAPINFOHEADER*)GlobalLock(hDib) ;
int nColors = 0;
if (pBMI->biBitCount <= 8)
{
nColors = (1 << pBMI->biBitCount);
}
::StretchDIBits(printer_dc,
0,
0,
pBMI->biWidth,
pBMI->biHeight,
0,
0,
pBMI->biWidth,
pBMI->biHeight,
(LPBYTE)pBMI + (pBMI->biSize + nColors * sizeof(RGBQUAD)),
(BITMAPINFO*)pBMI,
DIB_RGB_COLORS,
SRCCOPY);
GlobalUnlock(hDib) ;
GlobalFree(hDib) ;
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Thanks a lot Roger!!
A have tested the code and with a minor adjustment I got it to work, I changed the line: hDib = ImageToDIB(&bitmap, iImage, this); to hDib = DDBToDIB(bitmap, BI_RGB,NULL);. One problem is that I don´t think the printer shows the picture in it´s correct size. If I open the picture in a paint program it says that the picture is 2cm wide but on the paper is only about 0,5cm. I have sent the application to a testperson who also will test the printing, and i´m waiting for his comment.
Thanks one more time
-Tom
|
|
|
|
|
Already posted it yesterday, but did not find a right answer
So, basically, I have a dialog (MFC) which i want to reuse three times as a Propertypage, only difference will be the Caption. SetWindowText is not working to set the caption (crashes the app since the propertypage still has not been created through Cpropertysheet.DoModal()), doing the SetWindowText in the OnInitDialog from the Propertypage has no effect (but does not crash).
Any idea ?
~RaGE();
|
|
|
|
|
Hello,
did you try changing the parameters of the PROPSHEETPAGE struct? Every propertypage contains a member variable of that type, called m_psp. Before adding the page to it's corresponding sheet, you can add PSP_USETITLE to the dwFlags member of m_psp. Afterwards assign your title to the lpszTitle variable.
|
|
|
|
|
Yep, forgot this one, I've already tried that without result. Anyway , thank you for your answer.
~RaGE();
|
|
|
|
|
If I understand your question, you are using the same propertypage in several instantiations, and want to change the title before the DoModal call?
I've done this several times and pass the string across via the constructor, then in the constructor set the title as follows:
m_psp.dwFlags |= PSP_USETITLE;
m_psp.pszTitle = m_strCaption;
where m_strCaption is the required string.
It handles it for you after this.
Debbie
|
|
|
|
|
Debs wrote:
m_psp.dwFlags |= PSP_USETITLE;
OOOhh yes, i've forgotten to set the flag. it has to be that.
Thank you Veeeeeeeeeeeery much.
~RaGE();
|
|
|
|
|
There is a workoround for this:
Start a timer of 10 ms from your OnInitDialog function, and in the timer handler first killtimer, then SetWindowText.
Bunburry
|
|
|
|
|
Tricky. I'll give it a try. Thanks.
~RaGE();
|
|
|
|
|
If the title of the sheet is dependant of the page displayed, then the page should set its parent's name when activated, doing this by overriding CPropertyPage::OnSetActive()
something like that
BOOL CMyPropertyPage::OnSetActive()
{
if(CPropertyPage::OnSetActive()){
CWnd *pParent = GetParent();
ASSERT(pParent);
pParent->SetWindowText("MyText");
return TRUE;
}
return FALSE;
}
HTH,
K.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
I've been building an app that has documents made up of OLE items (like the container sample app that comes with VC). But, typically, the requirements have changed, and the documents also need to hold other custom (non OLE) items. As my document class is based on COleDocument, and the items class is based on COleClientItem, I've been using COleDocument::AddItem() and COleDocument::RemoveItem().
I'd like to only have one document item class* if possible, but it needs to represent OLE and non OLE items, is this possible, and if so can anyone point me in the right direction? Or would I be better off having two item base classes with overrides of COleDocument::AddItem() etc?
* Or one class to base other classes from
Dylan
|
|
|
|
|
how to write this "" header in C++?
i tried doing in this manner, myMemo << <> << "\n";
but the output <>.
Thank you!
|
|
|
|
|
Use \
i.e. "\"" displays "
~RaGE();
|
|
|
|
|
Huh? You make no sense.
Neither as code, nor as a logical "something" this makes sense. What is it you want to do and what is it you don't understand? Is it perhaps that you just don't understand the C preprocessor?
|
|
|
|
|
Is this helpfule ?
HRESULT hr=pIXMLDOMDocument->createProcessingInstruction(_T("xml"), _T("version='1.0'"),&pIXMLDOMProcessingInstruction);
|
|
|
|
|
how to write this header in C++?
i tried doing in this manner, myMemo << "" << "\n";
but the output .
Thank you!
|
|
|
|