|
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
|
|
|
|
|
Very good! When you are drawing the text you need to keep track of were you drew it, if you want the user to be able to select it. With that infomation it should be farely easy to determine what text is contain within the selection rectangle. Note, I said farely easy; in reality the calculation can get quite complicated (depending on font used, text extents and all that).
Good Luck!
INTP
|
|
|
|
|
I am working with MDI apps.It is Explorer Apps. Some of the Global variables were created.I want make it as class variables.I was converted 90%.But I got problem with CListView variables.wherever CListView is there.I try replace with ((CMyListView *)AfxGetApp())->. He was created one ListView variable in CDocument class.I try to replace with m_pDOc->m_ListView. But I am getting Access Violation Errors? Pl Help me..........
dadsadasd
|
|
|
|
|
Where is it declared? Declare it in stdafx.h.
Kuphryn
|
|
|
|
|
All global variables were declared in one file.
dadsadasd
|
|
|
|
|
Hi,
You cannot cast AfxGetApp() to CMyListView! AfxGetApp() returns a pointer to your main CWinApp.
If you want to get a pointer to your ListView, then try:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
if (pFrame && pFrame->GetSafeHwnd())
{
CMDIChildWnd* pChild = (CMDIChildWnd *)pFrame->GetActiveFrame();
if (pChild && pChild->GetSafeHwnd())
{
CMyView* pView = (CMyView*)pChild->GetActiveView();
}
}
Assuming that it is the current view...
If you have any questions, I'd be happy to help,
Andy
|
|
|
|
|
Thanks for reply,
I got problem at GetDocument() function.
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COamDoc)));
return (COamDoc* )m_pDocument;
Here I am getting assertion failure
dadsadasd
|
|
|
|
|
Hi,
To use the IsKindOf function,
Make sure the class has run-time class support. That is, the class must have been derived directly or indirectly from CObject and used the DECLARE_DYNAMIC and IMPLEMENT_DYNAMIC, the DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE, or the DECLARE_SERIAL and IMPLEMENT_SERIAL.
I've guessing that COamDoc is your derived CDocument class (??) in which case as long as you've not removed any MFC code this should be the case.
Again, if you need to gain access to the document...
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
if (pFrame && pFrame->GetSafeHwnd())
{
COamDoc* pDocument = (COamDoc*)pFrame->GetActiveDocument();
}
|
|
|
|
|
Thanks ,I was implemented, still I am getting same errors.
Actual Problem:
class CMyDoc : public CDocument
{
CListView * p1;
CTreeView *p2;
};
class CMyDoc;
class CMyDialog : public CDocument
{
CMyDoc *m;
};
void CMyDialog :: OnOk()
{
m->p1->fun(); ---------> Here I am getting an error ->Access violation
CDialog::OnOk();
}
CListView ,CTreeView are members of the CMyDOc.
Pl Help me
satya
|
|
|
|
|
I inherited some source code that was originaly written for command line apps.
Some functions have signatures as follows
void doSomething(whatever wh, FILE *fp);
so if you pass stdin or stderr it will output the result to the console.
Since I'm writing an MFC app that needs to use these functions, is there any way to redirect the output to a MessageBox, Static text or any other non console output?
|
|
|
|
|
|
I'm making an MFC appplication with CDialog as the base class. Wanna open another non modal dialog in it. Please suggest me how to do this...
All help is appreciated
Thanks
|
|
|
|
|
CAnotherDialog *pDlg;
pDlg = new CAnotherDialog;
pDlg->Create(CAnotherDialog::IDD);
pDlg->ShowWindow(SW_SHOW);
for more info read the msdn.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
don't forget to delete pDlg the variable.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Modeless dialog created via pointers generally delete themself.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|