|
He also has to make it owner draw too, doesn't he?
Have no idea - it depends how Windows draws items in the listbox. If DC has no TRANSPARENT bkmode set, he'll have to go ownerdraw.
The easiest solution would be switching to CListCtrl and using CListCtrl::SetBkColor and CListCtrl::SetTextBkColor.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I've got an very urgent question.
I want to get the Serialnumber of a Disk (Floppy Disk, Hard Disk (IDE &
SCSI), CD,...) into a CString (- the disk where my program is saved).
I've only found Source Code for IDE Hard Disks.
Is there an API function to get the number.
(There is one in VB.)
Gerhard
|
|
|
|
|
|
Does anybody know how to insert a new line
into a CRichEditCtrl/View?
for example like this:
rectrl.InsertText("\nnew line\");
thanks in advance
|
|
|
|
|
Use CRichEditCtrl::ReplaceSel. If there is no current selection, the replacement text is inserted at the insertion point, that is, the current caret location.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
is it no something weird like,
two carriage returns and then a line feed.....
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
Can you please tell me what's wrong with this code:
CMyRichEditView *pView;
CRichEditCtrl& pCtrl = pView->GetRichEditCtrl();
pCtrl.ReplaceSel("\r\r\ntest");
I get a debug assertion in the third line.
thanks
|
|
|
|
|
I've never used a RichEditCtrl before, so I might be wrong, but it looks like you're declaring a pointer and never constructing it, so pCtrl is probably NULL or invalid somehow. Something like that
Jake
|
|
|
|
|
Yes, it seems to be NULL, by why?
|
|
|
|
|
If you have a Assertion is because your code didn get the RichEditCtrl.
In others words pCtrl is NULL.
Do you really have the view of the richedit?
Best Regards!!!
Carlos Antollini.
|
|
|
|
|
That's a good question.
I thought this is the correct way to get the CRichEditCtrl of a CRichEditView.
|
|
|
|
|
How you get the view of the richEdit?
You made something like this?
CRichEditCtrlView* pView = (CRichEditCtrlView*)GetDlgItem(IDC_RICHCTRL);
I saw taht you get the view from a derived class or from your own class of RichEditView I think that the problem start there....
Carlos Antollini.
|
|
|
|
|
NO, the other way round
I want to get the control from my SDI-application, which has a CRichEditView class
|
|
|
|
|
Have a look at the Wordpad example and all your problems will be solved.
Question: What does pView point to????????
Exactly so how can you call GetRichEditControl?
|
|
|
|
|
I think this is the problem.
pView points into nothing
I changed the code to
CMyRichEditFTPView *pView = (CBMyRichEditDoc*)GetView();
CRichEditCtrl& pCtrl = pView->GetRichEditCtrl();
pCtrl.ReplaceSel("\r\r\nTest");
But the compiler says that GetView() ist an undefined expression (or something like that, I have the german visual c++), although it is defined in the MSDN as follows:
CRichEditDoc::GetView
I'm totally confused now
|
|
|
|
|
You are a little confussed.
The getView is for get a view pointer from the RichEditDoc.
Please read how you can get a good view from a RichEdit Using the GetDlgItem function. I put an answer before.
After that you can get a pointer to the CRichEditCtrlCtrl
Regards!!!
Carlos Antollini.
|
|
|
|
|
In what class is this code?
|
|
|
|
|
It is in the MainFrame class of my SDI appliction, and all I want to do is to insert a line into the CRichEditView
|
|
|
|
|
does anybody know why it doesnt work?
CString str;
str = "c:\\test.bmp";
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,str,SPIF_UPDATEINIFILE);
but the following works:
SystemParametersInfo(SPI_SETDESKWALLPAPER,0,"c:\\test.bmp",SPIF_UPDATEINIFILE);
pleaze help!!!!
|
|
|
|
|
|
I get this error:
error C2664: 'SystemParametersInfoA' : cannot convert parameter 3 from 'class CString' to 'void *'
|
|
|
|
|
1) Next time you post a question make clear that you have compiler error
2) The error message is self-describing. 3rd parameter to SystemParametersInfo is void *. You can't directly pass CString object as void *. You need to cast like this:
SystemParametersInfo(
SPI_SETDESKWALLPAPER,
0,
(void *)(const char*)strWallpaperFile,
TRUE);
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
thank you!!!!! I'm just a newbie in C++, thanks again!!!
|
|
|
|
|
Hi,
almost every one of my programs uses an ini-file.
I have written a class that scans the file at program start and stores all variables in a global dynamically allocated struct.
Because this takes some memory when the program gets larger, I was wondering if scanning the file for a particular entry when it is actually needed wouldn't be the better alternative.
What is the 'proper' way to use ini-files and why?
-Sebastian
|
|
|
|
|
Hi,
I don't want to start a flame war here, but since I'm not using MFC and most of my programs don't have a big GUI, I find it too much a bother to write an options dialog, etc. everytime.
-Sebastian
|
|
|
|