|
akashag wrote: Between, I assume that by 'fixed program memory', you mean heap. Isn't it?
No, I mean fixed program memory.
akashag wrote: Secondly, at what time storage for them is reserved?
As I said before, at compile time.
Static data whether global or class is allocated by the compiler, it is not dynamic (i.e. run time allocated).
|
|
|
|
|
akashag wrote: I want to know that when & where does the storage for static data members of a class is defined and what is it's life time.
Hi Akash,
Static data members are having global scope comparing to local variables. The simple example for this is when ever you are trying to create a static variable inside a class it gives an error. That is the memory is allocated to class variables at run time. Where as memory allocation done at compile time in case of static variables. So when ever i am creating variable inside a class means I giving memory at run time, both the things are contradiction.
A variable for that memory allocation done at only once called static variable.
sampath-padamatinti
|
|
|
|
|
sampath-padamatinti wrote: The simple example for this is when ever you are trying to create a static variable inside a class it gives an error.
What does this mean? It is quite correct to have static variables in a class: they are known as class variables.
sampath-padamatinti wrote: That is the memory is allocated to class variables at run time.
No, class variables are allocated at compile time.
sampath-padamatinti wrote: both the things are contradiction.
|
|
|
|
|
I have slightly changed the query. Changed part is put in italics
i have a button in my dialog based application which calling a thread, This thread in-turn calls another function, this function is in a different class which actually does file manipulation (basically i am converting some text files to binary files). Now how do i display which file is getting converted in the main dialog where i am calling the thread?
modified on Wednesday, October 7, 2009 3:05 AM
|
|
|
|
|
One way to do it is to send user defined messages to your main dialog. Here[^] is a great article that you should read if you want to better understand threads and the interaction with the UI.
|
|
|
|
|
Chandru080 wrote: Now how do i display which file is getting converted in the main dialog where i am calling the thread?
PostMessage() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Good morning ,
quick question. How do I set the shell title for a c++ program?
Souldrift
|
|
|
|
|
|
God, I couldn´t find that anywhere. You are my hero today .
Thanks.
Souldrift
|
|
|
|
|
i am doing a project on customization of minix 3 to my native language if anyone has any contributing ideas i will be glad
|
|
|
|
|
Please post it in the Collaboration / Testing [^] forum.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello everybody I have observed a strange behaviour in Win Vista and 7 when I call the GetProcAddress to resolve it self
GetProcAddress(GetModuleHandle("kernel32.dll"),"GetProcAddress") returns wrong value.
I compare the return value with the windbg and its way different (though in a valid 0x7000000-0x7ffffff range).
I 've seen some reports on the web about it but I dont know how to overcome this problem.
Any ideas?
Thanx
|
|
|
|
|
What addresses are you seeing?
In the VS debugger, I see my program enter the same address (0x76E81202) that both &GetProcAddress and GetProcAddress(GetModuleHandle(L"kernel32.dll"),"GetProcAddress") return - this is under Windows 7 x64.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Attach the Windbg and look for GetProcAddress it should be a different one.
In my case it points to GetProcAddressStub instead of GetProcAddress.
In some other examples I tried involving dll injection the address is far more out of
the kernel32.dll range
|
|
|
|
|
Ok I managed to narrow it down. You where right about .exe it works fine.
BUT in case of a dll run by rundll32.exe things change and GetProcAddress returns always wrong
|
|
|
|
|
How to deallocate from MFC GUI application the data that was allocated in MFC thread?
Upon a button click in MFC dialog application, the thread is started with AfxBeginThread, it allocates some float* array with malloc() then send to MFC application a windows message attaching that buffer.
It is not possible to deallocate it from MFC dialog message handler that float* array with free()??? It returns heap corruption, is it due to deallocation from another thread or some buffer overrun?
Чесноков
|
|
|
|
|
i guess it might be due to buffer overrun or due to something like the following might have happened...
in one thread...
float *f = (float*)malloc(100*sizeof(float));
in another thread u r receiving the memory, say in 'ftemp'
afterward in this second thread u might be accessing ftemp by either
incrementing or decrementing like this...
ftemp--; or
ftemp = ftemp + 1;
etc,..
and finally the deallocation task..
free(ftemp);
|
|
|
|
|
Chesnokov Yuriy wrote: It is not possible to deallocate it from MFC dialog message handler that float* array with free()???
Yes, assuming the address has not been changed.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All
I am getting excel rows and columns through this way.
Excel::RangePtr pRange = sheet1->UsedRange;
if ( pRange == NULL )
{
return 0;
}
VARIANT var=pRange->GetValue();
if(var.vt==VT_EMPTY)
{
return true;
}
long row;
long col;
COleSafeArray sarect(pRange->GetValue());
sarect.GetUBound(1,&row);
sarect.GetUBound(2,&col);
it's working well but i have found some specific case error.Like when excel sheet content only one cell value then showing debug assertion failed.
File:f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\olevar.cpp
Line:1817
COleSafeArray& COleSafeArray::operator=(const VARIANT& varSrc)
{
ASSERT(varSrc.vt & VT_ARRAY);
if(!(varSrc.vt & VT_ARRAY))
AfxThrowInvalidArgException();
AfxCheckError(::VariantCopy(this, (LPVARIANT)&varSrc));
return *this;
}
Plz help me.
|
|
|
|
|
Hi,
SheetCalculate function is getting fired whenever there is change in function(like =sum(A1,A2)) related Excel workbook cells. My aim is to get the function result in excel. To get that I'm trying by calling different functions of iDispatch. But couldn't able to get the expected result. Please guide me to read the function result. Thanks in advance.
_ATL_FUNC_INFO SheetCalculateInfo = { CC_CDECL, VT_EMPTY, 1, { VT_DISPATCH } };
BEGIN_SINK_MAP(ExcelBookEventHandler)
SINK_ENTRY_INFO(1, __uuidof(Excel::WorkbookEvents), 0x0000061b, &ExcelBookEventHandler::SheetCalculate, &SheetCalculateInfo)
END_SINK_MAP()
void _stdcall SheetCalculate(IDispatch *iDispatch)
{
////////////*******GetIDsOfNames*******////////////
static DISPID dispid = 0;
wchar_t *ucName = L"Evaluate"; //I tried by giving "Run" and "Calculate" values in place of "Evaluate"
HRESULT result = iDispatch->GetIDsOfNames(IID_NULL, &ucName, 1,LOCALE_SYSTEM_DEFAULT, &dispid);
////////////*******Invoke*******////////////
VARIANT varResult;
DISPID dispid;
DISPID dispidNamed = DISPATCH_METHOD;
EXCEPINFO excep;
UINT uArgErr;
DISPPARAMS dispparams;
dispparams.cNamedArgs = 0;
dispparams.cArgs = 2;
dispparams.rgdispidNamedArgs = &dispidNamed;
HRESULT result = iDispatch->Invoke( odispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparams, &varResult, &excep, &uArgErr);
////////////*******GetTypeInfo*******////////////
ITypeInfo* pTypeInfo;
HRESULT result= iDispatch->GetTypeInfo(0,LOCALE_SYSTEM_DEFAULT,&pTypeInfo);
////////////*******GetTypeInfoCount*******////////////
UINT pct1;
HRESULT result= iDispatch->GetTypeInfoCount(&pct1);
////////////*******QueryInterface*******////////////
HRESULT result = iDispatch->QueryInterface(IID_IDispatch,(void**)&iDispatch);
}
|
|
|
|
|
hi
i have little bit problem in how to get folder path ??
UpdateData();
CFile __file;
CFileDialog __FileDialog(true,"*.*",NULL,OFN_EXPLORER,"All Files : (*.*)|*.*||");
if (__FileDialog.DoModal() == IDOK)
{
if( __file.Open(__FileDialog.GetFileName(), CFile::modeRead) == FALSE )
return;
<big>CArchive ar(&__file, CArchive::load);</big>
}
__file.Close();
UpdateData(true);
here output is : D:\2009\October\Visual Studio Projects\visual\centerI.TIF
but i need save this file path :
D:\2009\October\Visual Studio Projects\visual\
please how to get folder path ?
Thanks
|
|
|
|
|
raju_Code wrote: please how to get folder path ?
__FileDialog.GetFolderPath()
|
|
|
|
|
Thanks for your response Mr.Naveen
its throwing exception ..
when comes __FileDialog.DoModel()
its open's system dialog its having Open and Cancel button
i need Save and Cancel button //
Thanks
|
|
|
|
|
raju_Code wrote: i need Save and Cancel button //
Read some documentation[^]
|
|
|
|
|
i think its not possible na?
|
|
|
|