|
Sorry, what i meant was to show my class and how it get the information i want to be displayed. I got to use cppunit to test this class to show that it is extracting the right information.
For example, if the class extracts "a" , i will have to compare it to the cppunit test and see if it has the same value also.
The problem i am facing is how do i do a test based on the output.
|
|
|
|
|
Hallo,
I use a tabbed Dialog, which shows several Dialogs in it. The tabbed Dialog is resized to the size of its MDI Window.
The problem is, that if the MDI Window is resized to a smaller size then the dialog in the tabbed control, the dialog in the tabbed control is not shown completely.
So I want to know not the window rect of the dialog in the tabbed dialog, but the size of my form template, which I designed in the form editor of Visual C++ 6
So my main question is:
Is it possible to get the height and with of my form as it is in the editor, so to speak the size of my, for example, IDD_MAIN_DIALOG resource my CDialog derived class?
Thank you for your help!
|
|
|
|
|
use GetWindowRect() function to get rectangle for the dialog box and then a simple math will solve your problem
|
|
|
|
|
But the Problem is, that I get the current size of my form with GetWindowRect(). If it has already been scaled to small, some of the form controls will not be shown...I need the height and width of my Form as I see it in the form Editor...
|
|
|
|
|
One way I could think is store your original dialog rectangle in some variable and use those values in InitDialog() Function. The other dirty way, you can check the the dialog box co-ordinates in .rc file. and set the Dialogbox rectangle to those value in InitDilaog fuction().
HTH
|
|
|
|
|
|
Hi All,
How to convert a char array into CString? I have one array like this
char charr[1000];
....
drwFile.Read(charr,656); //reading some characters from the file
CString str;
how to store the charr array in to str?
Regards,
Kumar
|
|
|
|
|
The easy answer is: you don't have to convert, just assign it. But it depends on your UNICODE setting. I suggest you read this article[^] to get a better understanding on character encodings. This will help you a lot in the future.
|
|
|
|
|
Thanks Cedric! The given article is very help full
Can't we convert the char array like this?
Cstring str(charr); //charr is char array
Regards,
Kumar
|
|
|
|
|
Yes, the CString constructor is overloaded to accept that.
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]
|
|
|
|
|
As I said in my previous reply, it all depends on your UNICODE setting.
BTW, why don't you just check ? It's one line of code and you can easily verify if it compiles or not. If UNICODE is turned on, the code won't compile.
|
|
|
|
|
Nope. It will work. CString constructor automatically handles the conversion,
see [^].
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]
|
|
|
|
|
Just be carefull, your char array has to be null-terminated to be used to initialize a CString like that or even if you use the = operator ( CString str; str = charr; ). Othwerwise it will keep on reading characters till it finds a null character somewhere after your array and which either results in access violation OR you get garbage in your str.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I have client and server . hundred of client connect to the server . and I am serving the data to the client
but not every client is getting data . why it is happening . I think this is due to winsock internal buffer
is there way to increase winsock internal buffer . i am using TCP/IP socket
Trioum
|
|
|
|
|
trioum wrote: I think this is due to winsock internal buffer
I think not.
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]
|
|
|
|
|
then please suggest me some solution
Trioum
|
|
|
|
|
Without seeing your code I may just suggest you to fix it...
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]
|
|
|
|
|
I agree with CPallini, this is unlikely to be related to an internal buffer. We would need more detailed information to help you with your problem, here are some suggestions to look at:
1) Check in the server code that you are actually sending complete data package to every client, e.g. by comparing that the return value from send() is equal to the number of bytes and that there were no errors. A server should be able to handle a couple of thousand clients, make sure you are not running into a OS specific upper limit.
2) Check in the client code that you are actually connected to the server and debug received data, e.g. print out the number of received bytes from recv() . TCP is a stream oriented protocol, which means that when the server sends 100 bytes you might get 100 bytes or chunks of 2 times 50 bytes etc (this could confuse the receiving side).
3) If you are new to network programming it is always good to start with working examples. Have a look at Beej's guide to networking programming[^] and Winsock Programmer's FAQ[^], there are client/server examples in section 6.
Let me know if that helps
/M
|
|
|
|
|
I am using windows server 2003 and currently 200 clients connected to it regularly.
all clients are connected fine. I am sending the data to the clients frequently .
I am getting data from the data base .and using the timer of 100 miliseconds . as data change
I send the data to the client in loop one by one . every time it monitor on 100 ms for change in
database. some clients not getting data . and on next timer they get the data . problem is
occuring to any client randomly .
Trioum
|
|
|
|
|
What I find strange is that you send data to all clients and some miss one data set. With a TCP stream it is not possible that the socket forgets or jumps over one data set. I suspect that the problem is in your application code, please have a look at my previous posting and do some debugging on server and client side. If possible try to isolate the problem, provide more information or source code. In any case, a few hundred clients are no problem for your OS.
Happy bug hunting!
/M
|
|
|
|
|
Chances are there is a problem in your timer handling, such that you start sending a new message before completing the previous one.
MVP 2010 - are they mad?
|
|
|
|
|
while debugging on sevrer side while sending data . send() in returning -1 for few clients
and bytes send for some client . it is for about 20 - 30 clients randomly on every timer ticks
Trioum
|
|
|
|
|
trioum wrote: send() in returning -1
What does WSAGetLastError() return?
MVP 2010 - are they mad?
|
|
|
|
|
When you encounter and error while sending check what error code[^] you got. From MSDN:
If no error occurs, send returns the total number of bytes sent, which can be less than the number requested to be sent in the len parameter. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
/M
|
|
|
|
|
No buffer space is available
Trioum
|
|
|
|