|
I prepared an SDI app that gathers some text from the user. I want it to return this text to some other app. For this, I created an overly simplified Dialog that has just one button that is supposed to invoke the former app to collect the text. I (am totally new to VC and) tried including the header file of former as follows
#include "..\TypingEditor\TypingEditor.h"
and then creating its object with 'new' like
CTypingEditorApp *te = new CTypingEditorApp();
But there are errors saying:
public: __thiscall CTypingEditorApp::CTypingEditorApp(void)" (??0CTypingEditorApp@@QAE@XZ)
What am i missing or diong wrong?
~Gaasha~
|
|
|
|
|
Naadia wrote: #include "..\TypingEditor\TypingEditor.h"
Is the path of the header file that you include correct?
you need to check if the file exists in the same folder as the file where you include it and change the #include "..\TypingEditor\TypingEditor.h" to #include "..\TypingEditor.h"
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I have checked and rechecked the include path several times and it's 100% correct. I think file inclusion in C++ is different from that in Java.
~Gaasha~
|
|
|
|
|
I'm not sure that I understood you correctly. So, you have a SDI application and you want to create another application (a simple dialog based app) that will retrieve some information from the SDI app. Correct ?
So, to do that, you created a new application (dialog based) and you include a header from the other application ?
There are several problems with that:
1) Your error is in fact a linking error: you include the header file but you need to add the source file in your project too.
2) The concept itself is wrong: you will need to include all the files from your SDI application in your dialog based application but that will result in conflicts (main declared twice, ...). What you need to do in fact, is to start the executable of the SDI app from your dialog based application and then use some interprocess communication. This can be quite difficult to do for a 'beginer'.
|
|
|
|
|
What you need to do in fact, is to start the executable of the SDI app from your dialog based application and then use some interprocess communication.
This is exactly what i wanna do. But the question is how to do that?
~Gaasha~
|
|
|
|
|
|
Do you want to send text to other applications?
|
|
|
|
|
|
Well, I think pretty much everything is said in this homework exercise : how to do it, what you need, etc.. What would be your approach ?
|
|
|
|
|
Using
Y = mX + c
you have simply to use 2 for loops to change the valeus of m and c (to draw every possible lines). Then, over that lines, you have simply to count the number of 1 into the data image.
Finally you will have a matrix (indexes are m and c ), where the value can be plotted as an image....the higher amplitude indicate the main line displayed into the image: (in the exaple c is about 1 or 2, and m is about -1)
Russell
|
|
|
|
|
|
hkwj88 wrote: can that method be applied too?
Of course you can!
Probally that way can be better than the other, look to the value range of the variables:
(m,c) case: both runs from -infinite to + infinite
(r,q) case: r run from 0 to 10 (the image in the example is not so big), ..and d from 0 to 2*pi:->
You have only to choose the step that you prefere.
Good luck;)
Russell
|
|
|
|
|
The Control has been register on the machine,when the user close,refresh or click "x" button on the embeded site,how does my control receive these messages? Thanks a lot.
Later buggers harm more.
|
|
|
|
|
The summary of my problem is this: two different views in a splitter window, one doc (SDI). I want to access the document's members from both views.
I've created an application with a CSplitterWnd in my MainFrame. I've created the two views using m_wndSplitter.CreateView(....);
That displays fine. Wonderful. I've got a variable in my doc class, int lookie. It's public. My class names are as follows:
CThingApp -> the app class
CThingDoc -> the doc class
CThingControlView -> the form view containing the controls
CThingDisplayView -> the graphical view displaying the data
CMainFrame -> frame class
CThingControlView was created with the whole project. I added CThingDisplayView.
So I changed the code in CThingApp:InitInstance() to look like this:
////////////////////////////
CSingleDocTemplate* pDocControlTemplate;
pDocControlTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CThingDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CThingControlView));
AddDocTemplate(pDocControlTemplate);
////////////////////////////
This seems to work.
Here's where my confusion sets in. I *thought* I now need to add the following code immediately beneath the above code:
////////////////////////////
CSingleDocTemplate* pDocDisplayTemplate;
pDocDisplayTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CThingDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CThingDisplayView));
AddDocTemplate(pDocDisplayTemplate);
////////////////////////////
I now believe that to be a false assumption because, upon building, the application displays a funny little window with the title new and what appears to be a list of options. There are two options with exactly the same text (which appears to be shortenings of my project name). If I select either one the application then starts.
Because this was incorrect behavior, I commented out the second document template code and tried several different ways of just *accessing* the data in CThingDoc from CThingDisplayView. Nothing's working.
I'm sure there is a simple solution to this. Something that my examples neglect to tell me or that I'm just not noticing.
|
|
|
|
|
|
Stop fiddling around with the DocumentTemplate!
You'll eventually destroy your application and need to start over!
Create the splitter with its views a s described in the other post.
Then, to access the document, you need to use
CThingDoc* pDoc = dynamic_cast<CThingDoc*>(GetDocument());
if()
{
} in your CThingDisplayView and CThingControlView.
Failure is not an option - it's built right in.{
|
|
|
|
|
For splitter windows, you only need one CSingleDocTemplate object that is created like:
CSingleDocTemplate* pDocControlTemplate;
pDocControlTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CThingDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(NULL));
AddDocTemplate(pDocControlTemplate);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi list,
I want to ask whether is it possible to have a pointer whose type can change according to the input. I want to make it clear waht I need by a little code below which is not possible to compile. I think there must be a very well known trick for this. Thanks in advance for your help.
switch( datatype )
{
case DT_INT8: char *myPntr = (char *)dataPntr
case DT_UINT8: unsigned char *myPntr = (unsigned char*)dataPntr;
case DT_INT16: short *myPntr = (short *)dataPntr;
}
dataPntr is a (void *).
how can I create such myPntr?
xonobo
|
|
|
|
|
you just write: void * myPntr;
|
|
|
|
|
just read the reply of jhwurmbach below. That's my problem. void * do not help in that. but thanks...
|
|
|
|
|
xonobo wrote: want to ask whether is it possible to have a pointer whose type can change according to the input.
A void* can point to anything, but in turn it looses the information to what it is pointing.
You need to bundle this information with it.
In VB this is done using the VARIANT struct. That is a struct holding a type marker and a piece of memory.
Via a union, all datatypes are 'layered" above each other, using the same memory.
Failure is not an option - it's built right in.
|
|
|
|
|
Thanks a lot for your reply and ask: anyone knows a solution for C/C++?
|
|
|
|
|
You don't tell enough to get a solution to your problem.
What are you trying to accomplish and why can't this be solved in another way?
Does the (Microsoft specific) _variant_t help you?
Failure is not an option - it's built right in.
|
|
|
|
|
Thamks for your help. I thought VARIANT is only available in VB that's why I asked more. Now I will check _variant_t. Thanks again.
|
|
|
|
|
xonobo wrote: I thought VARIANT is only available in VB...
It's definitely not limited to VB.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|