|
Does your text happen to have any embedded CR OR LF characters in it? I just tried this by entering a long line of text into a narrow edit control and it scrolled vertically until I hit Enter.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes. The text file has newline characters in it. The edit box will jump to a new line after a limited length of characters even if it doesn't meet a CR or LF character. While this is not what I want. thanks anyway.
gavin
|
|
|
|
|
|
Looking at this syntax, I can't quite see what the end result should be. What does this function return?
long comm_fm_node_id(comm_fm_dev_t *dev, long group) {
return (group == 0) ? MCAST_nodeid : -1;
}
Patrick
|
|
|
|
|
if(group == 0)
return MCAST_nodeid;
else
return -1;
|
|
|
|
|
it means :
long comm_fm_node_id(comm_fm_dev_t *dev, long group) {
if (group == 0) {
return MCAST_nodeid;
}
else {
return -1;
}
}
but i really don't see what dev is passed to the function if it doesn't use it, and i suspect MCAST_nodeid to be a global variable...
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Dev isn't used because it's only a partial implementation... I'm trying to finish the implementation...
Thanks for your help.
Patrick
|
|
|
|
|
pgav wrote: long comm_fm_node_id(comm_fm_dev_t *dev, long group) {
return (group == 0) ? MCAST_nodeid : -1;
}
By the way, be VERY judicious when using the ternary operator (which is what the expression ? result_if_true : result_if_false is called). Most of the time, it is far more clear to write:
if (expression)
{
return SomeValue;
}
else
{
return SomeOtherValue;
}
I can't tell you how many bugs I've run into because people tried to get fancy with the ternary operator and do things like:
return expression1 ? expression2 ? expression4 ? 1 : 0 : 3 : expression3 ? 2 : 4;
If you run into something like that, you should hunt down the person who wrote it, take them out behind your office, and ... well, you get the idea.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
Is any one aware of a technique of easily putting a breakpoint in every function in a solution (MSDev.Net 2003).
I'm currently having to make some modifications to the Firebird 1.5 source code and finding where it is called when a user calls connection.setAutoCommit(false); from a Java Servlet is turning out quite time consuming.
Thanks
Tom
|
|
|
|
|
Hey guys,
Im working with winsocket in one of my projects and I have some questions regarding Windows Sockets. I see that it is used to send data over the TCP/ IP network protocol but why is it specifically called Windows socket? If I try running two different simulations which interact with one another over a network, do both of the simulations have to be running on the WINDOWS OPERATING SYSTEM? If anyone has any links that can give me the basic understanding of what goes on in the Windows Socket it would be greatly appreciated
Thanks,
Jay
|
|
|
|
|
WinSock is just the library name. It is basically Microsoft's implementation of the Berkeley sockets that are used on *Nix systems. From a development point of view, there is very little different in the way of method calls, arguments, etc (outside of initializing and freeing the library). When using it, you can communicate with anything that talks TCP/IP, regardless of the OS. Just make sure you keep byte-ordering in mind when programming.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Jay03 wrote: If I try running two different simulations which interact with one another over a network, do both of the simulations have to be running on the WINDOWS OPERATING SYSTEM?
No. That's the beauty of TCP. Neither end has to be concerned with the other (e.g., Windows <-> Unix <-> OS/400). They just both have to speak the same language. This is a somewhat simplified explanation. See here for more on TCP. See here for more on the OSI model.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
TCP doesn't inherently care about different architectures, but some care (see ntohl and htonl) has to be taken to make sure that the data you send (you just hand the functions a hunk of memory) isn't architecture / OS dependent.
earl
|
|
|
|
|
Great answers guys....... thanks a lot!
|
|
|
|
|
Hi,
I'm an embedded C programmer trying to migrate a set of makefiles from using VC6 tools (with msdev.exe) to VC++ Express + Platform SDK (with vjproj.exe).
I find vcproj is rather underdocumented. Could someone please help me translate a few lines in the makefiles?
Old: msdev pname.dsw /make ALL /clean
New: vcbuild pname.vcproj /clean
... Could you please tell me if these lines accomplish the same thing? I think using "ALL" told msdev to make all the available configurations, but I can't find an equivalent with vcbuild.
Old: msdev.exe pname.dsw -ex macroName /nologo
New: vcbuild pname.vcproj ???????????????????????
... The -ex flag tells msdev to invoke a macro. I think if I were using VC7 and devenv.exe that I would use /command. I can't find anything similar for vcproj.
Old: msdev pname.dsw /make "FileName - Win32 $(MSDEV_CONFIG)"
New: vcbuild pname.dsw /rebuild /OUT:FileName "$(MSDEV_CONFIG)|Win32"
... I am using /rebuild because I read a post/answer that indicated vcbuild has problems with pre build events, generated cpp files, or projects which have more than one level of depencency, and that /rebuild should alleviate "most" issues. Do you know if this is still the case? Also, am I translating the use of FileName correctly?
Thanks!
|
|
|
|
|
jasper77 wrote: Old: msdev pname.dsw /make ALL /clean
New: vcbuild pname.vcproj /clean
... Could you please tell me if these lines accomplish the same thing? I think using "ALL" told msdev to make all the available configurations, but I can't find an equivalent with vcbuild.
Old: msdev.exe pname.dsw -ex macroName /nologo
New: vcbuild pname.vcproj ???????????????????????
... The -ex flag tells msdev to invoke a macro. I think if I were using VC7 and devenv.exe that I would use /command. I can't find anything similar for vcproj.
Old: msdev pname.dsw /make "FileName - Win32 $(MSDEV_CONFIG)"
New: vcbuild pname.dsw /rebuild /OUT:FileName "$(MSDEV_CONFIG)|Win32"
... I am using /rebuild because I read a post/answer that indicated vcbuild has problems with pre build events, generated cpp files, or projects which have more than one level of depencency, and that /rebuild should alleviate "most" issues. Do you know if this is still the case? Also, am I translating the use of FileName correctly?
Well, I've indentified one problem: the new lines should use .sln instead of .dsw. However, the rest of my questions remain.
Thanks!
|
|
|
|
|
Hello,
I have a dialog with an OK and Cancel button, for example. Until a certain event takes place, the OK button is disabled, and the Cancel button is default (ie: has the thicker black outline). When the event takes place, and the OK button becomes enabled, I want it so that the OK button instantly becomes the only default button. With what keywords can I accomplish this?
Thanks
|
|
|
|
|
use <a href="http://msdn2.microsoft.com/en-us/library/7sd15kw3.aspx" rel="nofollow">CDialog::SetDefID()</a>[<a href="http://msdn2.microsoft.com/en-us/library/7sd15kw3.aspx" target="_blank" rel="nofollow" title="New Window">^</a>]
for instance :
this->SetDefID(IDOK);
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
can you please be more specific, I'm not sure how you mean to implement this.
|
|
|
|
|
the this is the pointer within the CDialog class in which the processing event were caught.
i mean, if you're switching the default button when typing something in an edit box for instance, you override the EN_CHANGE message of that edit box, and as this editbox belongs to the dialogbox, the this pointer refers to the dialog box.
have you even copied the code to try it ?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
aafcls wrote: can you please be more specific, I'm not sure how you mean to implement this.
Just call SetDefID(IDOK) . It's not any harder than that.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi.
I am writing a console app that needs to be invisible. What is the easiest way to make sure that the Console window doesn't flash on the screen?
Cheers
Dave Kerr
codechamber@hotmail.com
http://www.codechamber.com
|
|
|
|
|
The easiest way to do this is to change your main function to WinMain. And change the SubSystem in the Linker/System panel from Console to Windows. Recompile and you are done.
AliR.
Visual C++ MVP
|
|
|
|
|
Hi Ali,
Thanks very much- that worked perfectly.
Cheers
Dave Kerr
codechamber@hotmail.com
http://www.codechamber.com
|
|
|
|
|
Hello everybody,
I have developped a Visual C++ application that drives a serial COM port (9600 8 N 1).
When I use the PC's COM port to dialog with the hardware, the application works correctly; but when I connect the hardware to a USB port via a profilic USB to serial adapter the application shows a error message and closes abruptly.
Does somebody encountered such a problem ? or any idea about how to solve or debug ?
Thank you in advance,
AG
|
|
|
|