|
Thank you very much! I'll check that.
You are very helpful.
Best regards,
Ing LengIeng
Software Developer
|
|
|
|
|
Hi all,
Wat is the difference between closing a dialog by using CDIalog::OnOK() or PostQuitMessage(0).
Can I use both at a time?
Regards
Babu
|
|
|
|
|
Both have different usage. What do you want to do? To close a dialog, why not use EndDialog()? which is straight forward.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
Babu@codeproject wrote: Wat is the difference between closing a dialog by using CDIalog::OnOK() or PostQuitMessage(0).
PostQuitMessage will quit your entire application always.
But OnOk will close only the dialog it is called for ( if it is not main dialog)
Also OnOK will call UpdateData().
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
|
|
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Please Stop posting same question.
You have got answers to previous posts Try and do something based on those answers...
Regards,
Sandip.
|
|
|
|
|
|
Instead, read carefully the posting guidelines (even if they are no more at the top of the forum... ) before posting.
No one here will help you if you:
- post again and again the same question.
- make such stupid and rude replies.
BTW probably *any* idea is a surplus for your brain.
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]
|
|
|
|
|
|
The good answer is:
"Be polite, study harder, check previous answers (see, for instance [^] ), use profitably Google and CodeProject's article search engine."
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]
|
|
|
|
|
I want to add a button to my app, I am thinking, a function call to create an area that when clicked would jump to some callback function. I could use this to change the image in the area just clicked, and perform what ever action I want due to the button press.
I think I need to use CreateWindow() to do this, but I'm not figuring much else about this.
I have not been able to find an example that is simple and straightforward for C on a WM5 device.
If anyone knows of an example or simple explanation that would help, I'd appreciate it.
|
|
|
|
|
Hi, I am still a newbie in MFC
I 've got a problem with my console application program
I use one thread in there , which is I use CWinThread
and it terminates when time is equal to timeout
but I need to handle if the user want to terminate immediately in the console application
so the way I did is
I create this function
BOOL WINAPI ConsoleHandler(DWORD CEVENT)
{
switch(CEVENT)
{
case CTRL_CLOSE_EVENT:
myClass.CleanUpThread();
break;
}
return TRUE;
}
so when the user want to immediatelly, it will go to that function and clean up the thread
however, everytime, I test and debug, I always windows ballon said that "windows cannot end this program, it may need more time to complete an operation"
How to disable that ballon? so i dont want user to see that one, and the program will wait until the thread is cleared.
Thanks so much,
|
|
|
|
|
Clean up thread? I think you are trying to clean up a live wire with your wet hands. Are you trying to terminate() your thread by force? if yes never do it. Just come out of the loop with a boolean condition check like.
<br />
while(bRunThread)<br />
{<br />
}<br />
When the user wants to come out, just set bRunThread =false.. and you can also use events to make sure the thread has really exited.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
thanks I've fixed that one
|
|
|
|
|
What was the problem?
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
I changed the way my program works.
instead, waiting for period of time, then shutdown
I keep it loop until keyboard event occurs or user press close
and I discovered that there were some memory leaks in my program.
I fixed the memory leak, change the program flow and done
Anyway, thanks for your help
Regards,
Arif Liminto
|
|
|
|
|
Are there any rules of thumb, guidelines, issues with, etc... about having a return in a catch block?
For example:
try {
// Some code...
} catch (std::exception &) {
// log error
return -1;
}
Also try this test using VC with VS 2005 SP1 (Microsoft Visual C++ 2005 77626-009-0000007-41138)
1) Create standard MFC dialog based application
2) Add new method with signature: int foo();
3) in foo add the following code:
std::vector<int> v;
try {
v.push_back(1);
} catch (std::exception &;) {
return 1;
}
// Just some code that does something...
if (v.size()) {
}
return 0;
4) Step through the code in debugger. On several systems, I see the debug statement indicator move onto the line with "return 1". The disassembly code is very strange indeed.
Any comments from the guru's out there?
Thanks!
|
|
|
|
|
clawton wrote: Are there any rules of thumb, guidelines, issues with, etc... about having a return in a catch block
Should be fine.
clawton wrote: Step through the code in debugger. On several systems, I see the debug statement indicator move onto the line with "return 1".
Yeah, that happens - it all depends how the debug information's been distributed through the code. Is it in Release or Debug mode? Debugging in Release mode is...interesting.
clawton wrote: The disassembly code is very strange indeed
In what sense?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote:
Is it in Release or Debug mode?
Debug mode.
Stuart Dootson wrote:
clawton wrote:
The disassembly code is very strange indeed
In what sense?
Well, I see the line with "return 1" in there twice...
Pasting from the dissassembly output window:
std::vector<int> v;
004131C6 lea ecx,[ebp-34h]
004131C9 call std::vector<int,std::allocator<int> >::vector<int,std::allocator<int> > (4110C3h)
004131CE mov dword ptr [ebp-4],0
try {
004131D5 mov byte ptr [ebp-4],1
v.push_back(1);
004131D9 mov dword ptr [ebp-118h],1
004131E3 lea eax,[ebp-118h]
004131E9 push eax
004131EA lea ecx,[ebp-34h]
004131ED call std::vector<int,std::allocator<int> >::push_back (4119B5h)
004131F2 jmp $LN5 (413211h)
} catch (std::exception &) {
return 1;
004131F4 mov dword ptr [ebp-10Ch],1
004131FE mov dword ptr [ebp-4],0
00413205 mov eax,offset $LN9 (41321Ah)
0041320A ret
void CCatchTestDlg::OnBnClickedOk()
{
Test(1,0);
}
int CCatchTestDlg::Test(int foo, unsigned char * goo)
{
std::vector<int> v;
try {
v.push_back(1);
} catch (std::exception &) {
return 1;
}
0041320B mov eax,offset $LN5 (413211h)
00413210 ret
} catch (std::exception &) {
return 1;
00413211 mov dword ptr [ebp-4],0
00413218 jmp $LN9+17h (413231h)
$LN9:
0041321A mov dword ptr [ebp-4],0FFFFFFFFh
00413221 lea ecx,[ebp-34h]
00413224 call std::vector<int,std::allocator<int> >::~vector<int,std::allocator<int> > (41192Eh)
00413229 mov eax,dword ptr [ebp-10Ch]
0041322F jmp $LN9+54h (41326Eh)
if (v.size()) {
00413231 lea ecx,[ebp-34h]
00413234 call std::vector<int,std::allocator<int> >::size (4115A5h)
|
|
|
|
|
I think I see 'return 1;' three times...
I think the reason is that there's more code thn you expect round an exception handler (unhandled case, handled case, no exception case) and the disassembler puts in hte source code context for each one.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I think I see 'return 1;' three times...
I think the reason is that there's more code thn you expect round an exception handler (unhandled case, handled case, no exception case) and the disassembler puts in the source code context for each one.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
some people insist on having just one return statement in a function; that makes having it in a
catch block rather hard. If you feel more lenient, go ahead.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I guess there's nothing so wrong with returning -1 from catch block. But I personally, just HATE it.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|