|
In my project,When I execute debug program,the result is which I just want.But if execute release prgram,to my surprise,the result is what I can't image.
What I mean is that the debug program get the result which I expect,but the release program seems somewhere have errors(but I can't find it).In the debug mode all the parameter is right(I use CDWordArray for the parameter).
I want to know how to find the error.
Thank you for help!
Don't look at me in that way!
|
|
|
|
|
Take a look at your variable initialisation. In debug mode they get set to 0 by default, in relase, they are random. Sounds like you are relying on a value being set to 0 somewhere.
Also, of that doesn't work, try turing all optimizations of in the release build.
Joseph Newcomer has written an artical on this. I dont have the URl handy, but its on this site somewhere
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
|
i want to know that is there any utility that converts the C code to C++ code , not whole programs or projects, but atleast the minimal language constructs.
if anybody know abt that do tell me abt that and feel free to contact me at
m_khawar@yahoo.com
Thanking In Advance.
RANA KHAWAR
|
|
|
|
|
What kind of conversion are you asking about, mallocs into new's, C style casting into C++ casting?
I very much doubt it exists except for converting the simplest of code.
Michael
|
|
|
|
|
I don't know of any utilities, but you can start by renaming your ".c" files to ".cpp". The rest will be up to you. C++ is such a flexible language that it's almost impossible to write a utility that can, for example, group a bunch of your global functions into one class. Still, it shouldn't be difficult for you to do and it's actually a highly useful exercise, IMHO.
Regards,
Alvaro
Kinda hard to sign my name without anything to write with. Anyone got a pen?
|
|
|
|
|
template <<class t="">
struct A
{
const operator =(const A&) {}
}
class B : public A<
{
const operator =(const B&) {}
}
main()
{
B b,b2;
b=b2;
}
The question here is, how do i get
b=b2
to also call A:operator=() ??
and that without having to add code to
the implementation of B.
(Another question is how to add << to messages...(and get only one))
/Magnus
|
|
|
|
|
int main()
{
B b,b2;
b.A<B>::operator=(b2);
b=b2;
return 0;
} As for the second question, replace your < characters with < .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
i have been writing a chat program both server side and client side by using MFC CAsyncSocket Class and i had succeded to implement and chat on our LAN at job.
It is really a good experience for me in both learning C++ and Visual C6.0 media. i have just wanted to consult ur precious knowledge about something i could not implement in my server side App.
Let me talk about a little bit about how Apps work:
İn My Server App, i create a Server Socket and make it listen for connection requests from clients. Clients ("these are my job friends. ..") make connections using my client App to my server App. so, i really know what happens at both side. When people connect to server, all they can talk to the same room and everybody sees what others said and they can whisper special messages to special users if they want like ordinary chat programs as well. Server handles every user information ( user name, IP_Address, OnOff time, Incoming Messages...etc,) in a structure that is a linked list created dynamically when each user connects and disconnects. Server adds and deletes all users to a dynamically created Socket Linked List. i also thought to try to create individual threads for each user connecting but since Linked list worked i gave up.
What is my problem is that. When someone writes a message while in room chat, Server takes this message from that user and sends it back to all users that are online ONE BY ONE. By this way everybody sees the written message in their Client App. It is not efficient for Server Processing time to distribute one message to all users one by one. It would be efficient for Server App to SEND BROADCAST messages to all users at one time. But since i don't use Windows Sockets but MFC i could not find my way.
Is it possible to send BROADCAST message while my server Socket and Client sockets are STREAM_SOCKET type ( i created my sockets from that type)
or is BROADCASTING a subject of only DATAGRAM_SOCKET type.
i don't know what will i do. Should i change my Application structure or is there another way that solves my problem.
i really think the future when lots of people connects and sends messages simultaneously. Server also handles a database that keeps special user information ( name, age, gender, height, weight, email adds...etc) and adds deletes and updates and sends them back whenever a user wants to see his/her user details like on ICQ.
So for my server App, dealing with all these tasks takes time and i want to use my Server Processing as efficient as possbile.
Thanks for ur helps...
Yours respectfully,
Atilla Selem
Electronics Engineer,
Aselsan A.Ş
www.aselsan.com.tr
willing to learn and teach
|
|
|
|
|
Nope, if you want to broadcast you need to use a connectionless protocol. The most appropriate would be UDP.
But don't let that scare you, UDP would be ok for a chat app.
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
should i change my socket type to DATAGRAM SOCKET?
could u give me the address of sending BROADCAST msgs to users by showing me a small code if u have..?
thanks for ur help...
willing to learn and teach
|
|
|
|
|
There is another way you can do that. The clients could connect into a remote IP listerning socket on the server. The server only has to send a packet once.
Here at codeproject there is an awesome article by Gary Brewer about IP Multicasting that shows you how to do it in C#. Pretty easy to do the same thing in MC++
http://www.codeproject.com/csharp/multicast.asp
Let me know how it works for your program!
Al
|
|
|
|
|
hi all,
I am trying to write a program which will needs to detect windows version before loading. can I do this by using #ifdef macros. if yes what must the Predefined Macros
#ifdef ?
//Load DLL for windows NT
....
#elseif ?
//Load DLL for windows 98
....
#else
//Load DLL for windows XP
.....
#endif
or do you recommend me an other way...
thanks.
karanba
|
|
|
|
|
Thats not going to work. #defines are dealt with at compile time, not run time.
To establish the OS version at run time use the GetVersionEx API function.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Take a look at your stdafx.h file:
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
Knowing this, I search for WINVER and found an article called "Using the SDK Headers" that includes a table and instructions on how to do what you want.
If you have VS.NET, enter a value of ms-help://MS.VSCC/MS.MSDNVS/sdkintro/usage_8xgz.htm into the URL field in the Web/Help toolbar. If not, just search on WINVER.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|
|
|
GetVersion[Ex]
If you also want info about the machine, you might want to take a look at GetSystemMetrics and GetSystemInfo .
/moliate
|
|
|
|
|
I need to enable/disable the minimize & close button of a dialog at runtime.
DialogStyle: overlapped, Border: Dialog frame, systemmenu, minimize box & no maximize box
With this code only the close button can be grayed, the minimize button stays active.
what is wrong ?
bool CDlg::EnableMinimizeButton(bool bEnable)
{
CMenu* pSystemMenu = GetSystemMenu(FALSE);
if (bEnable)
pSystemMenu->EnableMenuItem (SC_MINIMIZE, MF_ENABLED | MF_BYCOMMAND); //NOK
else
pSystemMenu->EnableMenuItem (SC_MINIMIZE, MF_GRAYED | MF_BYCOMMAND); //NOK
return true;
}
bool CDlg::EnableCloseButton(bool bEnable)
{
CMenu* pSystemMenu = GetSystemMenu(FALSE);
if (bEnable)
pSystemMenu->EnableMenuItem (SC_CLOSE, MF_ENABLED | MF_BYCOMMAND); //OK
else
pSystemMenu->EnableMenuItem (SC_CLOSE, MF_GRAYED | MF_BYCOMMAND ); //OK
return true;
}
|
|
|
|
|
Instead of this:
NikoTanghe wrote:
bool CDlg::EnableMinimizeButton(bool bEnable)
{
CMenu* pSystemMenu = GetSystemMenu(FALSE);
if (bEnable)
pSystemMenu->EnableMenuItem (SC_MINIMIZE, MF_ENABLED | MF_BYCOMMAND); //NOK
else
pSystemMenu->EnableMenuItem (SC_MINIMIZE, MF_GRAYED | MF_BYCOMMAND); //NOK
return true;
}
Try this:
bool CDlg::EnableMinimizeButton(bool bEnable)
{
LONG lStyle = GetWindowLong(GWL_STYLE);
if (bEnable)
SetWindowLong(GWL_STYLE, lStyle | WS_MINIMIZEBOX);
else
SetWindowLong(GWL_STYLE, lStyle & ~WS_MINIMIZEBOX);
return true;
}
This will set or remove the WS_MINIMIZEBOX style, which will remove the ability for your window to be minimized.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
bool CDlg::EnableMinimizeButton(bool bEnable){LONG lStyle = GetWindowLong(GWL_STYLE);if (bEnable) SetWindowLong(GWL_STYLE, lStyle | WS_MINIMIZEBOX);else SetWindowLong(GWL_STYLE, lStyle & ~WS_MINIMIZEBOX);return true;}
this code works fine, thanx
Afterwards, you still need to refresh the window with CWnd::DrawMenuBar();
|
|
|
|
|
When you double-click and select a text, it stores in memory. How can I get this?
kozlu
|
|
|
|
|
Where are you double-clicking the text, and how is it getting into memory. I am unclear of this, If you give a little more detail maybe I can help.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Any application which has an edit view, edit control etc. And getting in memory is my opinion... I searched messages with Spy++ tool when I double-click and selected the text but I couldn't find any...
kozlu
|
|
|
|
|
You can get the text from an edit control with the GetWindowText() function. You can also use the EM_ style messages if you look them up in MSDN or at MSDN.microsoft.com.
I think the message that you will be interested in is EM_GETSEL.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I am making server socket with CAsyncSocket. But I don't
get how to unlimited buffer for receive messages.
I don't know data length before I get it, and I
don't want to create constant Huge buffer, but just
buffer sized data length. This migth be simple
question, but i don't know how to do it.
|
|
|
|