|
I am using named pipes to transfer data between a DOS "C" program and Window MFC
program
In this scenrio the DOS program acts as the server while the Windows program is the Client
The Windows program send a string to the DOS program and the DOS program responds sending across 150 - 300 bytes
Speed is of otmost importance as this a ongoing conversation
I have chosen to use Named pipes
since I am releative newbie
I am wondering what the fastest method of IPC would be
Thanks in advance
|
|
|
|
|
Probably the fastest would be a shared memory pool... but are you sure you need that speed? A lot of times, people think they need the best of something when they really only need something that is good enough.
For example, even though shared memory would probably be the fastest option, it would probably not be easy to implement across multiple systems, your server and client would always have to be on the same machine (and by default, same OS), whereas if you used something more versatile like sockets, you could have your system work across different machines (or in the same one, no difference), different operating systems, different states, and even different countries.
So, make sure that you really need all that speed. For example, a phone conversation can be transmitted over sockets with no issue, but digitized IF (if you know what that means) could only go up to certain rates efficiently over a network.
|
|
|
|
|
Hello...
Please ask some help to get the temperature of CPU....
If you have some class o sample..
Please help me.. Thanks a lots...
|
|
|
|
|
|
I keep seeing this "note" as I browse through the MSDN for Visual C++ 2012 (i.e. MFC classes, ATL, etc...)
What exactly does this imply for a Native Code programmer? (The more I read about the WinRT, the more confused I get)
Will a traditional MFC application just work in Windows 8?
modified 25-Jun-12 11:23am.
|
|
|
|
|
bob16972 wrote: What exactly does this imply for a Native Code programmer?
Nothing really... it's not like the WinAPI is going away.
bob16972 wrote: Will a traditional MFC application just work in Windows 8?
They should, accessing desktop applications is not going away. There was an article about this not too long ago stating the intent for Visual Studio to keep supporting desktop application development, which means it will keep getting supported in Windows.
|
|
|
|
|
Albert Holguin wrote: There was an article about this not too long ago stating the intent for Visual
Studio to keep supporting desktop application development, which means it will
keep getting supported in Windows
I had seen something about that but it almost sounded like it was discussing running it on and targeting some previous versions of Windows. That apparently confused me enough to cause some concern.
thanks for reponding.
|
|
|
|
|
Sure, no problem. I've kept an eye out for this as well since I work on desktop applications. I doubt they'll completely get rid of the traditional desktop support any time soon, if so, I'm sure Linux will have a ton of users flocking in their direction. The market for traditional desktop applications is still large for the engineering/scientific community.
|
|
|
|
|
hi,
i'm developing dialog based GUI code for my project using opencv with mfc. i'm getting following error for the MouseCallback function which i don't understand why
error C2660: 'SetDlgItemTextW' : function does not take 2 arguments
following is the code that causes this error
void leftclick( int event, int x, int y, int flags, void* param )
{
if( event == CV_EVENT_LBUTTONDBLCLK )
{
CvScalar s;
CString Blue, Green, Red;
zoomed = (IplImage*) param;
s=cvGet2D(zoomed,x,y);
Blue.Format(_T("%0.2f"), s.val[0]);
Green.Format(_T("%0.2f"), s.val[1]);
Red.Format(_T("%0.2f"), s.val[2]);
SetDlgItemText(IDC_Blue, Blue); /error C2660
SetDlgItemText(IDC_Green, Green); /error C2660
SetDlgItemText(IDC_Red, Red);
}
}
this mouse event is being called in a thread as
cvSetMouseCallback( "box.png", &leftclick, 0 );
any idea what i'm missing. do i have to define the mouse event in the dialog class??
Regards
Jawad
modified 25-Jun-12 6:42am.
|
|
|
|
|
|
Since you are calling this from a thread and not from inside the dialog class, you have to pass the hWnd of the dialog as the first parameter to SetDlgItemText()[^].
You should know that doing this from another thread is a risky way.
Soren Madsen
|
|
|
|
|
You need to send the handle of the dialog to the thread because all thes window funcs come in two forms:
The global:
::SetDlgItemText(HWND, IDC_Blue, Blue);
And the Class Specific:
myDlgItem->SetDlgItemText(IDC_Blue, Blue); or
this->SetDlgItemText(IDC_Blue, Blue);
'this' is of course given for free if you are inside the actually controls class so you can write:
SetDlgItemText(IDC_Blue, Blue);
So, you are in a thread, NOT in the MFC class instance, so you need to pass the window handle to the thread in order to manipulate it there.
Or even better create your own messaging system so you can send a message to the main window thread from your thread so the main window thread can do all the detailed work rathert than having to code it in your worker thread.
|
|
|
|
|
thank you everyone..that was really helpful.
thanks again.
|
|
|
|
|
Hi,
SockCleintThread is a derived class from base Class CWinThread
so <pre lang='cpp'> CWinThread* current;
dynamic_cast<SockCLeintThread*>(current)= AfxGetThread(); </pre>
in fact the compiler is telling me to do what I am doing
why is it flagging the statement as a error
SockCLient.cpp(12) : error C2440: '=' : cannot convert from 'CWinThread *' to 'SockCLeintThread *'
1> Cast from base to derived requires dynamic_cast or static_cast
|
|
|
|
|
I guess the cast should be like this -
SockCLeintThread* current = dynamic_cast<SockCLeintThread*>(AfxGetThread());
|
|
|
|
|
I don't think you can cast the LHS of an expression. It should be:
SockCLeintThread* current = dynamic_cast<SockCLeintThread*>(AfxGetThread());
AfxGetThread() returns a CWinThread* by default, so you need to cast that to the actual type that will be returned when storing it in your thread pointer. If you define current as a CWinThread* then you will not be able to use it as a SockCLeintThread* anywhere following.
|
|
|
|
|
CWinThread* current = (CWinThread*)AfxGetThread();
That's the simplest coding, using the C cast. But see what you are doing? You are casting AfxGetThread() to a CWinThread type.
So in C++:
CWinThread* current = dynamic_cast<cwinthread*>AfxGetThread();
|
|
|
|
|
Hi
I have downloaded aarot.zip and trying to understand the code. Bcoz i need to implement that on embedded programming.
But the API used here is not known to me.
So can anyone help me to understand the code.
AND IF POSSIBLE
Plz help me to know source code of the functions SetDIBits and GetDIBits. How it is working.
Thanks
|
|
|
|
|
If you are talking about an article here on Code Project, you'll have much better luck if you post your question at the end of the article.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I can also manage if I have the code for the body of SetDIBits function.
|
|
|
|
|
Documentation for all Windows API functions can be found quite easily on MSDN[^].
|
|
|
|
|
Hi,
I am using both derived CwinApp and CFrameWnd as Anchor point for pointers to other objects such derived Cwinthreads
e.g. I created the threads which I have socket classes in them in the INITINSTANCE of the Derived CwinApp
Later in the derived modal and modless dialog box code I refer to these pointers
Instead of inluding the header file for the main window and app in each .cpp file
woud precompiling these and headers and using the precompiled header option be a better option
Thanks
|
|
|
|
|
if they aren't going to change often and many files need them, then sure.
|
|
|
|
|
I always turn off pre-compiled headers.
I would rather spend a couple extra seconds on a compile versus trying to figure out why code that I can see with my own eyes obviously isn't running (because it didn't recompile.)
|
|
|
|
|
Dear All,
I have problem, please help me!
I write a program about authentication fingerprint.
For example, cursor is on notepad window or on textbox of any program, If the authentication process is right, I want to display "Yes" characters to position where cursor is blinking. If display at textbox of this program, this process is easy. However, I want to display at textbox of other program as skype program, google chrome program or notepad program.
Thank about help!
Kelvin Nguyen
|
|
|
|