|
here is the "afxapi"define or the "afxwininit"?
|
|
|
|
|
youbo wrote: here is the "afxapi"define or the "afxwininit"?
AfxWinInit.
the AFXAPI macro is defined as
#define AFXAPI __stdcall
|
|
|
|
|
While going through C++ object model book by Stanley Lippman, I came across a statement "inline functions have static linkage"
Now if inline function code is expanded into the source where it is used, then this statement is perfectly correct.
But if the compiler is unable to replace this function call with appropriate code, then it will behave like ordinary function call.
So I tried declaring and defining this function in a header file inside class.
// a.h
class ABC
{
public:
void MyInlinefunction()
{
// some code which forces this function not to be inline
}
};
When I analyzed assembly code of my 2 source files where this header is included.
b.cpp,c.cpp.
I found two instances of the same function(MyInlinefunction) in two source files. Is this behavior is correct?
|
|
|
|
|
vikrams wrote: Now if inline function code is expanded into the source where it is used, then this statement is perfectly correct.
No. At least IMHO: if they are expanded there is no standard function in the corrensponding code.
vikrams wrote: When I analyzed assembly code of my 2 source files where this header is included.
b.cpp,c.cpp.
I found two instances of the same function(MyInlinefunction) in two source files. Is this behavior is correct?
Yes, this correnspond to static linkage.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
So How linker handle this situation ?
|
|
|
|
|
I think that's not a linker problem, the static behaviour is resolved by the compiler and , in the end, there is only one function in the executable, called by both sources.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I don't think the compiler can optimize this. because when this files are compiled separately and object files are linked together. Linker has to do the rest work.
|
|
|
|
|
Well, you're right. Each of the two object files contains a definition for MyInlineFunction , hence must be the linker to do the magic and I don't know why...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi all,
I've create a window as follows,
void CRtf::Initialize(void)
{
HWND m_hwnd_RTFBox = CreateWindowEx(
WS_EX_APPWINDOW,
RICHEDIT_CLASS,
"RichTextWindow",
WS_BORDER|ES_MULTILINE,
0,
0,
100,
100,
::GetConsoleWindow(),
NULL,
0,
NULL);
}
After doing all the process, I've destroyed the window as well.
My question is this. I use the above handler iteratively within a loop. So all the time call the Initialize() in each processing step. Simply create and destroy to the equal number of looping process. I want to avoid it.
According to the MSDN, if the CreateWindowEx() is succeeds, the return value is a handle to the window. If it is failed the return value is NULL. So I've tried something like this.
while(m_hwnd_RTFBox != NULL)
{
}
But it doesn't work. Can you guys give me a clue on this.
I appreciate your help all the time...
Eranga
|
|
|
|
|
How bad me. I can do it within Constructor and Destructor.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Have a good new year whole peoples.[^]
Bitte tun Sie mir nicht antworten, wenn Sie nicht wissen, die Ursache des Problems wirklich oder nur als Antwort. Was ist das? Dies ist das Buch sitzen.
|
|
|
|
|
Little late, but nonetheless, Merry Christmas.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Uh, one your are late. Two, wrong forum!
|
|
|
|
|
Hi,
I'm starting to programm apps for PPC 2003 using VS 2005 and I have a strange problem, when I have a normal empty window and i press the return key the window closes as it I head used the close button.
Why is it so and how can i solve this ina clean and decent way?
btw: how can I change the close OK button to the normal one with the X?
Happy New Year
Owen
|
|
|
|
|
|
The links you'v posted does not apply to my problem, because thay are for normal windows APP's but I have a Pocket PC app, there are no default buttons created.
The secund link points to a possible solution, but i think there must be a one special for PPC's that may fit much better
|
|
|
|
|
|
I already figured out a similar workaround using OnCommand, but I have than the problem that than also the Enter Key does not work any ware, when I intercept the return key in OnCommand it is not passed to OnChar, or else, i assume PreTranslateMessage will have the same problems.
The only thing bypasses the interception is OnKeyUp, OnKeyDown seems to dont work at all on PPC 2003 for the enter key.
I'm looking for a realy clean solution.
|
|
|
|
|
OwenBurnett wrote: i assume PreTranslateMessage will have the same problems.
try it
|
|
|
|
|
Seems to work better than OnCommand,
OnKeyDown is triggerd properly but with nChar == 0, but this is a minor problem and can be easly handled.
thx.
|
|
|
|
|
From where i can look at the OnMouseMove Flags for the some mousemove events.
Bitte tun Sie mir nicht antworten, wenn Sie nicht wissen, die Ursache des Problems wirklich oder nur als Antwort. Was ist das? Dies ist das Buch sitzen.
|
|
|
|
|
nFlags
Indicates whether various virtual keys are down. This parameter can be any combination of the following values:
MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.
|
|
|
|
|
Thanks
Bitte tun Sie mir nicht antworten, wenn Sie nicht wissen, die Ursache des Problems wirklich oder nur als Antwort. Was ist das? Dies ist das Buch sitzen.
|
|
|
|
|
Hi,
I am working on an element of a program which is performance cruical and I wanted to clarify something with regards to basic C++ inheritance.
Consider the following:
class BaseClass<br />
{<br />
public:<br />
BaseClass();<br />
<br />
void foo();<br />
<br />
private:<br />
int baz;<br />
};<br />
<br />
class AnotherClass : public BaseClass<br />
{<br />
public:<br />
AnotherClass();<br />
<br />
void bar();<br />
};
It is important to note that no virtual functions will be used within this element; including no virtual destructor.
My question is this, would there be any performance differences between the above source and the source listed below?
class CombinedClass<br />
{<br />
public:<br />
CombinedClass();<br />
<br />
void foo();<br />
void bar();<br />
<br />
private:<br />
int baz;<br />
};
The first example would be easier for me to maintain because there will be many variations of 'AnotherClass'. Does anybody know of the nitty-gritty low-level differences between the two and any such differences in performance?
Also do overloaded methods cause performance differences?
Any advice would be greatly appreciated!
Lea Hayes
|
|
|
|
|
Theoretically there should be no performance difference. The calls to foo() and bar() should be non-virtual in either case. But you can try having a look at the generated assembler code just to be sure.
BTW, if it's not a secret, what are you doing so special that you cannot use a virtual function call?
Florin Crisan
|
|
|
|