|
LighthouseJ wrote:
Some sites say "use UpdateData" and others say "don't use UpdateData".
Calling UpdateData() manually can invite lots of problems. When it's called automatically by OnOK() , that's fine.
What types are m_compressionRadio , m_singleComboInt , and m_doubleComboInt ? Can you verify that the three statements in DoDataExchange() are being called after the OK button has been clicked?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thank you for your response. I fixed the combo values with the other reply in this thread and just now I realized that I set the "Group" property for both radio buttons but remembered only the radio that has the member value that will be returned should have the Group property set. The results fully work now, thanks again.
|
|
|
|
|
Hey all,
I've been toying with making a TCP connection and sending and receiving strings for a couple of days now. I've finally gotten to the point where I can initiate a connection, send some data, and receive some data (I pretty much have a WHILE loop in there listening for certain strings coming back). I'm doing it in the manner of:
CSocket mySocket;
if (mySocket.Connect("192.168.1.105",2000)) {
// while ...
// mySocket.Send();
// mySocket.Receive();
}
All I'm using is CSocket::Connect, Send and Receive. It's working great. I've been stuck for a day now on how to detect when that socket has been closed. (IE, I physically disconnect the LAN cable on the 192.168.1.105 PC). I cannot figure out how to do this. I've read a bunch of articles, and I simply cannot get it to work. I was hoping there was some sort of " if mySocket.IsStillOpen() .... " method existed, but I cannot find one. I'm not sure how to proceeed and was looking for a pointer in the right direction. Any help is extremely appreciated, as this has been a long road to do what seems to be a simple task (I guess I'm a slow learner!)
Thanks much in advance
|
|
|
|
|
I'm not an expert here but the OnSend member should return a value of WSAENOTCONN if you try to send data to a remote you're not connected to. I'm sure it will return something other than success if the cable is unplugged during the transmission. Are you checking return values?
|
|
|
|
|
Sometimes, if I do mySocket.Receive ..... and the socket disconnects (ie, I do a mySocket.Receive... and the socket is still connected, but the remote end has not sent anything ... and I disconnect the LAN cable, dropping the connection ...) the program just sits and hands on the mySocket.Receive() code. (I have a "MessageBox()" before and after the receive statement, so I can tell that it gets to there, and then it's like it tries to listen for data, even though the connection has failed, and never exits out of that receive method. I'm wondering how I can get around this??
|
|
|
|
|
|
Unplugging the network cable doesn't close a socket. Plug the cable back and data transfer should continue, TCP/IP is designed to handle unreliable physical connections.
|
|
|
|
|
hi,
on my application i have lib file for toolbar and i want host( attach ) this lib file to Internet Explorer but i dont know how
thanks
|
|
|
|
|
I am doing a printscreen, but would like to delay call by 1 s. What function can I call to delay execution for 1 s?
|
|
|
|
|
sleep() or sleepEx()
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
This is the part of program I need a slight time delay without the client knowing a time delay exists. Here is the code segment I have problems with The message box does not appear on first printout, only on subsequent ones.
void CWaterHammer::OnBnClickedPrint()
{
CPrntScreen * ScrCap;
ScrCap = new CPrntScreen();
m_caveat="This publication is intended for use as a piping system guide. It should not be used in place of a professional engineer’s judgment or advice and it is not intended as installation instructions. ";
GetDlgItem(IDC_EDIT2)->ShowWindow(true);
CEdit* pCEditBox = (CEdit*)this->GetDlgItem(IDC_EDIT2);
pCEditBox->SetWindowText(m_caveat);
ScrCap->DoPrntScreen(1,0,true); //Client area, Printer menu
delete ScrCap;
ScrCap = NULL;
}
|
|
|
|
|
What I want to do is wait to call prsntscreen until the text appears on the screen. SetWindowText returns an error code, how can I use this?
|
|
|
|
|
Must the text appear on the screen before capturing it? How about adding the text to the captured screenshot?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
There is a delay in the text appearing before the next fuction is called to do the screenshot. I Even used GetErrorMsg(), which released a non-error code from SetWindowText(..) call. Thus, this is not applicable, since text appearing on client screen and executable are out of sync. I also tried using Sleep() in PrinScreen function, this affected the text appearing on screen as well. Go figure.
Yes the only solution is to append the text to the captured and printed bitmap before releasing printer. Another function call needs to be made to do this, it would be similiar to sizing the bitmap image after screen capture.
Thank you,
Diana
|
|
|
|
|
DiMats wrote:
Yes the only solution is to append the text to the captured and printed bitmap
See my article on rendering text on a bitmap for how to do this.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
I have a CSocket object that I need to share between two threads in two different objects (one thread in each object). I am using a Console App that supports MFC using VC++ 6.0.
I create the CSocket object in the 'main' function of the console app and then pass a pointer to the CSocket into the 2 objects. I then fire up the threads in the two objects.
When I try to perform a 'Receive' call on the CSocket in the thread, I get an assertion error. The line that crashes is 'ASSERT(pState->m_hSocketWindow != NULL)' found in 'CSocket::PumpMessages()'. I checked the pointer value of the CSocket and it matches the CSocket object that was created in the 'main'.
I know there are certain MFC objects that cannot be shared across thread boundaries - is the CSocket one of them?
Thanks!
|
|
|
|
|
take a look at this ^
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Thanks a lot! That's exactly what I needed to know!
|
|
|
|
|
I have created several layers of dialog boxes using MFC C++ .Net. However, I do not want to automatically go back to calling dialog when I hit return anywhere in the active dialog. I want to just be able to click on OK button to do this.
I have set the OK button as not the Default button, but clicking anywhere in Dialog box still always closes the active Dialog Box and goes back to calling Dialog box. Is there a fix?
|
|
|
|
|
Override the OnOK function in your dialog and do not call CDialog::OnOK in your override. The CDialog::OnOK function is automatically called when you hit the enter key unless your dialogs override it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I thought so too but he indicated that it happens with a click (of the mouse), rather than the pressing of a key.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This is a subdialog.. Called by another dialog box. This happens on hitting the return/enter key,not by the click of a mouse.
|
|
|
|
|
Adding a visible blank button as default button and then prescribing an OnOK button works.
Thanks all.
|
|
|
|
|
For future reference...
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|