|
Thanks Jun, I will keep plugging at it...
Mark
|
|
|
|
|
One sort of hack at it is to get the current number of items the list control displays (call it N), use Ensure Visible on the item you want to see and then on the item that is N-1 visible items away.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Here is one way to move a specific list item to the top
void CTestDlg::MoveItemToTop( int itemIndex )
{
CRect topItemRect;
CRect itemRect;
//Figure out which item is currently at the top of the list
int topIndex = m_ListCtrl.GetTopIndex();
//Get the bounding rectangle around the current top item
m_ListCtrl.GetItemRect(topIndex+1,&topItemRect,LVIR_BOUNDS);
//Get the bounding rectangle around the desired top item
m_ListCtrl.GetItemRect(itemIndex,&itemRect,LVIR_BOUNDS);
//Compute the y distance between the 2 items
CSize size(0,itemRect.bottom-topItemRect.bottom);
//Scroll the list
m_ListCtrl.Scroll(size);
}
|
|
|
|
|
I need a report or a link where I can find the steeps to change window style to XP style.
|
|
|
|
|
Hi.
There's a fair amount of coding to support the XP look, but there are a number of good articles here on that. Type do a Search on Articles for XP styles and you'll find a lot of great stuff that should help you out.
|
|
|
|
|
Hello All,
I am launching a Modal dialog box on selecting of a menu item in my SDI application. I want that dialog to be resizable.
Dialog box is created using Resource Editor and class is derived from CDialog and I launch using DoModal ().
By Default Dialog box comes only with close button. I enabled Minimize and Maximize button property it allows me maximize and minimize only (Quite Natural ) and not able to resize the dialog window. I need only resizing and not minimize and maximize the dialog window.
How can i achive it? plz guide me!!!!
Thanks for your time.
Ravi
|
|
|
|
|
I think a dialog can be resized if its Border property (in Properties panel of Dialog Editor) is set to "Resizing".
I hope this helps.
|
|
|
|
|
yeah, but only the frame will be resized, the original poster will have to manually resize/move all the controls in the dialog.
he can use one of the "resize manager" that can be found on CP to help him do that.
|
|
|
|
|
I'm somewhat new to the CMap Collection class, and I'm having trouble with my program that's using them.
Using:
- MSVS2005
- CMapStringToString
- CMap<LPCTSTR,LPCTSTR,int,int>
I've done an inithash with 1000 as the input.
Items seem to be added fine until I get around 100 items... then:
Unhandled exception at 0x00435971 in test.exe: 0xC0000005: Access violation reading location 0x726e6e75.
This occurs in the CMapStringToString::GetAssocAt function at the point indicated by the arrow:
for (pAssoc = m_pHashTable[nHashBucket]; pAssoc != NULL; pAssoc = pAssoc->pNext)
{
--> if (pAssoc->nHashValue == nHashValue && pAssoc->key == key)
return pAssoc;
}
Based on what MSVS2005 is telling me in Debug, pAssoc is not null, but the nHashValue and key properties "cannot be evaluated".
Not sure where to go from here...
Thanks for any help.
|
|
|
|
|
You probably cause data corruption somewhere else in your code.
How do you allocate the LPCTSTR that you insert?
|
|
|
|
|
Would that cause this error? If so, that gives me a good place to start debugging.
currently I am using the TConvert class _towchar to generate the LPCTSTR's. Within my loop, I checked every iteration to ensure the string was good before trying to insert it...
I can try inserting hardcoded strings to eliminate this as a possible cause though...
Thanks
|
|
|
|
|
If the memory for those strings is on the stack, when the scope that is adding them to the map is complete (e.g. the function finishes) all that memory is now invalid. You may still have "valid" data for a while, but all that stack memory is no unallocated/unprotected and will be overwritten eventually. That will cause problems later, if it isn't already.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
So, are you saying that the map does not make copies of the string data, but simply points to the strings I'm sending in?
If so, that's useless to me, any way around this?
|
|
|
|
|
LPCTSTR is not a string, it is either a const char* or a const wchar_t* depending on whether UNICODE is defined or not. So, yes, the CMap class copies the pointer, but not the string (because it doesn't know you are passing it a string).
To get around that, declare your map type as CMap<CString, CString&, int, int>
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Bingo!
Thanks, pardon my earlier cynicism... now to post a new problem with the debug heap...
|
|
|
|
|
Hello,
can someone help me with this problem in ETSLayoutManager??
thax
break;
|
|
|
|
|
Err... That's a very clear description of your problem
|
|
|
|
|
Hello Moonen,
sorry :->, ETSLayoutDialog Manager is here in the comunity, a litle framework to manage the dialog items,
mean, when dialog resize, normaly all dlg items stay on the same place, with this framework you can
replace and resize all items!
Here is the url:
http://www.codeproject.com/dialog/layoutmgr.asp
and my try:
<br />
CMyDialog* pdlg = ((CMyDialog*)m_cTabAll.GetTab(0));<br />
<br />
CPane DIALOG = paneCtrl( pdlg, HORIZONTAL, RELATIVE_VERT, 0,0,-125,0)<br />
<< item(pdlg, GREEDY);<br />
<br />
CPane TABCTRL = paneTab(&m_cTabAll,HORIZONTAL, GREEDY)<br />
<< DIALOG<br />
<< itemGrowing(VERTICAL);<br />
<br />
CreateRoot(VERTICAL)<br />
<< TOOLBAR
<< TABCTRL<br />
<< PROGRESS<br />
<< itemGrowing(HORIZONTAL)<br />
<< itemGrowing(HORIZONTAL)<br />
<< item(IDC_STATUSBAR, ABSOLUTE_VERT);<br />
<br />
<br />
UpdateLayout();<br />
hope this is a litle more information!
with best regards
berak;
|
|
|
|
|
If it comes from an article, then it's better to post in the message board at the bottom of the article if the article doesn't provide enough information.
|
|
|
|
|
Hi,
yes, that what i think before, but, in this artikle does nobody maintain this posts, they are no answers on questions !?
Therefore i think maybe is someone in the comunity who use this framework to and so can help me???
regards
break;
|
|
|
|
|
I built this little CD player for use in one of my apps using standard MCI strings and commands. What I can't figure out, is how to direct the output to a particular sound card.
By default, the output goes to whatever is the primary sound device at the time, but I figure there "must" be a way to redirect it, without changing the default output card.
Anybody do this before?
|
|
|
|
|
Hey, Rick.
I've got some MCI code in an app at the house and I'll be happy to look at it to see if I've fought that battle already. It's been awhile, and I've slept since then.
The tricky part will be remembering to take a look. Send me an email from this post to remind me, and I'll poke around and see if I can help. I seem to recall that you can enumerate the devices. If so, I'll shoot you some code.
|
|
|
|
|
hello. i am writing certain data from memory into file on the disk. how can i write the same data into a file on the FTP server??? is the process of writing data to an FTP file is same as that of writing data on to file in the local disk??
vijay
|
|
|
|
|
|
There is no such a thing called "FTP file". FTP is a protocol, which is used to transfer data in two formats: ASCII and binary.
Maybe you can clearify a bit about what you wanted? If you write data to the FTP server, which is mapped as mapped network drives on your local machine, then the write is just as you're writing to a local drive.
Best,
Jun
|
|
|
|