|
Ahhh. I didn't realize you were talking about synchronous VS asynchronous. You explained it perfectly.
Thanks again for all your help! I hope I get the chance to return the favor someday...
-Ian
|
|
|
|
|
Thanks
Glad to be of help
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Nilesh K. wrote:
PostMessage();
//this message box would get displayed only when the lengthy operation of
//ReceiverOfPostMessage function gets over, This is called a blocking call
AfxMessageBox("");
SendMessage();
//this message box would immediately get displayed and would not wait for the
//operation of ReceiverOfPostMessage to get over
AfxMessageBox("");
Are you jokin!, have you consulted MSDN before writing difference between PostMessage and SendMessage Here! or try to run above code in your compiler!
The Defination is actually reverse!, SendMesssage Block the call and PostMessage Return immedietly.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Your are right, thanks for correcting!!
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Nilesh K. wrote:
Your are right, thanks for correcting!!
Sorry for my RUDE Comments!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
It's SendMessage that's blocking, PostMessage returns immediately after posting a message to the message queue. There's more to it, though, take a look at this article (www.codeproject.com/csharp/begininvoke.asp[^]), in particular the "message queues and message pumping" section.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
My guess is that posting the messages is causing the message pump to process it again. That causes CMyEdit::onkeyup to execute again which again posts a message to the message pump and so on.
SendMessage from within the UI thread directly calls the WndProc of the dialog and so it executes correctly.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have a program that has many windows that need to be displayed. I am using MFC for the windows. I need to be able to dynamically update the windows from within the program. But I would like them to be displayed in a tab/dockable window fashion. However I can't figure out when you create the window as a property sheet of CFormView how to get access to the object that is created because they have to be created as CRuntimeClass.
Currently for example I just have a bunch of modeless dialog boxes that I instantiate directly and have objects for that I can just call set routines to manipulate the display. I would like to to the same thing just without using modeless dialogs, but CFormview or something similar.
|
|
|
|
|
When I click on the application window's Close X button, it calls my OnClose method. In OnClose, I prompt the user to save the data before closing the application. If the user cancels, I would like the application to remain open as in Microsoft Word, Excel, etc. How do I go about doing this? Thanks.
|
|
|
|
|
don't call the base method, and if the function returns a boolean, return true ( which tells the system you've handled the message, no further processing required ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You can also disable the Close X button of a CWnd derived-object by using CWnd::GetSystemMenu and CMenu::EnableMenuItem on the menu item SC_CLOSE .
For example:
m_MyWndFrame.GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE, MF_DISABLED);
|
|
|
|
|
I have a co-worker that created an form in Access 2000. In order to use it every where I need to install MS Access 2000. How can I show this form in MFC and allow the end user to use it without having to install MS Access 2000 on all PC's?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
I have a co-worker that created an form in Access 2000. In order to use it every where I need to install MS Access 2000. How can I show this form in MFC and allow the end user to use it without having to install MS Access 2000 on all PC's?
Sadly you can't. Access forms require MS Access to be installed (or at least the Access Runtime). If you have the correct licencing you can redistribute the MS Access runtime.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I have come across a function that looks like a member function being called but there is no class being declared before it, just the two '::'. How does this work?
Thank-you
|
|
|
|
|
It only means that myFunc isn't in a namespace ("no_namespace"::myFunc).
|
|
|
|
|
It means that the function is part of global namespace.
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
i'd like to add a little precision... there are 2 scope operators
- the class scope (class::member )
- the global scope (::global_obj )
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Wrong - there is only 1 scope operator, but there may be 0 or more namespaces or classes, so that without a modifier, the instance refers to the global namespace, i.e. all publically decared functions as might be declared within your own programme or any libraries linked to your programme.
|
|
|
|
|
What's the command to start a program from within my program?
|
|
|
|
|
use WinExec() function
ex :
WinExec("C:\\Path\\program.exe",0);<br />
"Go as far as you can see,and when you get there you’ll see further" - Unknown
|
|
|
|
|
I guess that's what I was looking for, but it doesn't go all the way. For example, I'd like to be able to close my program and have the other one still running. (When attempting this, the window of the other program also didn't become visible.)
|
|
|
|
|
Anonymous wrote:
but it doesn't go all the way
Have you tried ShellExecute?
Artificial intelligence is no match for natural
stupidity.
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
Anonymous wrote:
I'd like to be able to close my program and have the other one still running
CreateProcess will Help in this case, When you use CreateProcess to Execute a Executable, one of it's parameter i.e. LPPROCESS_INFORMATION parameter return with PROCESSID .
Using that Parameter you can control that process i.e.
For terminating the Process :- [TerminateProcess() ]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
From MSDN:
WinExec is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function.
Or alternatively, use ShellExecute, which is a "simpler" function call than CreateProcess.
The StartPage Randomizer
|
|
|
|
|
This code will open a program, open a url, open a file, really open anything that has an associated File Type in the registry and Windows knows what to do with it...and it doesn't matter whether you close your program or not. I only call it OpenURL because that is what I mostly use the function for
BOOL CGlobals::OpenURL(CString csURL)
{
SHELLEXECUTEINFO UrlInfo;
memset(&UrlInfo, 0, sizeof(SHELLEXECUTEINFO));
UrlInfo.cbSize = sizeof(SHELLEXECUTEINFO);
UrlInfo.lpFile = (LPCTSTR)csURL;
// TRUE = explorer/netscape window opened (doesn't check for url connection)
return ShellExecuteEx(&UrlInfo);
}
|
|
|
|