|
|
Hi all,
I'm having a problem with my CSplitterWnd SDI app ...
It's split into 2 frames, with a CEditView on the left side, and a CDialog panel on the right with some button controls on it. After I click a button on the right panel, then do a menu->file->print, I catch a ID_FILE_PRINT message in CMainFrame. I'd like to send this to my view.
Here's my code to do this:
<br />
MainFrm.cpp -- OnFilePrint(....)<br />
<br />
CMYEDITView *pView = (CMYEDITView *)m_wndSplitter.GetPane(0,0);<br />
pView->SendMessage(ID_FILE_PRINT_PREVIEW);<br />
The message is never received by the CEditView's message map.
My question is this: Do I need to do anything special to set focus to this view before sending the Message? or is something else wrong here?
Thanks a million,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
Hi
Check the view's address .if prb with address get the splitters' address using getparent frame
Hope this will help
Sujan
|
|
|
|
|
Is it possible to write a shell handler that gets called when you double click a folder and that would allow you to put your own processing in place? So you could look at the directory name, and if it (the directory name) ended in "*.app" you would execute the executable that was inside of it, as opposed to opening the directory in explorer. Is this even possible ?
Thanks
Jim
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Michael Dunn has written seven articles on Shell programming. Here is a link to the first one. Hopefully one of them will steer you in the right direction.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
How can I change the menu item properties dynamically? basically, I want to have the menu caption "Running!" when a certain code in my application is running and "Stopped" when the code is in standby.
Thank you for your help
Zakaria
|
|
|
|
|
Add a handler for the update of the menu item eg:
void CDocClass::OnUpdateMenuItemName(CCmdUI* pCmdUI)
{
if (m_bRunning)
pCmdUI->SetText(_T("Running"));
else
pCmdUI->SetText(_T("Stopped"));
}
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 have a memory leak and think I have found it. So my question is whats the best way to terminate this thread.
The final tidy-up section of code is never reached.
The thread reads UDP data packets and updates a database; but on my main program exit routine should I kill this thread? As could be waiting on a read.
while(g_bUDP_Socket_Created)<br />
{<br />
int len = sizeof(RxBuffer);<br />
bytesRead = recvfrom (conn_socket, (char *)&RxBuffer, sizeof(Data), 0, (struct sockaddr *)&from, &length);<br />
if (bytesRead == SOCKET_ERROR) <br />
{<br />
g_sFormatting.Format("recvfrom() failed: %d\n",WSAGetLastError());<br />
AfxMessageBox(g_sFormatting);<br />
WSACleanup();<br />
return -1;<br />
}<br />
::EnterCriticalSection(&g_csRxLock);
memcpy(&g_RxData, &RxBuffer, sizeof(Data));<br />
UpdateDataBase();<br />
::LeaveCriticalSection(&g_csRxLock);
g_nUDPCounter++;<br />
}<br />
closesocket(conn_socket);<br />
WSACleanup();<br />
return 0;
|
|
|
|
|
Seems to me you should be using an asynchronous 'unblocked' socket. Your thread should wait on an exit event and a socket event (2 events) with WaitForMultipleObejct, and only issue the socket read if socket data is ready. Otherwisee you WILL just sit there until data arrives.
See WSAEventSelect:
"As in the case of the select and WSAAsyncSelect functions, WSAEventSelect will frequently be used to determine when a data transfer operation (send or recv) can be issued with the expectation of immediate success. Nevertheless, a robust application must be prepared for the possibility that the event object is set and it issues a Windows Sockets call that returns WSAEWOULDBLOCK immediately. For example, the following sequence of operations is possible:"
Then, your application main thread can set the event for the thread to exit, and it should not be otherwise 'blocked' waiting for data reception on the socket.
|
|
|
|
|
Thanks for your post.
My application is already using events and will use more in the future. I am lead to think that you have a total of 32 events.
So do not want to use 2 events for this UDP activity.
Are they a crude way of ending this thread when the application ends? I will sort it out later if they are any events spare.
I do not have a handle for this thread, created via the call:-
m_UDPReceiverThread = ::AfxBeginThread(ExampleDlg::UDPReceiverThread, NULL);
|
|
|
|
|
1. You can have more than 32 events in your progrma, I just don't think you can WAIT for more than 32 in any particular call to WaitForMultipleObjects.
2. The receiving thread should wait on an event from the sockets AND an event that the main applciation thread would set when it is time to exit. If the soket event is set, then read data, if the exit event is set, then leave your thread function by returning or exiiting out of bottom of function. That is the preferred mechanism for ending the thread, not terminating it.
There is another message in this forum a little older than yours asking how to end the thread safely, please read it. I was not trying to give guidance on existing the thread so much as how to avoid the blocking socket call.
|
|
|
|
|
Hi,
I'm trying to create a little program, wich basicaly reads a file. I already have written some code in the serializing-fuction, wich reads the data. I now would like to add a progress bar and some info-text in my window (CFormView). I don't know how to get data from the doc class to the view class. Has it something to do with messages? I'm new at all of this stuff, so its very confusing...
Thank's in advance!
|
|
|
|
|
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
|
|
|
|