|
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
|
|
|
|
|
|
Hi,
I have a MFC application and wish to change the way the application behaves when a user maximises the main window frame. I understand that I need to add a virtual function to the document class that inherits from the CDocument class. However, I am not sure what the name of the function is that is used when maximising the window. If you can tell me, that would be great.
Thanks !
|
|
|
|
|
the OnSize function takes UINT which identifies the minimise or maximise request.
that how ever is in MainFrm and View not Doc
example of an action based on minimised action.
void CMainFrame::OnSize(UINT nType, int cx, int cy)<br />
{<br />
if(nType == SIZE_MINIMIZED)<br />
{<br />
ShowWindow(SW_HIDE);<br />
}<br />
else<br />
{<br />
CFrameWnd::OnSize(nType, cx, cy);<br />
}<br />
}
hope that helps.
if im wrong about the document OnSize let me know please
|
|
|
|
|
Hi ya,
Thanks for your post. I actually found this
<br />
<br />
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) <br />
{<br />
static const CPoint point0 = CPoint(0, 0);<br />
if(m_PageSize != point0)<br />
{<br />
const long my = lpMMI -> ptMaxSize.y;<br />
const long ty = lpMMI -> ptMaxTrackSize.y;<br />
lpMMI -> ptMaxSize = m_PageSize; <br />
lpMMI -> ptMaxTrackSize = m_PageSize;<br />
lpMMI -> ptMaxSize.y = my;<br />
lpMMI -> ptMaxTrackSize.y = ty;<br />
}<br />
<br />
CFrameWnd::OnGetMinMaxInfo(lpMMI);<br />
}<br />
<br />
in my code and put a break point on it when I clicked the maximise button. The code then stopped at the break point proving that this function is invoked when using max / min. I guess the structure should contain info whether the user is doing a max / min ?
Thanks
|
|
|
|