|
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.
|
|
|
|
|
I've come across the following code
typedef struct SEXPREC {...contents} SEXPREC, *SEXP;
Why does the name SEXPREC appear twice? The first appearance seems to be giving the struct the name and the second one the typedef. This software certainly works so it must be legal but I'm confused why it is ok to use the name twice. Can anybody explain (sorry if this is a very basic question)?
|
|
|
|
|
The first one defines the structure, the second one defines the actual typedef.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Thanks, so how is this not ambiguous when used later?
|
|
|
|
|
a common practice is to call the first one the "tag" and put "_tag" or "_t" at the end of it:
typedef struct thing_tag // or thing_t
{
...
} thing;
-c
ABSURDITY:
A statement or belief manifestly inconsistent with one's own opinion.
|
|
|
|
|
it is not ambiguous because to use the first one you have to include the struct keyword. The typedef equates "struct SEXPREC" to "SEXPREC"
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Orgasms are universal!! -- Mike Mullikin in The Lounge 21:27 15 May '02
|
|
|
|
|
Is there any know problem with CDC:: SetROP2 function?
I’m using SetROP2(R2_BLACK) to force all the lines to be drawn in black despite of the pen selected in the DC. This works fine when the plot is displayed in the screen, also in the print preview. However, if the graph is printed to a PDF file, the graph is rendered in color! I have tried with different monochrome laser printers, and in some of them the graph is plotted in pure black and white while in others it's plotted in gray-scale
Also, if I copy the graph to the clipboard as an enhanced metafile and then it is pasted in Microsoft Word (Office 2000 and XP), the graph is rendered in black and white (as I would expect) but if it's edited, the graph is converted to a colored one.
I wonder if there are compatibility issues with SetROP2, particularly with R2_BLACK mode and if there is any workaround to this problem.
Thanks in advance for your help,
Carlos
|
|
|
|
|
Hi
I have a soap method which works perfectly. The only problem is with error handling. When something wrong occurs, I return a user-defined error code, so the client can exactly figure out what went wrong.
But I return my error code, the client simply receives E_FAIL (Unexpected Error), because the class generated with "Add Web References..." only knows that the server returned a 500 HTTP error code. And if I look in the web server logs, it effectively sent back a 500 error code.
Is there a way in which I could keep the existing error handling we have? Or is there another way to do this (without having to pass extra output parameters)?
tx
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
|
|
|
|
|
I've already got a multiselection CListCtrl in my application. How can I set the selection through code (example: multiselect rows 1,2 and 5)?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
TRy CListCtrl::SetItemState, with
SetItemState(nMyIndex, LVIS_SELECTED | LVIS_FOCUSED , LVIS_SELECTED | LVIS_FOCUSED);
with nMyIndex = 1, 2 and 5
|
|
|
|
|
It works invisible, but it works
If the list looses it's focus, the selection is not shown on screen (but they remain selected though). How can I set the selection visible even when the focus is transfered to another control?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|