|
I already said that I did some excel automatisation in c++. It's a long and hard way (especially if you're going to catch the excel events too).
So don't hesitate to ask in the future, it can save you a lot of time.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Suppose there is a function having some local variables and local objects. This function calls some other function. Now at this stage do we say that local variables/objects goes out of scope. Does the destructors of local objects called here ??
OR
Do we say that local variables/objects goes out of scope when a certain function returns ??
|
|
|
|
|
They are still in scope untill the function they were declared in exits or when they reach the end bracket from which they were declared.
{
int poo;
{
//poo still in scope
}
} <-- poo out of scope and deleted.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
I have a dialog that I invoke with a button press on a Propertypage. From within the Dialog I want to acces certain propertypage member variables.
This is the way I do it.
m_List = ((CParameterPage*) GetParent())->m_ParList;
But it seems that all variables I acces are uninitialized eventhough they have correct values before I invoke the dialog!
What am I doing wrong?
|
|
|
|
|
Actually, a dialog invoked from property page isn't a child window. So you can't use GetParent; add the pointer as a memmber of CYourDialog class. If you only need to access the list, add the pointer/reference to the list instead.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Thank you,
And the compiler couldn't tell me that
Arjan.
If every fool wore a crown, we would all be king - Lard
|
|
|
|
|
I have to draw some measurepoints in the view of a CScrollView. So, have anyone a idea how to make this (FLICKERFREE!!!) on a pocket pc (no directdraw...).
Should I draw the measurepoints in a mem dc and blit that in the view?
--
Nice greets, Daniel.
|
|
|
|
|
Daniel S. wrote:
Should I draw the measurepoints in a mem dc and blit that in the view?
Exactly.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Hello,
exists there an api-function in c++ that i can use to determine the user-rights of the current user logged in in winnt (i need to know if the user has administrator-rights)?
Best regards
tabor25
|
|
|
|
|
KB article Q118626 "HOWTO: Determine Whether a Thread Is Running in User Context of Local Administrator Account" has the answer.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
There are a whole bunch of functions that you can use to test for permission to perform
various activities. Below is a chunk of code from an install tool I was writing. I got
fed up and unsed InstallShield once I realised I was being silly reinventing the wheel,
but the code pasted worked just fine!
Good luck!
Iain.;)
if (m_bIsWinnt)<br />
{<br />
TRUSTEE Trustee;<br />
ACCESS_MASK AccessMask;<br />
::BuildTrusteeWithName (&Trustee, "CURRENT_USER");<br />
<br />
PSECURITY_DESCRIPTOR pSecDesc= NULL;<br />
PACL pAcl = NULL;<br />
if (::GetNamedSecurityInfo (<br />
"MACHINE\\SYSTEM\\CurrentControlSet\\Services",<br />
SE_REGISTRY_KEY,<br />
DACL_SECURITY_INFORMATION,<br />
NULL,<br />
NULL,<br />
&pAcl,<br />
NULL,<br />
&pSecDesc) == ERROR_SUCCESS)<br />
{<br />
if (::GetEffectiveRightsFromAcl (pAcl, &Trustee, &AccessMask) == ERROR_SUCCESS)<br />
{<br />
if (AccessMask & STANDARD_RIGHTS_REQUIRED)<br />
m_bIsAdministrator = TRUE;<br />
}<br />
::LocalFree (pSecDesc);<br />
}<br />
<br />
char buf [MAX_PATH];<br />
if (!GetSystemDirectory (buf, MAX_PATH))<br />
m_bIsAdministrator = FALSE;<br />
else<br />
::lstrcat (buf, "\\drivers");<br />
<br />
if (m_bIsAdministrator && ::GetNamedSecurityInfo (<br />
buf,<br />
SE_FILE_OBJECT,<br />
DACL_SECURITY_INFORMATION,<br />
NULL,<br />
NULL,<br />
&pAcl,<br />
NULL,<br />
&pSecDesc) == ERROR_SUCCESS)<br />
{<br />
if (::GetEffectiveRightsFromAcl (pAcl, &Trustee, &AccessMask) == ERROR_SUCCESS)<br />
{<br />
if (AccessMask & STANDARD_RIGHTS_REQUIRED)<br />
m_bIsAdministrator = TRUE;<br />
}<br />
::LocalFree (pSecDesc);<br />
} else<br />
m_bIsAdministrator = FALSE;<br />
}
|
|
|
|
|
Yes, there is even one simple function in the "Settlement API" as they call it.
IsUserAnAdmin()[^]
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
are there any another better tools like Visual Assist?
|
|
|
|
|
|
|
Hi, everyone!
Such is my view about memory release and allocate of
OS, that is, when a block of memory is marked unuse in
a process (maybe by free), it is not released to the system (OS) immediately.
On the contrary, when the number of the unused memory is
large enough, then all of the memory is released to system (OS).
Am I correct?
I still have a question. Suppose in a case, when process P has
freed a memory block M, but M has not released to system (OS)
yet. Then process P is going to allocate another memory
block. Can the new memory block use the space of memory clock M?
If it is so, I think it is more faster and efficient to use memory
this way than to allocate a memory block directly from memory.
Is that so?
Cheers,
George
|
|
|
|
|
the only bit i can contribute to, relates to the reuse of memory by the OS.
i have definitely come across Windows re-using a memory address immediately after that address was freed by delete.
at the time it really confused me because i was not resetting my previous pointer to null.
ie.
myob1* pOb1 = new myob1;
:
:
delete pOb1; // forgot to reset to null. doh!
myob2* pOb2 = new myob2; // pOb2 may share the same address as pOb1 did.
pOb1->somefunc(); // things go crazy here because the momory is valid but the object type is different.
|
|
|
|
|
Thanks, DanG pal!
I still have a question. In your example,
What is the difference between the two
statements?
1. delete pOb1;
2. pOb1=NULL;
A further question, if I want to set a pointer NULL,
need I delete it before I set it NULL?
Cheers,
George
|
|
|
|
|
pOb1=NULL will not free the memory => memory leak.
if the object was created using 'new' then at some point, some where, some code should call 'delete' on it else memory keeps on being allocated and not freed and the system will degrade until it crashes (if the momory leak is large enough).
i'm being a little vague on where or who does the de-allocation because this is a big subject in itself.
|
|
|
|
|
I've created an mfc-dll and everything works fine when invoked on my computer.
When we try it on another one, it fails and says that it can't find things like MFC...d.dll. I guess the d stands for dutch.
How can I compile and link that dll so it doesn't use those other anymore?
And another question: If we put the dll in the windows/system -directory, do we still have to provide the path to it when trying to load?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Grote Smurf (aka frisco) wrote:
When we try it on another one, it fails and says that it can't find things like MFC...d.dll. I guess the d stands for dutch.
The 'd' stands for debug.
You must distribute release builds and not debug builds.
Grote Smurf (aka frisco) wrote:
How can I compile and link that dll so it doesn't use those other anymore?
You can build it statically. Usually most people have the release MFC DLLs, but just in case...
Grote Smurf (aka frisco) wrote:
And another question: If we put the dll in the windows/system -directory, do we still have to provide the path to it when trying to load?
Nope, you don't have to!
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Verry quick response! Thanks
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Hi, everyone!
I have read some source codes about Trim and Mmap operation
of memory. But I still do not understand what means Trim and
Mmap opeartions of memory. Where can I find docuemnts about
details on what means Trim and Mmap?
Cheers,
George
|
|
|
|
|
I'm lost - neither of these are C++ keywords as far as I know. trim presumably trims, for example, a string to be a subset of what it was, but what does mmap stand for ? A multimap is an STL container, but I doubt that is what you're after.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|
|
Hi, Christian pal!
I am reading the source codes of a project that
deals with memory management. It can run both
on Windows and Linux. I just know that the two
functions are used to release unused memory back
to the system. But I do not know the details.
Do you know where can I find detailed document about
the two functions?
Have a nice day,
George
|
|
|
|