|
Hello,
Here is some code.. I am trying to double buffer my CListView MDI app.. I am getting all kinds of really weird drawing.. Alot of this code is from a CListCtrl double buffer.. I am trying to use it.. Anyone want to see if they can find some problems.. Thanks!!!
CRect rc;
GetParent()->GetClientRect(&rc);
if (rc.Size() == CSize(0,0))
return;
CPaintDC dc(this);
CDC MemoryDC;
CBitmap Bitmap;
CBrush Brush;
CRect rcWnd;
GetWindowRect(&rcWnd);
int rcWndW = rcWnd.Width(), rcWndH = rcWnd.Height();
MemoryDC.CreateCompatibleDC(&dc);
Bitmap.CreateCompatibleBitmap(&dc, rcWndW, rcWndH);
CBitmap *pOldBitmap = MemoryDC.SelectObject(&Bitmap);
Brush.CreateSolidBrush(RGB(255,255,255));
MemoryDC.FillRect(&CRect(0,0, rcWndW,rcWndH), &Brush);
CWMPaintHook hookHeaderCtrl(GetListCtrl().GetHeaderCtrl()->GetSafeHwnd(), MemoryDC);
Print(&MemoryDC, PRF_CLIENT|PRF_CHILDREN);
Print(&MemoryDC, PRF_NONCLIENT);
CRect rcDraw = rc - rc.TopLeft();
dc.BitBlt(rc.left,rc.top, rc.Width(),rc.Height(), &MemoryDC, rcDraw.left,rcDraw.top, SRCCOPY);
MemoryDC.SelectObject(pOldBitmap);
If you need more code, like from my .h let me know and I'll post it.
Thanks,
Rob
|
|
|
|
|
Never mind.. I just figured it out
|
|
|
|
|
Is there a class or function out there will let me pass in an string equation like "(5/12)*8" and have it return the answer as a double.
I am planning on writing a fuction to do this, but thought I would check here first.
Thanks in advance.
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
What you want is an expression parser. There are several commercial ones available, but none I would recommend.
Alexander Berthold has published one here on CP, but I have not used it personally. It can be found here:
http://www.codeproject.com/cpp/cxtpackage.asp
|
|
|
|
|
here's one: http://www.codeproject.com/cpp/functionparser.asp
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
When i write this
typedef map<int, string, less<int>, allocator<string> > strmap;
which is what the MSDN library sample does, then i get an error:
error C2143: syntax error : missing ';' before '<' like it's not expecting the "<" even though when i write the <, one of those things appear that helps you find the parameters of a function...
What's wrong?
Thanks
|
|
|
|
|
did you:
using namespace std;
or
typedef std::map<int, std::string, std::less<int>, std::allocator<std::string> > strmap;
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
it says that string isn't a member of std, can i write this instead?:
typedef std::map<int, char, std::less<int>, std::allocator<char> > strmap;
|
|
|
|
|
that will associate an int with a single char.
try this:
#include <string>
#include <map>
typedef std::map<int, std::string> strmap;
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
How do i retrieve the value again? How do i for example fill a char array with the value using strcpy?
Thankyou, your help has been greatly appreciated!
|
|
|
|
|
here's the lookup:
strmap::iterator it = myMap.find(intKey);
if (it!=myMap.end())
{
char *pChar = new char[(*it).second.size() + 1];
strcpy(pChar, (*it).second.c_str());
...
delete [] pChar;
}
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
|
Hi,
I'd like to find out if my application should start normal, minimized or maximized (as configured in start menu or explorer shortcut)?
In the application's InitInstance() I would like to detect this.
thx 4 help
|
|
|
|
|
|
m_pMainWnd->ShowWindow (m_nCmdShow);
m_pMainWnd->UpdateWindow ();
I see, thx.
PS: is there also a way to get the filename or something similar?
I like to create a (invisible) CFrameWnd and neet to set a dummy string for window name, unfortunately it is shown in the tasklist of C++ spy.
|
|
|
|
|
Look up the CWinApp class in MSDN. you will be interested in the data members of the class.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
I am trying to create a simple CEdit in a CWnd
the problem is that the editbox is 2D
I am using this
p->Create(WS_TABSTOP | WS_BORDER |WS_VISIBLE | ES_AUTOHSCROLL | ES_LEFT , rect, this,IDC_EDIT);
SetWindowLong(p->m_hWnd, GWL_EXSTYLE,WS_EX_CLIENTEDGE);
can someone help ?
thanks
Casa.Sapo.pt
|
|
|
|
|
You have to use CreateEx with the WS_EX_CLIENTEDGE extended windows style.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
|
If you want to do it with SetWindowLong() (although ModifyStyleEx() would be a better function to use) you have to force the control to redraw itself with a call to RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW)
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
Can anybody help me to export a Microsoft Word documents to XML ?
Thanks.;)
Aziz Rajim
|
|
|
|
|
Hopefully this will help you get a start ...
http://www.perlmonks.org/index.pl?node_id=113635
|
|
|
|
|
Tahnks lot RBC
Aziz Rajim
|
|
|
|
|
i am looking for some generic dll which will give me an interface to change printer settings (with out user dialog or preview) in all windows platforms (95 98 2000 NT4 and XP).. i came across some dlls which works with either one or more of the platforms but not all of them..any help finding one ? thanks
jack
|
|
|
|
|
Background: I have a MDI application that reads in a text file created by our parent company's application. The main view for the application is View subclassed from CRichEditView, I have since splitter'ed off a View subclassed from CTreeView. Therefore, when you open a document,etc, you are presented with the data from the file in the richedit view. I am then taking the data in the richedit view (ascii text), filtering and making it appear a little better. Everything up to this point is fine. When I filter the data that is being read in, I am running various searches on the text to find key words that are always in the ascii data. I am then using the CRichEditView's sibling CTreeView to "index" the keyword data. ie)lets say that the ascii data has the keyword "chk" in it 5 times. The "chk number" is always right next to the keyword "chk". I am using the TreeView to index the "chk number" and the begining line position for where that "chk number" appears (along with other keywords and positions). I then want to be able to have the user click on the "chk number" in the TreeView and automatically goto that position in the RichEditView.
Problem: I can add to the correct treeview if I update from within the treeview itself (ie, when it is constructed), but not if I call the function from another view. Here is some code.
void CEJOrganizerTreeView::OnInitialUpdate()
{
CTreeView::OnInitialUpdate();
m_ImageList.Create(IDB_SMALL_IMGLIST,16,0,RGB(0,0,0));
//GetTreeCtrl().SetImageList(&m_ImageList,TVSIL_NORMAL);
GetTreeCtrl().SetBkColor(RGB(254,239,201));
GetTreeCtrl().ModifyStyle(TVS_HASLINES,0);
GetTreeCtrl().ModifyStyle(0,TVS_HASLINES);
m_hChecks = GetTreeCtrl().InsertItem("Chks",TVI_ROOT,TVI_LAST);
// m_hChecks is a protected HTREEITEM member var
//InsertIntoChks("Test","10");
//The above works corectly when unremarked
}
bool CEJOrganizerTreeView::InsertIntoChks(CString sChkNo, CString sPosition)
//The above is predefined as a public function to access the protected members of the class
{
HTREEITEM hLast;
hLast = GetTreeCtrl().InsertItem(sChkNo,m_hChecks,TVI_LAST);
GetTreeCtrl().InsertItem(sPosition,hLast,TVI_LAST);
return true;
}
However, If I call the InsertIntoChecks function from the following code, it does not work correctly. It WILL insert into the correct treeview, but it will not insert into the the correct branch of the tree. It always posts to the TVI_ROOT.
void CEJOrganizerView::FindChks(void)
// A subclassed CRichEditView Class
{
... some initialization code...
CMainFrame* pMDIFrame = (CMainFrame*)AfxGetMainWnd();
ASSERT(pMDIFrame);
CChildFrame* pMDIChild = (CChildFrame*)pMDIFrame->MDIGetActive();
ASSERT(pMDIChild);
CEJOrganizerTreeView* pTreeView = (CEJOrganizerTreeView*) pMDIChild->m_wndSplitter.GetPane(0,0);
...some more code...
pTreeView->InsertIntoChks(sChkNo,sPosition);
...some more code...
}
My only way around this so far is to insert a new branch into the root, and then insert the "chk numbers" into that new branch, and stop the treeview fom adding the original parent items to begin with.
ie)
void CEJOrganizerView::FindChks(void)
{
... some initialization code ...
CMainFrame* pMDIFrame = (CMainFrame*)AfxGetMainWnd();
ASSERT(pMDIFrame);
CChildFrame* pMDIChild = (CChildFrame*)pMDIFrame->MDIGetActive();
ASSERT(pMDIChild);
pMDIChild->SetActiveView((CView*) pMDIChild->m_wndSplitter.GetPane(0,0)); //tried this for kicks, doesn't seem to help
CEJOrganizerTreeView* pTreeView = (CEJOrganizerTreeView*) pMDIChild->m_wndSplitter.GetPane(0,0);
HTREEITEM hCurrent = pTreeView->GetTreeCtrl().GetNextItem(pTreeView->m_hChecks,TVGN_ROOT); //using this currently, but doesn't seem to matter what is used here
//HTREEITEM hChildItem = pmyTreeCtrl->GetChildItem();
//HTREEITEM hNext = pTreeView->GetTreeCtrl().GetNextSiblingItem(hCurrent); //doesnt seem to help
HTREEITEM hChkNo;
hNext = pTreeView->GetTreeCtrl().InsertItem("Checks",TVI_ROOT,TVI_LAST);
...some more code...
hChkNo = pTreeView->GetTreeCtrl().InsertItem(sChkNo,hNext,TVI_LAST);
pTreeView->GetTreeCtrl().InsertItem(sPosition,hChkNo,TVI_LAST);
...some more code...
}
My concern is by doing it the above way, since I am not able to get to the data via my first method, am I going to be able to talk back to the CRichEditView to set the cursor position from the CTreeView? Or, will I run into a similar issue (because, even though it seems that everything is working coorectly, I am unable to get the data from the tree) when I try to make the richeditview view do something via the treeview? Hopefully, I am doing something wrong. I was hopeing to avoid sending messages from one control to another, especially since the end result is that I just need data to be moved across the two sibling views and no one else.
Thank you for any help.
|
|
|
|
|