|
It may have everything to do with keeping VTables on 4-byte boundaries.
Since VTables will resolve into pointers to functions in derived classes, they want to keep them aligned so the performance on the CPU is better.
As an experiment, you can try changing
public:
int b;
base()
into
public:
byte b;
base()
And you will still probably get 12.
Then try
public:
int b;
int c;
base()
And you might still get 12.
I think it has do do with optimizing pointers to tables of function pointers, myself.
|
|
|
|
|
Hello Guys,
How ru doing, I need some help in FTP, first i will clearly explain u the situation.....
i have one one FTP user login, i have logged into the FTP server with that login, now by code i need to know how much space like .... The total space allocated for the user, the space occupied by the user, and the remaining space.
currently i have one solution...but its not working fine...i.e i can execute a FTP command through code like "ls", doing this will return a string to me containing the result(text string) for the executed command. the problem here is this is not working all the time....if the data commection is lost it just hangs offff and many other problems are there.
guys plz help me out of this problem....waiting for the solution
|
|
|
|
|
in UNI*/perl
<br />
$dir = "/myserver/mydir";<br />
$aa=qx(du -s -k -m $dir);<br />
print "<BR>size of website in MB $aa<BR>";
in FTP I think your only solution is to manually recurse through all the subdirectories geting the size of each file, if you are using the MFC CFtpFileFind is one solution
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Ted...thanks for ur reply man...
Actually the Server which iam going to connect is Windows wunning Windows Media Server
as u said iam able to get the size of the files in the server...but i need one more thing...i.e the maximum space allocated for the user...i.e in my application i upload some as per the user request...when uploading the file, i should the left out empty space for the user..if its less then i have stop the upload ...this is the scenario....got it fed....can u help me out of this solution
|
|
|
|
|
Sorry can't help you there.
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Hi.
I am new to MFC/VC++.
please guide me.
I create three -page on a property sheet like page1,page2 and page3.page1 contains three text box which take integer value.Now. I create three member variable of int type like
m_nText1
m_nText2
m_nText3
I would like to do that when I click On 'OK' button on a proerty sheet.It should add two integer values(m_nText1+m_nText2) and display in the third text box(m_nText3).I want to do through constructor.
Any help appriciated
Thanks
rajesh
|
|
|
|
|
When you click the property sheet OK button it will close the property sheet.
I suggest you do something like this:
1) Add a button to your page called "Calculate" for want of a better name.
2) Add the appropriate handler for the button press BN_CLICKED.
3) In the button handler code, add your values and set the third control.
When you press the calculate button you will then see the result.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
|
i m using VC++ n Access as Database
if i m using hard code values of date n month n year its gives result fine
as query is
rs->Open(AFX_DB_USE_DEFAULT_TYPE, "SELECT * FROM Record WHERE (([Record].[Date] Between #9/27/2001# And #7/30/2004#))");
But i wanaa use values of date . year n month that r input by user .. in form of String or integer in variables .. m_date . m_month .. and m_year.
how can i use these variables values in Query now
i used like this but Wrong Query message appears
rs->Open(AFX_DB_USE_DEFAULT_TYPE, "SELECT * FROM Record WHERE (([Record].[Date] Between #m_month/m_date/m_year# And #m_month1/m_date1/m_year1#))");
I also Tried by TO_Date Function ,, but its said undefined function
how can i do it by user values ..
thanx
|
|
|
|
|
Anonymous wrote:
i used like this but Wrong Query message appears
rs->Open(AFX_DB_USE_DEFAULT_TYPE, "SELECT * FROM Record WHERE (([Record].[Date] Between #m_month/m_date/m_year# And #m_month1/m_date1/m_year1#))");
You have the right idea here. First create a valid SQL string, using the variables that you have set up for user input.
So if you have the int variables: m_monthx, m_datex and m_yearx. Then all you have to do is modify your code like:
<code>
CString strSQL.
<font color=green>
strSQL.Format(_T("SELECT * FROM Record WHERE (([Record].[Date] Between #%d/%d/%d# And #%d/%d/%d#))"),
m_month1, m_date1, m_year1, m_month2, m_date2, m_year2);
<font color=green>
rs->Open(AFX_DB_USE_DEFAULT_TYPE, (LPCTSTR)strSQL);
</code>
I Dream of Absolute Zero
|
|
|
|
|
I have a menu "Options" with one submenu "Start"
Options>Start
How can i change the caption of "Start" to "Stop" when i click the menu?
|
|
|
|
|
Handle the ON_UPDATE_COMMAND_UI event for your "Start"/"Stop" menu item and then in that handler function something along the lines of...
if(bStartMode)
pCmdUI->SetText("Start");
else
pCmdUI->SetText("Stop");
You could have code in the ON_COMMAND event handler to toggle the mode from start to stop. Hope this helps.
Happy Programming and God Bless!
"Your coding practices might be buggy, but your code is always right."
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I tried that, but i doesnt work. I'm using VC++6 with SP5 and my program is a dialog based program.
<br />
void CTestUImageDlg::OnUpdateFileExit(CCmdUI* pCmdUI) <br />
{<br />
pCmdUI->SetText("Start");<br />
}<br />
Nothing happens!
Why??!!
|
|
|
|
|
Why have you put the code in the update handler for FileExit?
You need to put it into the update handler for the menu item Start in the options menu.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I know that, i was testing if my Exit menu item will change it's caption. It was a test app, which does nothing. Just a menu with File>Exit. Clicking the Exit does not execute any function. So i just wanted to test if the caption changes, but it doesnt! Why?
|
|
|
|
|
I tried the samething with SDI app. And it works. But it doesnt in my dialog based app. Anyone?
|
|
|
|
|
I have a wizard97 application i want to make the next back etc. buttons more jazzy how can i subclass them or is there another way
thanks a bunch already
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
http://www.mastishk.com
|
|
|
|
|
|
Hi All,
I have Win 2000 and VS 6.
We have developed an application which is suppose to run on all Windows OS. Application is devided in two parts mainly and those two parts communicate with each other over the network.
But when it comes to WinXP SP2 it fails because of the Firewall.
So we decided to change the firewall settings programmatically.
I cut the CD from image version of WinXP SP2 Platform SDK available at
http://www.microsoft.com/downloads/...&displaylang=en
After installing the above Platform SDK I also registred the PSDK Directories with VS by clicking on Start-->Programmes-->Microsoft Platform SDK for Windows XP SP2-->Visual Studio Registration-->Register PSDK directories with Visual Studio.
After that when I am trying to rebuild my VC++ apllication it gives me following two compilation errors.
1. C:\Program Files\Microsoft Platform SDK for Windows XP SP2\include\objidl.idl(2554) : error MIDL2025 : syntax error : expecting a type specification near "ULONG_PTR"
2. C:\Program Files\Microsoft Platform SDK for Windows XP SP2\include\objidl.idl(2554) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
What are the settings which I should take care? I even read 'Read Me' and Getting Started documents coming with the PSDK. But I could not solve it. These documents basically suggest everythign for compiling using .mak files. I am not using .mak.
I have also made it sure that SDK include, lib and bin directories are list before Visual C++ include, lib and bin directories (from toos->options->directories in the IDE).
How to solve this? Any idea?
I will appreciate your help in this regard.
--------------
Vaibhav...
|
|
|
|
|
Hi
I have one question regarding on how to make my program run faster.
I use std::vector in my app, and I often do something like:
for(int ii = 0; ii < a_vector.size(); ++ii)
{
... codes here
}
I am wondering, will storing the a_vector's size before the loop and using it instead of calling a_vector.size() method on each iteration provide better performance?
Thanks!
|
|
|
|
|
I assume it will, since you don't have to make a function call. I also assume you're not changing the size of a_vector within the loop.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I would use a variable.
For further reading:
http://www.codeproject.com/tips/optimizationenemy.asp[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Possibly, but probably not. The size() method is an inline method that simply returns the value of a member variable, so if your compiler optimises correctly it should boil down to a simple comparison with a indirect-indexed value, just the same as if it was a local variable you were comparing against. However, it's probably a good idea to store the size locally anyway, just in case the compiler doesn't optimise it for some reason, and to make it more obvious to humans that you want the code to run as fast as possible.
Obviously, if the size of the vector changes inside the loop, then you'll have to either call size() each time or update your local variable every time you do something that changes the size of the vector (add, delete etc...)
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Why not create two small functions and test it? Remember to run in release-mode.
|
|
|
|
|
I would compare the assembly when compiled in release mode.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|