|
Hi,
Thanks for your reply, I am talking about 2 different applications...
for IPC i have already created memory map and i can read data from both application....but the problem is how do i inform processes when they can read data...
|
|
|
|
|
You may want to look at the WM_COPYDATA message. This would be sufficient for notification purposes.
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)
|
|
|
|
|
Thank you,
I will look into it
I appreciate your help
|
|
|
|
|
hello all,
what is lvalue error?. is there Rvalue error too?. if yes plz give me some explanation about these 2 error types.
Thanking u all.
ComputerNewton
|
|
|
|
|
I can only assume you mean when the compiler is expecting an l-value on the left-hand side of an assignment:
i=10; is fine so long as i was not defined as a constant.
More obviously:
10=3; will give you an l-value error because 10 is not an l-value and therefore cannot be assigned to anything else.
10 is 10, and cannot be anything else!
I hope this helps,
Zoltan
|
|
|
|
|
Can I group function (method) within Struct in ANSI C?
I constantly listen people talking about it. Many have
stated that it can be done.
If it can be done, is it recommended to do so?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
|
Thanks for your reply.
I did mean function pointers within Stuct. I mean function within
Struct. Some people are stating that Object-oriented can be done
in ANSI C. I just don't think so. But I'm not really sure.
Can it be done?
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Literal reply : No.
Assumed reply : Yes.
ANSI C is not an OO language.
The concept of excapsulation is not supported.
A pure C compiler would fail to compile a struct with a method.
There are few, if any, pure C compilers around in use anymore.
C++ made an effort to be backwards compatible with C.
In doing so it made some modifictions to some of the C syntax to make it fit better with the C++ paradigm.
One such change was to give struct the same abilities as class. That is, struct definitions can include methods.
The only real difference, in C++, between struct and class is the default access control.
struct : by default everything is public.
class : by default everything is private.
So, a C++ compiler would have no problem with a struct with a method.
As for being recommended ... a topic sure to start a religous war.
Personally i use struct for simple records.
I will only provide constructor, reset/init methods.
For me, seeing a struct is an indicator that the object is simple/dumb.
I use classes for all other records.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
it would probably be a good idea to delete one of these posts no need for 2
|
|
|
|
|
I have a template class inside which I wish to embed some static constants to speed up some time-critical code. Consider this:
template <class T, int I> class X<br />
{<br />
private:<br />
static const icopy = i;<br />
static const iminus1 = i-1;<br />
static const itimes8 = i<<3;<br />
int array[I];<br />
public:<br />
(..)<br />
};
I is assigned by the code using the template to the size of T, which is fine when the compiler uses it to create the array with num elements equal to I.
However, all of the static constants appear to be getting initialised to 1, even when I is explicitly set to 4 or 8.
I wish to make these constants static in order to reduce memory overhead, therefore a solution to this problem is kinda essential to me? Am I mis-using the language? Or is it an example of VS.Net 2003's C++ compiler's non-conformance?
Please help!
Thanks in advance...
|
|
|
|
|
I and i are different variables entirely. And making them static probably won't reduce memory usage. The values will all be known at compile time, so the compiler will be able to directly insert the values (unless you take the address of iminus1 or one of the other members).
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Ford, what's this fish doing in my ear?
|
|
|
|
|
Hi Mike,
Thank you for your reply -
Michael Dunn wrote:
I and i are different variables entirely. And making them static probably won't reduce memory usage
I was being stupid in my code example - I am trying to use the template argument I to assign my static constants in order to reduce computational overhead in any functions that need to use them. I accidentally put i instead because I was half asleep when I posted the question!
In theory, therefore, if I use the template argument, which will be a compile-time constant of, say, 4, to calculate the other constants, how can icopy be getting set to 1 and not 4?
Thanks
|
|
|
|
|
Unfortunately, I'm not seeing the problem you are. Here's the code I tested on VC 7.1:
#include <iostream>
#include <tchar.h>
using namespace std;
template <class T, int I> class X
{
public:
X() {}
static const icopy = I;
static const iminus1 = I-1;
static const itimes8 = I<<3;
int array[I];
};
int _tmain(int argc, _TCHAR* argv[])
{
X<int, sizeof(int)> x1;
cout << "x1.icopy = " << x1.icopy
<< "\nx1.iminus1 = " << x1.iminus1
<< "\nx1.itimes8 = " << x1.itimes8 << '\n';
return 0;
} Output:
x1.icopy = 4
x1.iminus1 = 3
x1.itimes8 = 32
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but how will we fit the hamster inside the accordion?
|
|
|
|
|
Mike,
Sometimes, it just helps when someone forces you to look at your code again eh!!? Whilst we've been discussing this, I converted the template class so that it simply used standard members and discovered that there was a general error in some of my logic that was making it appear that these static constants were getting initialised to 1. Of course, however, they weren't - as you've demonstrated and I've just verified.
What didn't help - and I'm not going mad on this one - is that the VC++ debugger picks up these values at run-time as 1 (perhaps understandably, since their values are dependent on the template args), regardless of what value they actually have, therefore I had just assumed that the compiler was stupid, and not me. I should have remembered that the console project is my friend when it comes to debugging values.
Thanks to your help, I have now converted it back to static constants and have received a fifth of a second speed increase over the course of 250,000 operations that will use this class - not much, but enough for me to be happy !
Thanks very much for your help,
Zoltan
I'm not as evil as my name suggests
|
|
|
|
|
Great, I'm glad it worked out for you. Funny thing about the debugger, you could report that to MS so they fix it for Whidbey.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
Actual sign at the laundromat I go to: "No tinting or dying."
"Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer."
-- Michael P. Butler in the Lounge
|
|
|
|
|
Hello,
Is anyone knows how to remove template from mdi that was added by
Suppose i made 2 doc tempates:
CMultiDocTemplate* Template1;<br />
CMultiDocTemplate* Template2;<br />
<br />
Template1 = new CMultiDocTemplate(IDR_RENTCATYPE, RUNTIME_CLASS(CMyAppDoc), RUNTIME_CLASS(CChildFrame), RUNTIME_CLASS(Form1));<br />
<br />
Template2 = new CMultiDocTemplate(IDR_RENTCATYPE, RUNTIME_CLASS(CMyAppDoc), RUNTIME_CLASS(CChildFrame), RUNTIME_CLASS(Form2));<br />
<br />
AddDocTemplate(Template1);<br />
AddDocTemplate(Template2);<br />
HOW DO I REMOVE ONE/ALL OF THE TEMLPATES ??? ( or at least change them );
Thank You in Advance.
P.S. Help Please, SOS
|
|
|
|
|
Hi.
I am quite new to windows and MFC programming and I have over the last few months, been developing an application that 'does stuff'.
Now, I have decided that given the design, it would be much more suited to the 'DLL' concept. So, I would like to convert the application to a client/server approach.
So, with a view to testing some of the 'needed' functionality, I created a very simple client and server.
One or both client(s) and server require the use of MFC, that is to say, neither derive classes from MFC but the server uses MFC functions; CString, Afx.. stuff. The client may also use MFC stuff CString etc..
Before I describe the problem, it might, but I dont know if it is relevent to note that both client and server link in MFC dynamically.
Anyway, I define a very simple server function that accepts an LPCTSTR which it should display in a message box.
However, I keep getting the same debug error after the call from the client to the server completes:
Debug Error!
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a differnt calling convention.
I have tried all sorts of combinations of call conventions and I have now hit a brick wall.
Any advice or pointers would be much appreciated.
Best regards.
James.
|
|
|
|
|
The simple answer is that you must use the same calling convention.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Without the source and project files it will be tough to help you with this problem.
It could be compiler settings on one source module are different than another.
It could be something funky being done with a function pointer.
It could be some kind of memory corruption.
It could be ... ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
I have a dialog in a DLL and how can I mininaze that dialog to the system tray?. I have try some standard tray app but I don't get it to work in the dialog is in a DLL.
How can I make this happend? Please
|
|
|
|
|
Hello everyone.
I want to display the hand cursor over an item when it is selected in a tree control list? Please help me.
|
|
|
|
|
Hello. I am trying to write a database program that is similar to a punch out clock. This is for a small restaurant with 25 employees. What i would like to implement is a time clock program that keeps track of when and how many hours an employeee works.
Right now I have one table in my database, named
Employee Info, besides that i am stuck. Here is my problem. I do not know if i should create a new table for every employee that is currently employeed and keep track of when he/she has worked and for how long. Or should i just dump every employee into one table and sort the table according to employee id?
Some advice would be greatly appreciated.
One thing, an employee normally punches in, punches out for a brake, punches back to work and than punches out at the end of the night....
Please help..
|
|
|
|
|
crimsongrape wrote:
create a new table for every employee that is currently employeed and keep track of when he/she has worked and for how long
No.
crimsongrape wrote:
dump every employee into one table and sort the table according to employee id
make that "every employee timestamp".
You could have :
employee table (as you have)
timecard table with employee id, punch in, punch out times, and total time as a calculated field.
Make sure you check for employees punching in with an existing 'open' timecard record (ie they forgot to punch out last time).
...cmk
Save the whales - collect the whole set
|
|
|
|
|
i insert a picture object in the richedit control, it will rise ON_CHANGE notify,
but the function ReplaceSel will cause a reentrancy in win98, in win2k, it will not,
so strange!
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
//{{AFX_MSG_MAP(CMyDialog)
ON_EN_CHANGE(IDC_RICHEDIT, OnChangeRichedit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMyDialog::OnChangeRichedit()
{
int nEnd = m_editRich.GetTextLength();
m_editRich.ReplaceSel("TestValue"); //when run in "ReplaceSel", it will call OnChangeRichedit() immediately,
//it reentrant! so it does not work well!
int nLabel = m_editRich.GetTextLength();
}
i want to known the reason that the function "ReplaceSel" will cause reentrancy in windows 98, any reply is expected!
|
|
|
|