Click here to Skip to main content
15,902,189 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: [win32]Draw on a background bitmap Pin
Mark Salsbery26-May-11 12:11
Mark Salsbery26-May-11 12:11 
AnswerRe: [win32]Draw on a background bitmap [modified] Pin
Mark Salsbery26-May-11 13:57
Mark Salsbery26-May-11 13:57 
AnswerRe: [win32]Draw on a background bitmap Pin
bob1697228-May-11 18:59
bob1697228-May-11 18:59 
QuestionUsing streams Pin
Berlus26-May-11 2:40
Berlus26-May-11 2:40 
QuestionRe: Using streams Pin
David Crow26-May-11 2:49
David Crow26-May-11 2:49 
AnswerRe: Using streams [modified] Pin
Stefan_Lang26-May-11 3:01
Stefan_Lang26-May-11 3:01 
GeneralRe: Using streams Pin
Berlus26-May-11 10:05
Berlus26-May-11 10:05 
GeneralRe: Using streams Pin
Stefan_Lang26-May-11 21:14
Stefan_Lang26-May-11 21:14 
Hehe, that's what I first did, and hence my edit. Smile | :)

Unfortunately the streaming operators expect the type to be streamed as second parameter. If it were the first parameter, then your code would work, as in class methods the instance of the class itself is always passed as a hidden parameter.

So, what you can do, is overriding the subtraction operator like in either of these ways:
struct MyStruct {
   int a;
   MyStruct(int value) : a(value) {} // conversion constructor, for implicit casting of int to MyStruct
   MyStruct operator-(const MyStruct& op2) {
      return (a-op2.a);
   }
};

or
struct MyStruct {
   int a;
   MyStruct(int value) : a(vlaue) {}
};
MyStruct operator-(const MyStruct& op1, const MyStruct& op2) {
   return op1.a - op2.a;
}

Both implementations are equivalent. The only difference is that the first variant skips the first parameter of the second variant, because the instance will be used in its stead.
QuestionProblem opening URL Pin
pix_programmer26-May-11 1:44
pix_programmer26-May-11 1:44 
AnswerRe: Problem opening URL Pin
Richard MacCutchan26-May-11 1:53
mveRichard MacCutchan26-May-11 1:53 
GeneralRe: Problem opening URL Pin
pix_programmer26-May-11 1:58
pix_programmer26-May-11 1:58 
GeneralRe: Problem opening URL Pin
Richard MacCutchan26-May-11 2:59
mveRichard MacCutchan26-May-11 2:59 
GeneralRe: Problem opening URL [modified] Pin
pix_programmer26-May-11 3:20
pix_programmer26-May-11 3:20 
GeneralRe: Problem opening URL Pin
Richard MacCutchan26-May-11 3:32
mveRichard MacCutchan26-May-11 3:32 
AnswerRe: Problem opening URL Pin
Niklas L26-May-11 4:49
Niklas L26-May-11 4:49 
GeneralRe: Problem opening URL Pin
pix_programmer26-May-11 20:32
pix_programmer26-May-11 20:32 
GeneralRe: Problem opening URL Pin
Niklas L26-May-11 21:40
Niklas L26-May-11 21:40 
GeneralRe: Problem opening URL Pin
pix_programmer26-May-11 22:15
pix_programmer26-May-11 22:15 
QuestionRe: Problem opening URL Pin
Niklas L27-May-11 1:09
Niklas L27-May-11 1:09 
QuestionFindWindow() without giving Application windows caption Pin
manju 326-May-11 0:44
manju 326-May-11 0:44 
AnswerRe: FindWindow() without giving Application windows caption Pin
tagopi26-May-11 1:33
tagopi26-May-11 1:33 
AnswerRe: FindWindow() without giving Application windows caption Pin
ThatsAlok26-May-11 21:39
ThatsAlok26-May-11 21:39 
Questionendtask program using win32api/c like taskmanager to close programs without invoking taskmanager just in one shot Pin
Jayapal Chandran25-May-11 20:52
Jayapal Chandran25-May-11 20:52 
AnswerRe: endtask program using win32api/c like taskmanager to close programs without invoking taskmanager just in one shot Pin
_AnsHUMAN_ 25-May-11 21:53
_AnsHUMAN_ 25-May-11 21:53 
AnswerRe: endtask program using win32api/c like taskmanager to close programs without invoking taskmanager just in one shot Pin
Mark Salsbery25-May-11 21:54
Mark Salsbery25-May-11 21:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.