|
and why TF whould you do such a thing like strlen(NULL) ?
if you had looked at the doc before asking, you would see that strlen() gets a const char* parameter. obviously, it has to be valid (that means, it has to point to a valid string). NULL is not a valid pointer, hence the crash.
on the other hand, "" is a valid string (even though empty, but valid), so strlen("") returns the number of character in that empty string : 0 characters.
|
|
|
|
|
Hi all,
I want to make option buttons in my tree control...
How can i do this??
thanks in advance
|
|
|
|
|
hi how to create and run a webserver in VC++(MFC)
|
|
|
|
|
You just posted this same inane query 4 hours back. At first, you post a query that is not in compliance with the guidelines[^], and you can't wait for a day before re-posting it?
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
There's a link to one on the front page you clown.
A C++ Embedded Web Server[^]
And yeah - I did 1 vote both posts from you asking this question today.
|
|
|
|
|
The source code for the Apache HTTP server[^] shows a pretty good example of a web server implementation
Seriously, what are you asking? Do you want to use someone elses
server or develop your own? To do your own you're going to need
to have a firm grasp on the TCP/IP protocol and the HTTP protocol[^].
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi everybody,
i like to center a label into a CDialog.
I calculate the left and right position of the label to set the postition via a SetWindowPos.
left gets the value of the calculation and the right value is (left + WidthOfLabel)
In this case the width of the displayed label should be constant at a width of "WidthOfLabel", right?
But in my application the width of the label grows sometimes of one pixel..
If i resize the dialog at a double size, the label has a bigger width than the initial width
Is there a special treatement behind the SetWindowPos which changes the sizes sometimes to fit to the Dialog automatically ?
Big thanks
|
|
|
|
|
baerten wrote: i like to center a label into a CDialog.
You don't like CenterWindow() , do you?
Regards,
Sandip.
|
|
|
|
|
LOL
ehm Okay ... i think your way seems to be easier
But anyway a strange behavour.
Thanks SandipG
|
|
|
|
|
baerten wrote: Is there a special treatement behind the SetWindowPos which changes the sizes sometimes to fit to the Dialog automatically ?
Not that I know of.
How are you calculating WidthOfLabel?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
i have a structure and BYTE array
typedef struct _my_struct
{
DWORD dwValue ;
BYTE yValue1 ;
BYTE yValue2 ;
WORD wValue1 ;
BYTE yValue3 ;
WORD wValue2 ;
BYTE yValue4 ;
}mystruct ;
BYTE Buf[10] = {"ab--c--d"} ;
i need to copy
a to yValue1,
b to yValue2,
-- to wValue1,
c to yValue3,
-- to wValue2,
and d to yValue1.
i tried the following code but its not working
mystruct st ;
memcpy( &st.yValue1 , Buf , 6 ) ;
is any way to do that ?
Thanks & Regards
|
|
|
|
|
nitin3 wrote: mystruct st ;
memcpy( &st.yValue1 , Buf , 6 ) ;
i
do not use this unless you are sure about the alignment of your structure.
If you are not aware of what is alignment read this Pragma packing[^]
Regards,
Sandip.
|
|
|
|
|
nitin3 wrote: is any way to do that ?
Yes, using the recipe
nitin3 wrote: copy
a to yValue1,
b to yValue2,
-- to wValue1,
c to yValue3,
-- to wValue2,
and d to yValue1.
you proposed.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
One problem is that you're copying 6 bytes, but the length of Buf is 8.
|
|
|
|
|
Aside from needing to pack the structure:
#pragma pack(push, 1)
typedef ...;
#pragma pack(pop)
and copying 8 bytes, not 6:
memcpy(..., 8);
you may also need to swap the WORD values after the copy depending on their represenstation in Buf and meaning in mystruct:
memcpy(...);
_swab(&Buf[2], &st.wValue1, 2);
_swab(&Buf[5], &st.wValue2, 2);
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
modified on Monday, September 22, 2008 6:37 PM
|
|
|
|
|
Hello All,
I am hooking into the "Windows Mail" application through 'c' langugage by a COM dll in 'c'.
When the "Windows Mail" application window is activated, the IStoreNamespace object is created and initialised from within the scope of the Windows Mail application. As described in the previous post above, the RegisterNotification method fails with error E_NOTIMP.
Other functionality of the IStoreNamespace seem to work as required.
I have also tried a number of simple test applications using the IStoreNamespace object and they seem to work including the RegisterNotification method.
Also the same code base and hooking process is working on Windows XP and Outlook Express.
Please Help me in this, as I have been trying its solution since long!
Thanks in advance!
dolly,
N,IN
|
|
|
|
|
Hello everyone,
The different assembly code when we call through z and z1 in below sample is,
- we know the type of z, so no need to access vtable to make function call;
- we do not know the exact type for a pointer, so need to access vtable to make function call.
My question is whether my two items' understanding is correct. Thanks.
z.func();
000A1575 lea ecx,[z]
000A1578 call Zoo::func (0A11A4h)
z1->func();
000A157D mov eax,dword ptr [z1]
000A1580 mov edx,dword ptr [eax]
000A1582 mov esi,esp
000A1584 mov ecx,dword ptr [z1]
000A1587 mov eax,dword ptr [edx]
000A1589 call eax
000A158B cmp esi,esp
000A158D call @ILT+440(__RTC_CheckEsp) (0A11BDh)
class Zoo
{
public:
virtual void func() {cout << "Zoo" << endl; }
};
int main()
{
Zoo z;
Zoo* z1 = new Zoo();
z.func();
z1->func();
delete z1;
return 0;
}
thanks in advance,
George
modified on Monday, September 22, 2008 4:49 AM
|
|
|
|
|
Dear all,
I have an application that can identify a window. The method in which I worked out is given below.
I will store the attributes of the window such as( class name, window caption, resource id etc..) to a file.
When the second time , window is up, using the above attributes, I will identify the window.
But, I encounter a problem with the above scenario. The problem comes, when the 'window does not have
window caption', 'window class name is same' and 'control id is zero'..
I can't use window handle, bcz it will differ when the window is up for the second time.
Is there any method to solve this problem? OR Is there any unique attribute to identify the window?
Please help,
Thanks in advance,
George K J
modified on Monday, September 22, 2008 4:22 AM
|
|
|
|
|
IMHO there is a logical pitfall in your requirements: processes and executable files are different things. For instance you may have three different instances of your_application.exe running at the same time, the system allows you to differenziate between these three processes, but such a distinction makes sense only at runtime.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In the VC++, when we create a control (such as button, static,...), the text on this control should be bold. what can we do to make it to normal???
|
|
|
|
|
I think you are working in Win32. Did you try SetFont(/*params*/)
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
<br />
font.CreatePointFont (100,"Arial");<br />
<br />
RECT rect;<br />
rect.bottom = 100;<br />
rect.left = 0 ; <br />
rect.right =100;<br />
rect.top = 0;<br />
<br />
btn.Create ("MyButton",WS_CHILD|WS_VISIBLE,(const RECT &)rect,this,ID_BTN1);<br />
btn.SetFont(&font,false);<br />
font and button are both member variables of the class
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
If you are using win32 API, then -
You can use CreateFont.
Be sure the handle returned by CreateFont ( which you will use for the WM_SETFONT message ) is valid throughout the lifetime of the button window.
If you want to make the font normal for all texts, then following may be helpful-
HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
It may be helpful, but not sure......
"We can't solve problems by using the same kind of thinking we used when we created them"
|
|
|
|
|
nguyenbinh07 wrote: the text on this control should be bold.
What is it instead?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|