|
The best you could hope to come from TM is to show the size of the address space that is in use, not the amount of that address space that your program is actually using. Perhaps you are confusing address space with program size.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am talking about the Mem usage column in the processes tab.
I think this represents the memory usage by the application.
|
|
|
|
|
this is not the answer to your question, but for loading a bitmap from the disk, you dont need to pass the hInst to the function!
Don't try it, just do it!
|
|
|
|
|
Still no difference..
One more strange thing is when some of function been called, It will increase the memory usage by 4KB.Those function don't allocate anything......
|
|
|
|
|
Neha wrote:
One more strange thing is when some of function been called, It will increase the memory usage by 4KB.Those function don't allocate anything......
How do you know? When you call a function that is not your own, are you sure of what it does, or doesn't do, behind the scene?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
If you execute that code 100 times does it increase the memory in task manager by 2800 K?
If yes, then it is a memory leak.
If no, it is just increasing the process address space one time to reflect the additional library code you used.
|
|
|
|
|
Yes,It increases by 2800K........
|
|
|
|
|
Write a program that doesn't do anything
main()
{
return 0;
}
Now see how much memory this takes in task mgr. According to you it shud take 0 bytes!!
|
|
|
|
|
hi,
is someone familiar with manipulating PE/COFF Files. I need to add a DLL into the import Table, but that's a damned hard job. One of my problems is, that i can't create a valid Relative Virtual Address (RVA). I need help.
Thanks in advance!
|
|
|
|
|
what is the problem with it?
Don't try it, just do it!
|
|
|
|
|
There are a few problems.
Number 1: You can't simply add as much DLL Entries as you want into the Import Table, without changing the rva's of the following sections.
Number 2: You have to find a place in the .exe/.dll file which is mapped into the memory
Number 3: The place must be big enough to hold every needed information, such as the name of the dll you want to add
Number 4: You must calculate a valid RVA for the position where the name of the DLL is located.
Number 5: ... Number 4 seems not to be the last point to pay attention for, because if you fixed every mentioned problem, it still won't work!
Do you know a better solution ?
Thanks in advance!
|
|
|
|
|
Microsoft may not want you tampering with their binaries, there may be safeguards in there, too.
J.
----------------------------
|
|
|
|
|
Hi all,
i am creating a dialog like this:
CBDRMainDlg dlg(IDD_BDR_DIALOG);
dlg.AddTitleButton(<big>CBDRMainDlg::CloseDialog</big>,
IDB_CLOSE_BTN_UP,
IDB_CLOSE_BTN_DOWN,
IDB_CLOSE_BTN_OVER,
IDB_CLOSE_BTN_DISABLED);
as you can see the first parameter is a pointer to a method CBDRMainDlg::CloseDialog
the method AddTitleButton is defined like this:
typedef void (* FUNC_PTR)(...);
.
.
.
void AddTitleButton(FUNC_PTR func,
UINT idNormal,
UINT idDown,
UINT idOver = 0,
UINT idDisabled = 0,
CString szTitle = _T(""),
COLORREF rgbTextColor = BUTTON_FX_BASE_TEXT_COLOR,
enBtnState eBtnState = bsNormal);
as you can see the first parameter is a typedef of a pointer to a function.
the passed method is defined like this:
.
.
public:
void CloseDialog();
trouble is a get an error compilation:
"error C2664: 'AddTitleButton' : cannot convert parameter 1 from 'void (__thiscall CBDRMainDlg::*)(void)' to 'void (__cdecl *)(...)'
There is no context in which this conversion is possible"
can any1 help?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I bet CBDRMainDlg::CloseDialog is not static...
Thats the ususal gotcha.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
hi thanks for reply
trouble is when i change the mothod CloseDialog from :
public:
void CloseDialog();
to
public:
static void CloseDialog();
i get the following 2 errors:
"...... : error C2664: 'AddTitleButton' : cannot convert parameter 1 from 'void (__cdecl *)(void)' to 'void (__cdecl *)(...)'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Generating Code...
Compiling...
BDRMainDlg.cpp
...... : error C2352: 'CDialog::EndDialog' : illegal call of non-static member function
c:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(2610) : see declaration of 'EndDialog'"
the method CloseDialog has this body :
void CBDRMainDlg::CloseDialog()
{
EndDialog(1);
}
i know that the static method shouldn't call EndDialog.. one way to resolve that is to pass the dialog CBDRMainDlg pointer to the method CloseDialog as follows:
void CBDRMainDlg::CloseDialog(CBDRMainDlg* pDlg)
{
pDlg->EndDialog(1);
}
but if i do that, how do i send the CBDRMainDlg* as a parameter in the method:
dlg.AddTitleButton(CBDRMainDlg::CloseDialog, <====what do i pass here???
IDB_CLOSE_BTN_UP,
IDB_CLOSE_BTN_DOWN,
IDB_CLOSE_BTN_OVER,
IDB_CLOSE_BTN_DISABLED);
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
The parameter to the CloseDialog call (via your function pointer) is 'this ', or do I miss something?
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hi all,
i am generating a word report using OLE Automation.It has all the things that a Detailed report can have from Header to footer.I am using mail merge to populate the data in the report.This data i am fetching from an access database.
My problem is with table of contents.The main document with all the fields contain the table of contents.This table of contents is not being merged
in the new merged document.It is displaying it like a normal text (not TOC Field) and showing values with mergefields name(not values) in the headings(the headings do have some mergefields in them).
Did anybody work on similar thing.
Please help me regarding this.
|
|
|
|
|
Hi,
How can I convert an int (or a double) to a CString, wich contains a hex value.
Example:
I've got an int, called 'a', with value 33.
And I need to get a String with the hexadeciaml value of 'a', wich means (in this case) that I need a CString containing "21".
Do you know wether is some fkind of function for this???
Thanks
|
|
|
|
|
Here you go.
As always thrown together and untested but should work.
int nValue = 33;
CString str;
str.Format("%x", nValue);
There are 10 types of people in the world
Those who understand binary, and those who don't
|
|
|
|
|
|
Hiya,
int a =33;
CString lHexValue;
lHexValue.Format("%x",a);
Cheers
Loz
|
|
|
|
|
Hey u can use this :
long str2hex(char *str)
{
long hwnd=0;
char ch;
::CharUpperBuff(str,8);
for(int i=0;i<8;i++)
{
ch = str[i];
if(ch>=48 && ch<=57) hwnd+=(ch-48)*1<<(4*(7-i));
else if (ch>=65 && ch<=70) hwnd+=(ch-65+10)*1<<(4*(7-i));
}
return hwnd;
}
-Vladimir India
|
|
|
|
|
What is wrong with this:
template <int I_location, class T_bound1, class T_bound2, class T_functor>
inline bind_functor<I_location, typename unwrap_reference<T_bound1>::type,
bind_functor<I_location?I_location+1 , typename unwrap_reference<T_bound2>::type, T_functor> >
bind(const T_functor& _A_functor, T_bound1 _A_b1, T_bound2 _A_b2)
{
return bind_functor<I_location, typename unwrap_reference<T_bound1>::type,
bind_functor<(I_location?I_location+1 ), typename unwrap_reference<T_bound2>::type, T_functor> >
(bind<(I_location?I_location+1 )>(_A_functor, _A_b2), _A_b1);
};
The compiler error message is:
error C2143: syntax error : missing ',' before '<end Parse>'
Thanks!
|
|
|
|
|
Where is "end Parse"?
Kuphryn
|
|
|
|
|
That's the funny thing, there isn't such a string in there...
|
|
|
|