|
yeah sorry before this i spent about 7 years doing web programming
lots of scripts in that lol, apologies and thnx for the help
|
|
|
|
|
|
I did some real programming before the web programming
had a hand in assembler and prolog lol 
|
|
|
|
|
Maybe you are good at web programming but c++ itself is other world with lot of detaily. 
|
|
|
|
|
I can agree to that
But im getting the hang of it
its taken me two days to get this far in API and OOP, and it took me 3 days to pretty much get the hang of MFC so
give it another week and i will atleast be getting somewhere 
|
|
|
|
|
How can I track application memory usage from application itself? For instance I want to know memory usage before and after the function call. I suspect there is a memory leak and want to track it down. Application is MFC-based
|
|
|
|
|
Have a look at GlobalMemoryStatus().
|
|
|
|
|
This is not what I am looking for. Global memory can be used by any other processes running on this PC. I cannot rely on this function to estimate memory usage for the particular application.
|
|
|
|
|
When your app is shutdown, MFC will print out objects that have not been deleted.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Try the CMemoryState class. It will work only in debug build.
You can also use the GetProcessMemoryInfo() API before and after the function.
|
|
|
|
|
Windows has the nasty habit of naming (over USB connected) camera drives with the name of the camera rather then giving them a drive letter. The camera drive will open readily in a file explorer window and a drag/drop to other file explorer windows works. However that is the end of it, drag and drop to any kind of program does not work out of the camera drive unless you copy to harddisk or a "normal" USB drive first.
The documented Drag...() functions in the Windows API accept a drap/drop from a harddisk directory but not from a camera drive.
My questions are:
How to access a camera drive over the windows API
How to accept dropped files from a camera drive.
|
|
|
|
|
Hey all, first year CS 1 student here and i am having some problems with my latest project
purpose of project: create 100 random numbers and display them in txtLog
i'm trying to change this for loop to a while... loop:
private: System::Void btnCreate_Click(System::Object^ sender, System::EventArgs^ e) {
int items;
double thick;
Int32::TryParse(txtItems->Text, items);
for (int i = 0; i<items;>{
thick = randomNumGen->Next(0,1000)/100.00;
strLog += "Chump " + i + ":\t" + thick + " mm\r\n";
}
txtLog->Text = strLog;
what i've come up with is this:
private: System::Void btnCreate_Click(System::Object^ sender, System::EventArgs^ e) {
double thick;
int i = 0;
int items = 0;
while (items > 1000);
{
thick = randomNumGen->Next(0,1000)/100.00;
strLog += "Chump " + i + ":\t" + thick + " mm\r\n";
}
txtLog->Text = strLog;
It seems to work, i get no errors, but when running and clicking btnCreate, it only lists 1 random number "Chump 0 - random number" instead of 100 random numbers in txtLog "Chump 0 - random number, chump 1, chump 2, up to 99 etc". I think that i went completely wrong when i changed it, do i need to assign i = 0 or items = 0 etc. ?
Sorry if i did this wrong! i've only been programming for a month now!
if you need more info just ask!
|
|
|
|
|
Mghand wrote: Hey all, first year CS 1 student here
I can't believe that a CS first year course is teaching managed C++ rather than native C++. What school are you attending?
Look at your code. You are setting items to Zero and then testing for items to be greater than 1000.
Mghand wrote: int items = 0;
while (items > 1000);
Use the debugger to step through the code to see what is happening. That will be much faster than posting questions on the internet.
led mike
|
|
|
|
|
1. wrong forum. this is native C++ forum, not Managed C++.
2. here is the "translation":
for (initialization; condition; incrementation) {
instructions;
}
-----
initialization;
while (condition) {
instructions;
incrementation;
}
if you can't figure out your problem with this, and with your supposed level of studies, then you're on the wrong way, and should certainly consider change your career now
|
|
|
|
|
Thanks, that translation is exactly what i was looking for,
and although depressing, i hope i'm not that bad off lol! i have no idea the difference between native/ managed c++, this is my 5th week in college now taking Computer Science 1, only working with Visual C++ (Visual Studios '08)
Using that translation my program is working just fine with the while loop, thanks alot! and sorry for any confusion! i will look for a more appropriate forum next time for these questions
|
|
|
|
|
Mghand wrote: while (items > 1000);
Study this statement.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
Hi,
in my app I'm using CListCtrl (owner data) not enabling full row select.
How can I hilite cell (subitem) on which user clicked?
Is this requiring for owner drawn fixed, or this can be achieved without it?
If you can point the way...
Thanks!
|
|
|
|
|
josip cagalj wrote: Is this requiring for owner drawn
I believe owner draw would be the way to do that
led mike
|
|
|
|
|
|
josip cagalj wrote: Is this requiring for owner drawn fixed
I think by handling the NM_CUSTOMEDRAW notification, we can achive this. There are some sample in the codeproject itself that handles the NM_CUSTOMEDRAW in list ctrl/view. Check them...
modified on Wednesday, October 1, 2008 2:48 AM
|
|
|
|
|
Are you sure I can hilite cell (not entire row) where user clicked just by handling NM_CUSTOMEDRAW notification?
Anyway thanks for your help.
P.S.
How to get row&column info where click occur?
|
|
|
|
|
josip cagalj wrote: Are you sure I can hilite cell
99%
josip cagalj wrote: How to get row&column info where click occur?
First handle the NM_CLICK event. From that function, you can get the row and column in which the user clicked. Save this information in some variable.
The NM_CUSTOMEDRAW, will be sent before the list controls draws each column in the list control. It gives a structure that contains some variables that represent the background color, text color etc of the column to be drawn. You can change the value in those variable and the list control will draw the column with those colors. So what I am saying is, when ever the list control send a NM_CUSTOMEDRAW message and the item and subitem matches the values that we stored in NM_CLICK, change the value of the variable in the structure with the desired one.
|
|
|
|
|
Ok. this is my code
void CIMAPIListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
int cur_col=pDispInfo->item.iItem;
int index = GetNextItem(-1, LVIS_SELECTED);
CString message;
message.Format("Clicked on item: %d,%d",index,cur_col);
AfxMessageBox(message);
*pResult = 0;
}
line int index = GetNextItem(-1, LVIS_SELECTED); always returns -1? It's because LVIS_SELECTED !?
Maybe int HitTest( CPoint pt, UINT* pFlags = NULL ) but how to extract point from NMHDR* pNMHDR or LRESULT* pResult parameters in OnClick method?
modified on Wednesday, October 1, 2008 4:24 AM
|
|
|
|
|
It should be actually like this...
void CIMAPIListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMITEMACTIVATE pListItem = (LPNMITEMACTIVATE)pNMHDR;
LVHITTESTINFO stInfo = {0};
stInfo.pt = pListItem->ptAction;
SubItemHitTest( &stInfo );
m_nRow = stInfo.iItem;
m_nColumn = stInfo.iSubItem;
*pResult = 0;
}
|
|
|
|