|
I have an app that can either be a chat client or a chat server.
I can run two instances of the app and use one a a client and one as a server.
I have them configured to use the local loop, but, when I send a message, it works fine but the 'OnRecieve' function in the server never gets called.
This is actually a program out of a book.
I can send the code if anyone can help.
Thanks!
|
|
|
|
|
how do you clear a file, in plain c++ (console) and how do you put something into a buffer and then flush it to a file... again in c++(console), help. THX
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
See the description of the mode argument in the fopen() documentation.
Use fflush() to flush the buffer, but remember that calling fflush() will not guarantee that data is written to disk if you have write caching enabled on your system.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
The solution you've been given is C. To do it in C++, try this:
#include <iostream>
std::ofstream myFile ("c:\\myfile.txt");
this will open the file in the default mode, which empties the file. The destructor will close the file, or you can call myFile.close(); if you need to.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
How can I force my own window BottomMost?Like Win2k's desktop window.Thanks
|
|
|
|
|
Look up SetWindowPos, you can tell it not to move or resize the window with something like SWP_NOMOVE | SWP_NOSIZE, then there are flags you can set for the position in the Z order.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Can you give me a example code?Thanks
|
|
|
|
|
Not off the top of my head, type SetWindowPos into google and you'll be right.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I use SetWindowPos(&wndBottom,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE) in OnCreate(),
but I can't see any effect.
|
|
|
|
|
From memory, there is wndBottom and also wndBottomMost. I believe the difference is that one moves it to the bottom and the other causes it to stay there.
I've not done any MFC for a good 18 months, so this is pretty rusty sort of advice, sorry
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Never mind,My dear friend,Thanks for your warmhearted advice.
|
|
|
|
|
i've got my new you-beaut program ready to roll except for one thing, my program on the USB drive must autorun once it is connected..
I've been doing a bit of research on making my USB drive to autorun. Based on what i've gathered, "the device must not be marked as a removable media device" - <http: www.microsoft.com="" whdc="" hwdev="" bus="" usb="" usbfaq.mspx="">
would anybody know how to achieve this??
(i've considered writing a hook application to handle the autorun side of things. but i would consider this as the very last option)
thanx all
|
|
|
|
|
Hi,
I've just started to use the mfc CPropertySheet and CPropertyPage classes. I've created 2 dialog resources, linked them to CPropertyPage based classes, added them to a CPropertySheet and displayed them. The tabs come up correctly and the dialog content is displayed correctly...
*BUT* I have combo boxes in each of the dialogs. When the button on the combo box is pressed to view the combo options of the box, you can't click on any of the options. No clicks anywhere in the property sheet dialog do anything. You can press the esc key and the combo options box disappears, allowing you to click on the form again.
I really need these combo boxes to be working. Is it something easy to modify to fix, what could be the problem? Any help with the solution would be great!
Thanks,
Dave
|
|
|
|
|
Hi,
I am very curious as to what you did wrong. I just set up a very simple project in a few minutes with the same description as you gave here, i.e One property sheet and two proprty pages each with a ComboBox and the project builds and compiles and runs fine. I can select either combo box and then select a new item. Have you done something different like overiding the draw of the combo boxes or anything.
Check that the properties of the combo box are set as they would be for the default behaviour.
Mark.
|
|
|
|
|
Check that the height of the dropdown lists (in the resource editor) of the combo boxes is long enough.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yeah, that's ok, I can see all the items I put in the dropdown lists, but I just can't click on them.
My main app is modeless dialog based.
Thanks,
Dave
|
|
|
|
|
|
I remember this!! (But it was fixed in MFC 4.2)
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
The problem still exists when a property page has an embedded property sheet - the focus gets all messed up and locks up the application (I'm using VC6).
Steve
|
|
|
|
|
Hi,
I tried opening a file in a edit box using the following code
CFile ComFile(triccomfilename,CFile::modeRead);
DWORD dwSize = ComFile.GetLength();
Buffer = new TCHAR[dwSize];
ComFile.Read(Buffer, dwSize);
ComFile.Close();
ccedit->SetWindowText(Buffer);
The code works perfectly, but the problem is that I get some extra characters in the edit box, for example if the file contains "HELLO" , then the edit box displays, "HELLO yyyyYYYYYYYYYYYYYYA". I dont know why it happens , can anyone help me out?.
Thanks,
Deepak Samuel
|
|
|
|
|
You're not initialising the buffer to be null, so your string includes any guff that was in that memory until it finds a null. Do this:
Buffer = new TCHAR[dwSize + 1];
::memset(Buffer, 0, dwSize + 1);
I *think* that the value to set comes in the middle, then the size. If this does not work, swap the last two parameters.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thanks a lot..It worked..
Regards, Deepak Samuel.
|
|
|
|
|
I have kind of a strange problem which I hope someone here can offer some advice on. I have a kind of options dialog which is popped up from within another dialog.
In the 2nd dialog I get a couple of numbers and an option from the user and then return. The problem I ran into was how to get control long enough to do an UpdateData to move the screen data into my variables.
The only thing I could think of was to change the OK button from IDOK to ID_BEXIT and use this code;
void TimeGet::OnBnClickedBexit()
{
UpdateData(TRUE);
CDialog::OnOK();
}
This works ok but it does a strange thing. I have to click the OK button twice in order for the 2nd dialog to close and control return to the first.
Does anyone have any idea why I need to click OK twice? Or perhaps a better way of accomplishing the task.
Thanks!!
Karen
|
|
|
|
|
You don't need to change to ID, you just need to override the method that gets called when you click 'OK'.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian,
That was my first thought, but I can't find exactly what to override. There is no reference to IDOK anywhere in the diaog except the one I put threre. Any hints?
Karen
|
|
|
|