|
Hi all,
I have made a Dialog based application in vc 2008. In my application i am opening second dialog box using DoModal() on a button click event of first dialog box. In second dialog box i am starting a worker thread in my OnInitDialog() function.My problem is while my second dialog box is still doing some work, first dialog box can be closed in the back that is it is active.
Please help me in this
Thanks in advance
|
|
|
|
|
Are you telling that you are able to close your first dialog while the second one is still active, or are you asking how to get this done?
With DoModal() , the runtime will spawn a Modal dialog, which will need to be dismissed to go back to the parent (the window that spawned it). You must use CDialog::Create[^] if you need a modeless dialog.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
No i am telling that i am able to close it and i don't want to close it. I am not getting why a modal dialog is behaving like that
|
|
|
|
|
That cannot happen. Have you checked the return value of the dialog that you spawned with DoModal() ? Also, when exactly is your modal dialog return ing?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Its returning when i close the dialog box but parent dialog box can be closed and i get the ret_value after child dialog box is closed.
Save obj;
int ret_val = obj.DoModal();
|
|
|
|
|
are you opening your second dialog from some worker/secondary thread.
IMHO, you can never operate on firt dialog if second dialog is open as model dialog!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
What happens if, in the second dialog, you comment out the thread-creation code? In other words, you have one modal dialog opening another.
"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 everybody
I am having a small querry
int * p = new int(10);
int a = 10;
int * q = &a;
then to delete pointer p
delete * p;
Whether pointer q is also created on the heap.
If so how to delete it?
Is q = NULL is correct?
|
|
|
|
|
Deepu Antony wrote: delete * p;
It's like:
delete p;
Deepu Antony wrote: Whether pointer q is also created on the heap.
Nope, heap allocation occurs only when you use any of the heap allocation functions (new , calloc , malloc , etc.,)
Deepu Antony wrote: Is q = NULL is correct?
No. q has the address of the variable a . And can be pointing to some random value if you hadn't assigned it like that.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Deepu Antony wrote: Whether pointer q is also created on the heap.
If so how to delete it?
Is q = NULL is correct?
No, q is not allocated on the heap. It just contains the address of a, you didn't allocate anything for it. Keep in mind a very simple rule: for each call to new, you should have a matching delete. No more, no less. In this case, you have one single new (for the p pointer), so you have to call delete on this pointer, and that's it.
|
|
|
|
|
|
Deepu Antony wrote: Whether pointer q is also created on the heap.
If so how to delete it?
If the momory pointed by q (pointers are ususally created on the stack) is created on the heap then you must use delete.
Deepu Antony wrote: Is q = NULL is correct?
Again, when q points heap-allocated memory you've to delete it. Invalidating the pointer afterward is a good pactice (for instance):
int * q;
q = new int[10];
if (q) delete [] q;
q = NULL;
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]
|
|
|
|
|
If you delete memory, which you didn't allocate dynamically, you surly putting yourself in trouble.
Remember simple rule, you only need to delete the memory, which is you allocate to the program!
<blockquote class="FQ"><div class="FQA">Deepu Antony wrote:</div>Is q = NULL is correct?</blockquote>
yes!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hello!
There are LsaEnumerateLogonSessions and LsaGetLogonSessionData functions which can be used to get information about the logon sessions.
But is there a way to enumerate the users that are NOT logged on?
Thanks in advance!
|
|
|
|
|
Thinking about what you're asking...
There's local users...
There's users of domain AAAA - which would require lots of traffic...
There's users of domain BBBB - which would require lots of traffic...
There's users of domain CCCC - which would require lots of traffic... oh, and this domain server is in Mongolia. Their head office guy is visiting this week.
And so on.
So, I strongly doubt it!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Eikthrynir wrote: But is there a way to enumerate the users that are NOT logged on?
Such as NetUserEnum() ?
"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
|
|
|
|
|
I think this is what I have been looking for. Thanks a lot!
|
|
|
|
|
are you talking about single computer or domain?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Single computer.
Anyway, I that NetUserEnum does the job.
|
|
|
|
|
Hi,
I want my ownerdrawn Controls, to look in the correct way.
But if call IsThemeActive() on XP I get always "TRUE", what do I wrong?
The standardcontrols look differen, wheter I have an .exe.manifest or not.
What have I to do, so that my ownerdrawn controls are drawn correctly?
|
|
|
|
|
Hai!
I have an MFC application. i build it in both release and debug build. it generates an .exe file. Can i get the name of this .exe programmatically.
within my application.
what i actually need is the name of the exe. If it has been renamed manually then i need the changed name
Thanks!
|
|
|
|
|
See GetModuleFileName()[^]
Usage:
TCHAR szPath[_MAX_PATH];
GetModuleFileName(NULL, szPath, _MAX_PATH);
AfxMessageBox(szPath);
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hey kid, you're too fast (and actually complete).
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]
|
|
|
|
|
Well, you just need a faster internet connection.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
You're are wrong: I need a faster neuron connection
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]
|
|
|
|