|
|
Now I am able to read data from a .rtf file and write its contents in a rich edit control. Now I want to include this .rtf file as a resourse (just like we include bitmap), to print its contents in a rich edit control. Please can anyone tell me how can i do that?
Thank you
Aqueel A. Mirza
We Believe in Excellence
|
|
|
|
|
Goto the resource pane: right click on the on the root node of the list and select import.
OR
Insert->Resource->Import
OR
Ctrl+R
You should be able to figure out the rest from there.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Here is a somewhat related example.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi,
I have a class derived off CDialog that I use as a child dialog in a tab control.
The problem I have is that the background of the dialog is gray but the tab control's background is white (xp look).
How can I get the child dialog's background to be the same color as the tab control's background?
I would prefer not to have to change the tab control as I'm using a class from a library and I would like to have a general solution that applies not only to tab controls but any parent window.
I tried overriding OnEraseBkgnd and calling
HBRUSH hBrush = (HBRUSH) GetParent()->SendMessage(WM_CTLCOLORDLG, m_hWnd);
and using the returned hBrush to fill the dialog's client area but that threw exceptions.
I've also tried not erasing the background.
Any help would be appreicated.
Regards,
Liehann
|
|
|
|
|
The window class adjusts the (normal) background color. The easiest way to override these settings is to handle WM_ERASEBKGND with TRUE as return (to prevent flickering) and handle WM_PAINT to paint the background (e.g. CDC::FillSolidRect).
Don't try it, just do it!
|
|
|
|
|
Thanks for the reply.
How can I get the parent window's background color in OnPaint?
|
|
|
|
|
Hi,
I need some help with dlls. It's my first time writting dlls and I have a minor problem.
<br />
#ifdef MYPROJ_EXPORTS<br />
#define _myprojExport __declspec(dllexport)<br />
#else<br />
#define _myprojExport __declspec(dllimport)<br />
#endif<br />
<br />
class _myprojExport MyClass<br />
{<br />
...<br />
protected:<br />
typedef std::list<std::string> StringList;<br />
StringList mylist;<br />
};<br />
As you can see on the above code I have MyClass which is a simple class that I export. When mylist member is missing everything is compiled smoothly, however when I have mylist member variable on the class I get the following warning from my compiler (VS .NET 7.1).
warning C4251: 'MyClass::mylist' : class 'std::list<_Ty>' needs to have dll-interface to be used by clients of class 'MyClass'
with
[
_Ty=std::string
]
How can I create a dll-interface for std::list? I don't have to export std::list the client will find its implementation in <list>. How should I declare mylist in order to get rid of these warnings?
Thanks in advance,
Themis
|
|
|
|
|
Anyone know if this is possible.
I know I can define a function to do that kind of thing......
#ifdef DEBUG
# define STUFF(x) x
#else
# define STUFF(x)
#endif
but what I would like to be able to do is define something so that I could just make the compiler ignore the line.
#ifdef DEBUG
# define ONLY_DEBUG cout
#else
# define ONLY_DEBUG //
#endif
e.g. ONLY_DEBUG << "this is a debug build" << endl;
This is only an example I know I can use TRACE etc, its been able to get rid of something in debug, short of having #ifdef DEBUG around it.
|
|
|
|
|
I don't think that it's possible to set a comment as define.
Why don't you create a define like that:
#ifdef _DEBUG
#define DPRINT( x ) cout << x << endl
#else
#define DPRINT( x )
#endif
Don't try it, just do it!
|
|
|
|
|
Hello,
Why don't you just try it? I think that it is possible, since you canno't use '//' comments in macro's since it will erase some of your code when the preprocessor expands it to a single line...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I'm creating a modal child dialog and a modeless child dialog to learn about them.
I have a simple SDI application that calls the dialogs.
The modal child dialog derived from CDialog opens up behind the mainframe and does not have the focus, nor is it ever able to obtain the focus once I find it, i.e. title bar remains grayed and cannot click on any buttons on the modal child dialog. Properties of the dialog are child and visible.
CModalChild cmd;
cmd.DoModal();
The modeless child dialog opens up as it should but does not have the focus nor is it ever able to obtain the focus, i.e. the title bar remains greyed although the modeless child dialog is functional.
if (!m_pModelessChildDialog)
m_pModelessChildDialog= new CModelessChild;
if (!::IsWindow(m_pModelessChildDialog->GetSafeHwnd()))
m_pModelessChildDialog->Create(IDD_DIALOG6, this);
m_pModelessChildDialog->ShowWindow(SW_SHOW);
Hope someone can help me understand this. Thanks.
|
|
|
|
|
Hello.
In the SDI project, you should show your dialogs after created the mainframe class. You should calling the DoModal or ShowWindow Founctions in the your view class.
excuse me if my sentences are not complete. because, I don't know english well.
Zo.Naderi_Iran
|
|
|
|
|
Thanks Zo. Yes both are being called from the Mainframe's view class but still the problems.
|
|
|
|
|
I think, even though u r calling DoModal() on modal dialog box, the main focus is present on the view and mainframe and the Menu is grayed may be because you may have attached the menu to the dialog box instead to the main window. Try attaching the menu to the main frame window.
Work hard and bit of luck is KEY to SUCCESS.
|
|
|
|
|
Thanks, but no menus involved. Just the form view calling a modal child dialog via a button and the form view call a modeless child dialog via another button.
|
|
|
|
|
I want to get the handle for the drop down button of a Combo Box control.
I tested the following code but the drop down button doesn't seem to be a child of the CComboBox:
...
CWnd* pChild = this->GetWindow(GW_CHILD);<br />
hwndChild=pChild->GetSafeHwnd();<br />
::GetClassName(hwndChild, szClassName, 256);<br />
if(!memcmp(szClassName, "Edit", sizeof("Edit")))<br />
{<br />
<br />
pChild = pChild->GetWindow(GW_HWNDNEXT);<br />
<br />
if(pChild)<br />
{<br />
hwndChild=pChild->GetSafeHwnd();<br />
::GetClassName(hwndChild, szClassName, 256);<br />
}<br />
}
...
Any ideas?
Thanks,
Lula Capixaba
|
|
|
|
|
lulacapixaba wrote:
the drop down button doesn't seem to be a child of the CComboBox
of course it isn't, otherwise how could it be itself a par of the conbobox ?
A ComboBox can be see as a set of 3 controls encapsulated into once : an editbox, a listbox and a button.
about accessing one of these parts, i really don't know how to do, and am waiting with interest for an answer too, but i think you should search for Owner Drawn control...
ps: just curious, what are you trying to do with this button ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I've just researched this problem; conclusion:
There is no button to get, the button is drawn by the control and is not a child window.
Where I looked: MSDN, PUI library code (see CP article) and I used spy to double check my conclusions.
I assume you want to control over how the button is drawn. In which case look at the PUI library code, plus other articles on drawing Win2000 and WinXP style minues a buttons.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Thanks John. I think you are right.
Lula Capixaba
|
|
|
|
|
I'm developing a network app with a listview that shows files that can either be cached locally or only on the server. I have implemented the listview as a drop source and it downloads files that are selected when initiating the drag.
Now to the problem. I'm setting the file paths in the drop object, however those files that does not exist locally must be downloaded before it can be physically copied to the drop target.
Is there a way to make the explorer drop target wait for my app to finish downloading it's files and then receiving all the paths ( So the user will get the little plus sign when dropping it on the explorer window ).
Any ideas would be most welcome!
|
|
|
|
|
How about delayed rendering in clipbord. I guess you can reuse same mechanizm?
|
|
|
|
|
Thanks for that information! That was just what I needed.
Found this useful article on CodeGuru:
http://www.codeguru.com/Cpp/W-P/clipboard/article.php/c3015/
|
|
|
|
|
|
Hello and thanks for looking at my problem,
I want to both select some text and set the caret postion in a edit control as if the user clicked the mouse at the end of the text and then draws the mouse pointer towards the beginning of the text. When doing so, the caret position is somewhere in the middle of the text and everything behind it is selected, like this:
this is |some text
where the bold stuff is selected and the caret is the "|".
EM_SETSEL always results in selected text with the caret at its end, like this:
this is some text|
but I need the caret at the beginning. Does anyone know how to do?
Thanks a lot...
Martin Hoppe
|
|
|
|