|
Well, the first thing that springs to mind is that you can't arbitrate access to any external shared resources with this method e.g. shared RAM. However, the use of something like a Semaphore in the context of a multi-processor kernel would allow this. In general, it is always best to think twice about disabling interrupts to implement mutual exlusion since any time spent in this state will increase interrupt latency - which may not be desirable.
Phil
|
|
|
|
|
Hi
I want to bring up a dialog box when a button is clicked.I'm having problems getting the dialog box to appear when I click on the file.
My code is:
void CMainFrame::OnSFile() <br />
<br />
{ <br />
<br />
m_chatterChooser.DoModal(); <br />
}
And I've declared in the header:
CDialog m_chatterChooser;
Is this correct?
Thank you.
|
|
|
|
|
Did you create a dialog ressource and derived a new CDialog class based on this ressource?
Gero
|
|
|
|
|
I created the resource, but no.. didn't derive a new CDialog class. I thought I didn't have to.
I will try that. Thank you!
|
|
|
|
|
Use class-wizard to generate the derived class from CDialog. Remember to select the right dialog ressource id when generating the derived class.
Gero
|
|
|
|
|
ok, I've done that, but still nothing happens when I click on the button.
What am I not doing?
|
|
|
|
|
Did you use class wizard? Did you chose the right dialog ressource id in class wizard? Which type is m_chatterChooser now?
Gero
|
|
|
|
|
I have it as CDialog. I chose the resource ID for the dialog that I just built. (Chatter chooser).
What do I have to change the type to? I put CCHooser which is the name of the class.. and I got errors.
Please bear with me, I'm new to this.
Thank you so much
|
|
|
|
|
If your derived class is named CCHooser you have to include CCHooser.h in the source file where you have declared m_chatterChooser.
#include "CCHooser.h"
Gero
|
|
|
|
|
I have six errors!
I have in my mainframe.cpp
#include "CHOOSER.h"<br />
#include "CHOOSER.cpp"
and
void CMainFrame::OnSFile() <br />
<br />
{<br />
<br />
m_chatterChooser.DoModal();}
In my mainframe.h:
CCHOOSER m_chatterChooser;
Also, the name of the class is CCHOOSER, but the fileview has chooser.cpp and chooser.h
I know this is a simple thing.. why I am having so much trouble?
|
|
|
|
|
You must not include this line!
#include "CHOOSER.cpp"
Gero
|
|
|
|
|
If this wasn't me, ikt would almost be funny!
Now I have 5 errors!
|
|
|
|
|
Just send me your project (gerogerber@gmx.de), or tell me which errors you get.
Gero
|
|
|
|
|
m_chatterChooser must be of type CChooser
|
|
|
|
|
Errors!
compiling...<br />
Mainfrm.cpp<br />
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\mainfrm.h(48) : error C2146: syntax error : missing ';' before identifier 'm_chatterChooser'<br />
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\mainfrm.h(48) : error C2501: 'CCHOOSER' : missing storage-class or type specifiers<br />
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\mainfrm.h(48) : error C2501: 'm_chatterChooser' : missing storage-class or type specifiers<br />
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\Mainfrm.cpp(162) : error C2065: 'm_chatterChooser' : undeclared identifier<br />
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\Mainfrm.cpp(162) : error C2228: left of '.DoModal' must have class/struct/union type<br />
Error executing cl.exe.<br />
<br />
chatter.exe - 5 error(s), 0 warning(s)
|
|
|
|
|
Maybe a misspelling - try CChooser instead CCHOOSER. C++ is case sensitive.
Gero
|
|
|
|
|
That didn't work, same 5 errors. I know C++ is case sensitive, that's why I put it in all caps. The class is in all caps.
I'm going to delete the class and start again.. and give it a name that doesn't start with C!
Is that a good idea?
Thank you so much for your help!
|
|
|
|
|
If you want send me the code.
Gero
|
|
|
|
|
The whole project (actually it is two.. client and server) is large. Shall I send just the relevant code pasted in a document?
|
|
|
|
|
Thank you so much.
What you suggested worked!
Pett.
|
|
|
|
|
I try to help you:
Pett wrote:
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\mainfrm.h(48) : error C2146: syntax error : missing ';' before identifier 'm_chatterChooser'<br />
D
Here, m_chatterChooser has an unknown datatype.
In the mainfrm.h mentioned write a line #include "chooser.h"
(next to the other #include lines). Use the name of the FILE where CChooser is declared, not the name of the class itself. (normaly these differ by a leading 'C')and a trailing '.h'
Pett wrote:
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\mainfrm.h(48) : error C2501: 'CCHOOSER' : missing storage-class or type specifiers
Here is the same problem. CHOOSER is wrong spelling (case-sensitive)
Pett wrote:
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\mainfrm.h(48) : error C2501: 'm_chatterChooser' : missing storage-class or type specifiers
Here, same line - related problem!
Pett wrote:
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\Mainfrm.cpp(162) : error C2065: 'm_chatterChooser' : undeclared identifier
The variable m_chatterChooser is not known - you due to the errors before.
Pett wrote:
D:\Documents and Settings\Administrator\My Documents\CS61A Info\Assignment1\cs61a\CHATTER\Mainfrm.cpp(162) : error C2228: left of '.DoModal' must have class/struct/union type
Same line-same problem. You can not call a methos from an non-existing object.
Hope this helped.
If you post your errors, it is much easier to help you.
Don't give up. You WILL make it. I know how intimidating I was in the beginning when the compiler spat out hundreds of errors, just for one missing comma.
|
|
|
|
|
Thank you very very much!
|
|
|
|
|
I need to customize WebBrowser component so that i could turn off downloading images, disable script, ...
I fount this MSDN article about that (http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/wbcustomization.asp),
but I have MFC appication, i'm not familiar with COM. Does anybody know, where and how to implement interfaces like IDocHostUIHandler. Which class i have to use ? how to add into project ?
Thanx
rrrado
|
|
|
|
|
Can someone give me hint
howto create an animation
control that keeps playing
while the main program
executes some lenghty
calculations, let's say
for (int i=0; i<10000000000; i++)
sum+=i;
(i know! it's only an example!!)
I createad an animation control
the standard way (with timer)
which didn't work of course,
and one other in an extra thread,
which i excpected to work,
but it stopped also during the loop!
Didn't anyone have the same
problem yet? Putting getmessage/
translate/dispatch into the
loop is not the right solution
for me! Do i have to create
an extra process for this?
Doesn't seem so elegant!
Thank you
|
|
|
|
|
OK. I have a project (a DLL written in C) that communicates over USB from the PC to a device. It works great, but I need the ability to turn off a progress dialog that I call with the DialogBox function. In other words, I want to be able to transfer data without showing any user interface. I've thought about ways to do this...create a thread, hide the dialog, etc. The problem is, I don't know how to respond to the WM messages (specifically WM_TIMER) if I don't have the UI. I have an API call that is called by an external program, which calls a routine with the DialogBox API. The DialogBox API has a callback procedure that I can process these messages in. So how do I have this API work without a dialog? Do I have to do a PeekMessage or something? It's been a while since I've programmed in straight C for Windows.
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|