|
You can simply use CDocument's GetFirstViewPosition() and GetNextView() to access the desired view.
An alternative for frame windos is calling AfxGetMainWnd()->GetActiveView() , which gives you access to the current view.
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
|
|
|
|
|
Plons wrote:
I don't know how to get data from the doc class to the view class.
After the document has successfully loaded the file, simply call UpdateAllViews() to notify the view that it needs to display new information. In the view's OnUpdate() method, it will ask the document (usually via GetDocument() and one other method) for the data to be displayed.
Check out the Scribble tutorial on MSDN. It goes over serialization, and doc/view in great detail.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello Friends,
How can we retrieve an Handle of a View. I am using Splitter Window where my window is splitted into 5 parts. and I want to retrieve an handle for any of the view which ever I need. Please help me
Thank you,
Neelesh Jain.
|
|
|
|
|
I'm assuming you've made five calls to CreateView() . To access one of the views, just call GetPane() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi Jain
Sorry for the delay
Here i do consider that i am having two panes ie two views, first the CCallManagerView(0,0) and the other CUserView(1,0). So when i do need to set some value to the CCallManagerView's control from CUserView, i'll be using the following code
void CUserView::SetValue2Manager(void)
{
CMainFrame *pMainFrame = (CMainFrame *) GetParentFrame();
CCallManagerView *pView = (CCallManagerView *)pMainFrame->m_wndSplitter.GetPane(0,0);
if (pView)
{
pView->myEdit.SetWindowText("Hai From Call Manager");
}
}
Hope this may help you. If you want the CUserView then use GetPane(1,0)
Sujan
|
|
|
|
|
I need to print out some image that I have in my MFC program. I can print text byt NOT images is there anyone that now's how do make that happend?.
|
|
|
|
|
|
I need help on writing a function that would implement the reliefing effect and the bathroom mirror effect of an image.
|
|
|
|
|
I've a problem , I would like know how can I hidden my app from tal list Windows? For example: when a user to press ctr+alt+del it's not show my app in tag list? Thanks
|
|
|
|
|
Gledston Reis wrote:
...when a user to press ctr+alt+del it's not show my app in tag list?
Do you mean Task Manager's list of processes? Just out of curiosity, why would you not want your application to show up in this list?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
Just out of curiosity, why would you not want your application to show up in this list?
He's writing spyware that he does not want the user to know about. If the user knows about it, the user can kill it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I know that. I just wanted to see if GR would admit to it.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I´m sorry because I dont answer before I was too busy;). Yeah you can show it(hidden in tag list and process list). I written a spyware and my app need stay hidden in system.
thanks!
PS:Sorry my bad english, because it´s not my natural language
|
|
|
|
|
i want to add a menu in cd rom's context menu.
using vc++.
plese help me.
very urgent.
|
|
|
|
|
Just as an example, you can add the following to a .reg file and merge it into your registry. Then from Explorer, right-click on your CD drive containing an audio CD and you'll see the newly added option.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\AudioCD\shell\calc]
@="&Calc"
[HKEY_CLASSES_ROOT\AudioCD\shell\calc\command]
@="calc.exe" For non-audio CDs, a minor change:
[HKEY_CLASSES_ROOT\Drive\shell\paint]
@="&Paint"
[HKEY_CLASSES_ROOT\Drive\shell\paint\command]
@="mspaint.exe"
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i simply typed following in file and named it with .reg extention.and i runed it. it showed an error.
why?
what is format for registry file?
i maked entry directly in registry in following path.
[HKEY_CLASSES_ROOT\Drive\shell\paint]@="&Paint" [HKEY_CLASSES_ROOT\Drive\shell\paint\command]@="mspaint.exe
but the menu also appears when right click a drive ( for example c . i want only in cd-rom's context menu.
|
|
|
|
|
anandforu wrote:
i simply typed following in file and named it with .reg extention.and i runed it. it showed an error.
why?
what is format for registry file?
You missed the following at the top of the file:
Windows Registry Editor Version 5.00
anandforu wrote:
but the menu also appears when right click a drive ( for example c. i want only in cd-rom's context menu.
I currently do not know of a solution for this. Perhaps Michael Dunn can help.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i want to add windows media player activex control in vc++.
how to do it?
i added the windows media player activex control.But when i calling a method in it ,an runtime error occurs.No details in that error.
please help me .very urgent.
Anand
|
|
|
|
|
I am launching off a console app (by pressing a button )using CreateProcess. I save the handle to this process and when I press the button again, I want to terminate the process if its already running and relaunch it. I put in debugging statements and indeed I get the expected correct output, but the console window is nowhere to be seen this second time around!
if(m_serverProcessInfo.hProcess)
{
TerminateProcess(m_serverProcessInfo.hProcess, 0);
if(fpLog)fprintf(fpLog, "Terminated server\n");
m_serverProcessInfo.hProcess = 0;
}
int res = StartServer();
and
int CPMA2000Dlg::StartServer()
{
int res = 0;
STARTUPINFO StartupInfo;
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof StartupInfo ;
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOW;
if(CreateProcess( m_sPath + "fileserver.exe", NULL,
NULL,NULL,FALSE,0,NULL,
NULL,&StartupInfo,&m_serverProcessInfo))
{
if(fpLog)fprintf(fpLog, "Started server\n");
}
My logs:
Started server<br />
Terminated server<br />
Started server<br />
The first time I do see the console window (server.exe) but the second time though CreateProcess() succeeds again, I dont see the console window which disappeared at the TerminateProcess().
How shall I proceed to figure out the problem?
Thanks,
sb
|
|
|
|
|
Are you doing this in order to have a single instance of the application?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
No. I need a fresh copy of the server each time the button is pressed.
When the button is pressed, two apps are launched: server.exe and my.exe. my.exe depends on socket info from server.exe. When my.exe ends, the user closes the my.exe window, but not the server window. Then when he presses the button again, i want the server.exe to exit and relaunch itself. I dont really want to instruct the user to close both the server.exe and my.exe before pressing the button again. BTW I just modified my app and had the main app send a socket message to the server.exe (if its still running) which tells it to exit. Then it launches it again. However once again, my server listens to and follows the instruction to exit,exits, says its restarted (logfile) but doesnt show up (and my.exe gets unhappy claiming its not running).
Thanks for looking into this,
sb
|
|
|
|
|
Have you checked the return code for the CreateProcess the second time round?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Yes. It returns true the second time around too.
|
|
|
|
|
It may be a race condition. Try stepping through the code and ensure that the server has gone away before moving to the code to launch it again.
If this is the case and all works when you slow it down you will have to wait for the process to terminate before trying to start it again.
I hope this helps
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I neglected to mention that when I step through theres no problem. So with your insight I did Sleep(1000) and it works. Now I nervous about whether the time is enough from computer to computer. On mine its adequate without being noticeably slow. Is there some way to be certain of this barring a statistical survey?
Thanks,
sb
|
|
|
|