|
Got any trace output?
Typically you'll see messages in the Output window which can help with debugging, if it's due to an ActiveX control.
The rich edit box is not an ActiveX control. It's a common control. You need to call AfxInitRichEdit if you're going to use one in a dialog box.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
My mistake. I thought it was an ActiveX control because there was trace output when I didn't have the AfxEnableControlContainer that said to add it. I assumed (falsely it would seem) that it meant the rich edit was an ActiveX. Thanks for the help.
- Aaron
|
|
|
|
|
Hi Aaron,
You are obviously adding the RichEdit control from the Controls toolbar. If this is the case then you need to do the following for it to work:
BOOL CNoactivexApp::InitInstance()
{
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls();
#else
Enable3dControlsStatic();
#endif
AfxInitRichEdit();
CNoactivexDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
}
also make sure that #include <afxcmn.h> is listed in your stdafx.h
As a side note, this isn't an ActiveX control, if you go to the dialog resource and right-mouse "Insert ActiveX control...", select "Microsoft Rich Textbox Control 6.0" then this WILL use the ActiveX control and you DONT need to perform the AfxInitRichEdit(); call.
Hope this helps,
Andy
|
|
|
|
|
Guess I should have done some reading on the rich edit instead of just assuming that it was an ActiveX control. Thanks for the code example. Quick question...Do I still need to be calling AfxEnableControlContainer if I'm not using any ActiveX controls? Thanks for the help.
- Aaron
|
|
|
|
|
Hi Aaron,
No you don't need to call AfxEnableControlContainer unless you want to support containment of ActiveX objects. My advice would be to add it anyway - YOU may not need it now but the developer that comes along after you may need it to enhance your app (save him going through the same hoops).
If you do leave it in, don't forget to include #include <afxdisp.h> in your stdafx.h file.
Cheers,
Andy
|
|
|
|
|
Thanks for all the help Andy.
- Aaron
|
|
|
|
|
Some how, when I opened up my project today, my class wizard was corrupt and woulnt open. An error popped up saying "Cannot access the ClassView information file. ClassView information will not be available." The clw file was there, but contained no class info.
When I deleted it, and went into the View->ClassWizard to rebuild it, I included all the files within my project. However, the new clw file still does not contain class info and I cannot browse my classes any more. Any ideas??
I did not create my class using the ClassWizard, but they always showed up in the ClassView and WizardBar etc. Any ideas on how to get this back? THanks
-C
|
|
|
|
|
Did you delete some project files on accident? If you saved backup copies of the project, then use one of them.
Kuphryn
|
|
|
|
|
I didnt delete any project files that I know of.
-C
|
|
|
|
|
delete ncb file
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I deleted the ncb file, but still no luck in rebuilding my ClassView. Any other ideas??
-C
|
|
|
|
|
1. Make sure the none of the files in the project are marked read-only.file is not marked read-only
2. Make sure no other instance of VC++ is open (sometimes VC++ does not release files when a workspace/project is closed). Also, check in the Task Manager that there is only one msdev.exe instance running - Sometimes the main window closes, but a msdev instance is still running in the background.
Bikram Singh
|
|
|
|
|
It worked for me when i deleted .clw and .ncb and rebuilt it.
|
|
|
|
|
Hi,
I have a list ctrl with 10 rows (items) and 4 subitems. Initially color of 4th subitem for each row is green. I achieved it through Custom Draw feature. Now i am displaying a popup menu items on the right click of the any row(item). This popup menu item is having two menu items red and blue. I want that when i select red option then 4th subitem of the selected row turned to red from green. Now to implement this functionality, I am doing like below:
Handler of the OnRed() is :
void CTestListCtrlView::OnRed()
{
int iItemIndex;
iItemIndex = m_ListCtrl.GetSelectionMark();
LVITEM Item;
Item.mask = LVIF_PARAM;
Item.iItem = iItemIndex;
Item.iSubItem = 4;
Item.lParam = RED;
BOOL x = m_ListCtrl.SetItem(&Item);
m_ListCtrl.SendMessage(WM_NOTIFY,NM_CUSTOMDRAW,(LPARAM)&Item);
}
Custom Draw Handler is:
void CTestListCtrlView::OnCustomdrawMyList(NMHDR* pNMHDR, LRESULT* pResult)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
*pResult = CDRF_DODEFAULT;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText, crBkgnd;
LVITEM rItem;
ZeroMemory ( &rItem, sizeof(LVITEM) );
int nItem = static_cast<int>( pLVCD->nmcd.dwItemSpec );
rItem.iItem = nItem;
m_ListCtrl.GetItem ( &rItem );
LPARAM lp = rItem.lParam;
if (pLVCD->iSubItem == 4 && rItem.lParam == 0 )
{
TRACE("In the Green List");
crText = RGB(0,0,0);
crBkgnd = RGB(0,255,0);
pLVCD->clrText = crText;
pLVCD->clrTextBk = crBkgnd;
}
if (pLVCD->iSubItem == 4 && rItem.lParam== 1 )
{
TRACE("In the Red List");
crText = RGB(0,0,0);
crBkgnd = RGB(255,0,0);
pLVCD->clrText = crText;
pLVCD->clrTextBk = crBkgnd;
}
*pResult = CDRF_DODEFAULT;
}
}
Initially when list control is first drawn i am getting 4th subitem as GREEN bot when i am selecting RED through pop up menu item, 4th subitem is not getting red. In fact application is getting crashed and application never reaches to "In the Red List".
Please help me what i am doing wrong?. I am attaching the code sample also,please heve a look into it.
Thanks in Advance
Amit
|
|
|
|
|
There is no need to send a WM_NOTIFY message to the list control. One solution is just set the item's data, which in this case is index 3, to RED.
struct SubItemData
{
...
};
SubItemData *pSID = new SubItemData;
...
m_ListCtrl.SetItemData(INDEX, static_cast<dword>(pSID));
...
You got the idea.
Kuphryn
|
|
|
|
|
Instead of setting Item properties through SetItemData, i set the property through LVITEM structure and removed SendMessage as suggested by you but still not successful. Here is the code
void CTestListCtrlView::OnPopupRed()
{
LVITEM *Item = new LVITEM;
Item->iItem = 2;
m_ListCtrl.GetItem(Item);
Item->mask = LVIF_PARAM;
Item->lParam = 1; // 1 mean red
m_ListCtrl.SetItemData(iItemIndex,(DWORD&)*Item);
m_ListCtrl.Invalidate();
m_ListCtrl.UpdateWindow();
}
I included Invalidate() and UpdateWindow() so that my custom draw method OnCustomdrawMyList() could be called but still i am not getting the lparam value as 1 in my custom draw method. Please help.
Thanks for the reply.
|
|
|
|
|
What's up with dereferencing Item?
m_ListCtrl.SetItemData(iItemIndex,reinterpret_cast<dword>(Item));
Kuphryn
|
|
|
|
|
Hi all.
I have a win32 window where I display my little 3D game using DX9 in full window size. I managed to load a QuickTime movie in same window but instead of movie I can still see my game rendered. Only while resizing the window teh movie appears.
Also if I disable my 3D drawing then I can see the movie correctly.
I am sure its something wrong with HWNDs or its something else?
How can I solve it.
Actually can somebody adivise me on this problem. What is the proper way to handle these two things. (displaying a movie and displaying 3D game world)?
Note: I only want to have a single window and displa one thing at a time. So, when I want to watch a movie then the movie will be displayed in full window size and should be able to switch with a single key press back to my game again occupaying the entire window display.
Apparently in windows I can create more than one display surfaceses. Should I do that or I can easily use one surface to manage that?
Later I am planning to capture my 3D game into a movie file but I guess I'll worry about that later
Thanks for your help in advance.
----------------------------
Robert Stuliglowa
|
|
|
|
|
In my MFC application the main window loads in direct x, but what im finding is that the status and toolboxes are overwritten by it i can resize the DX window to fit and not overwrite, by doing this i need to create a resize (OnSize) function to handle it, but when i actually do this the toolbar and status box do not show at all, what could be causing this?
Status Bar
m_StatusBar = new CStatusBar();<br />
m_StatusBar->Create(this);<br />
m_StatusBar->SetIndicators(idArr,2);<br />
m_StatusBar->SetPaneInfo(0,1,SBPS_NORMAL,200);<br />
m_StatusBar->SetPaneInfo(1,2,SBPS_NORMAL,100);<br />
m_StatusBar->SetPaneText(0,"Welcome To Map Edit");<br />
m_StatusBar->UpdateWindow();<br />
OnSize function
void CRootWin::OnSize(UINT nType, int cx, int cy)<br />
{<br />
CWnd::OnSize(nType, cx, cy);<br />
<br />
RECT rectSize;<br />
GetClientRect(&rectSize);<br />
<br />
rectSize.top += 30;<br />
m_RenderWin->MoveWindow(&rectSize, true); <br />
}
Toolbar Setup
if(!m_DrawTools.Create(this)) <br />
{ <br />
MessageBox("Creating Toolbar","Failed",MB_OK);<br />
}<br />
if(!m_DrawTools.LoadToolBar(IDR_MENU_POLYGON)) <br />
{ <br />
MessageBox("Loading Toolbar","Failed",MB_OK);<br />
}
|
|
|
|
|
Does anyone know if you can fill the clipboard using the CDC object?
This would be great becuase the app is already drawing the text on the window, I just want to get the text hopefully using some type of clipping function and the CDC.
Thanks.
|
|
|
|
|
You can add Text to the clipboard (real text, not a picture of text, TCHAR*/LPCTSTR/etc). You can also add Bitmaps to the clipboard.
You can add many other data-formats but these sound like the two for you.
Now it depends which one you want. If you want the text then 'just add it'.
If you want a bitmap, you can either have your app draw into a temporary-dc and then save this DC/CDC into a bitmap and store that bitmap in the clipboard. or you can just snapshot your main-window or whichever-window and do the same trick.
|
|
|
|
|
I can fill the clipboard with text but in a CView document how is the best way to track and retrieve what is highlighted?
I can track the movement of the mouse and from the starting and stopping point create a CRect. Then with that CRect I was hoping to use the CDC and get the text that the user wants to place in the clipboard.
|
|
|
|
|
it's not that simple.
depending on the application, you will either get a bitmap, or get some kind of structured data, for example, if it's a graphical application, what you select on screen ( with a selection rectangle ) will usually be some kind of basic graphic object ( size, position, color, ... ); or maybe simply a bitmap.
after that, you will need to retrieve the data from the clipboad and "decode" it to be pasted to the applications.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
So to understand when wanting to copy text from a CView, one has to track the text. Then when the user defines a rectangle, the app has to use the define rectangle and then search the tracked text for the starting and stopping point. Then move that highlighted text to clipboard
|
|
|
|
|
is you view a graphic view ( i.e. drawn text ) or a text view ( Editable text ) ?
if it's a graphical view, you need to have a way to be able to know that text is in the selection rectangle because it will ( ? ) be pixels, not text.
if it's an editable text view, ( CEdit or CRichEdit ), you should be ready to go, with appropriate class members to select the text and copy it to the clipboard.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|