Message Box strangeness

I have included the chunk of code with a few names 
changed, but the functionality is there.  I think it will 
be easier for me to explain my problem after you take a 
quick glance at the code:

onConnectButton()
{
int go=-1;
	if(c_task_check.GetCheck())
	{
		go=MessageBox("Doing this will erase old 
data","Warning",MB_OKCANCEL); 
	}
	int start=start_server();
	if(start==WAITING_FOR_CLIENT)
	{
		SetDlgItemText(ServerEdit,"Connected to 
Client");
		c_button1.EnableWindow(true);
		c_button2.EnableWindow(true);
		c_button3.EnableWindow(false);
		c_button4.EnableWindow(false);
		if(go==1)
		{
			do_task();
		}
	}
	else
	{
		SetDlgItemText(ServerEdit,"\r\nUnable to 
Connect to Client");
		return;
	}
}

Ok so a bit of explanation.  I have a client plug in that 
I have built that listens over sockets to this MFC app.  
There is a connect button on the dialog.  When I hit 
connect, the dialog waits until it hears from the client 
plug in.  Once it hears from the plugin it enables the 
disconnect button and a few other things.  

I can connect, and disconnect multiple times without 
problems.  The mystery came when I added the check and 
the MB_OKCANCEL prompt.  

If the user checks a certain check box before hitting 
connect then it will connect, and then exchange 
information with the plug in.  

It works the first time.  That is I can connect and 
exchange info.  Then I disconnect and try again.  If I 
hit cancel on the prompt when I try again, the connection 
succeeds, but obviously the go stays -1 and the data 
doesn't get exchanged.

If after a successful comunication session has ended, I 
either run again without the check marked, or hit cancel 
on the prompt I can reconnect.  However on the second 
time around when I hit ok on the prompt the connection 
fails.  

Ok so that is kind of a hard one to explain.  Hopefully 
that was clear enough to someone who would be willing to 
see if they see a problem that I don't know about.  
Thanks for reading the long post, and thanks again if you 
reply with anything helpful.

Danny
0
10/16/2003 10:08:49 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1025 Views

Similar Articles

[PageSpeed] 36

Ok I will have to stop posting before I make a complete 
fool of myself.  I found the problem, and sure enough it 
was a mistake in what the do_task equivalent was doing 
with my sockets and entirely my fault.
>-----Original Message-----
>I have included the chunk of code with a few names 
>changed, but the functionality is there.  I think it 
will 
>be easier for me to explain my problem after you take a 
>quick glance at the code:
>
>onConnectButton()
>{
>int go=-1;
>	if(c_task_check.GetCheck())
>	{
>		go=MessageBox("Doing this will erase old 
>data","Warning",MB_OKCANCEL); 
>	}
>	int start=start_server();
>	if(start==WAITING_FOR_CLIENT)
>	{
>		SetDlgItemText(ServerEdit,"Connected to 
>Client");
>		c_button1.EnableWindow(true);
>		c_button2.EnableWindow(true);
>		c_button3.EnableWindow(false);
>		c_button4.EnableWindow(false);
>		if(go==1)
>		{
>			do_task();
>		}
>	}
>	else
>	{
>		SetDlgItemText(ServerEdit,"\r\nUnable to 
>Connect to Client");
>		return;
>	}
>}
>
>Ok so a bit of explanation.  I have a client plug in 
that 
>I have built that listens over sockets to this MFC app.  
>There is a connect button on the dialog.  When I hit 
>connect, the dialog waits until it hears from the client 
>plug in.  Once it hears from the plugin it enables the 
>disconnect button and a few other things.  
>
>I can connect, and disconnect multiple times without 
>problems.  The mystery came when I added the check and 
>the MB_OKCANCEL prompt.  
>
>If the user checks a certain check box before hitting 
>connect then it will connect, and then exchange 
>information with the plug in.  
>
>It works the first time.  That is I can connect and 
>exchange info.  Then I disconnect and try again.  If I 
>hit cancel on the prompt when I try again, the 
connection 
>succeeds, but obviously the go stays -1 and the data 
>doesn't get exchanged.
>
>If after a successful comunication session has ended, I 
>either run again without the check marked, or hit cancel 
>on the prompt I can reconnect.  However on the second 
>time around when I hit ok on the prompt the connection 
>fails.  
>
>Ok so that is kind of a hard one to explain.  Hopefully 
>that was clear enough to someone who would be willing to 
>see if they see a problem that I don't know about.  
>Thanks for reading the long post, and thanks again if 
you 
>reply with anything helpful.
>
>Danny
>.
>
0
anonymous (74722)
10/16/2003 11:39:41 PM
Reply:

Similar Artilces:

Message Size Limits #2
Can anyone tell me how to configure my Exchange 2003 server so that there is a default incoming/outgoing size limit of 5 MB, but I can override this on a user by user basis? I have set the global settings with a 5 MB limit which will apply to all users and then I brought up my account in ADUC and entered in 10 MB for the sending/receiving limit. Should this override the global limit? However, when I go to send a 7 MB email attachment nothing happens - it goes directly into my Badmail folder skipping the outbound SMTP queue. I don't ever even get an NDR back. Any ideas? Hi Mark, Hop...

IE8 Instant search box
Hi All I finally succumbed to the temptation to download IE8. I have spent the last 3/4 of an hour trying to regain control of my browser :-) I have switched off all accelerators and all that other stuff - even figured out how to stop the browser popping up the accelerator icon EVEN though I'd switched them off . . . I am happy to use the instant search box. (It's in a convenient place...). I DO NOT WANT any kind of suggestion from IE8 about what I'm looking for. I KNOW what I'm looking for - and the computer hasn't got a clue . . . So managed to sw...

Message delivery failed while delivering to the remote domain hotm
People can send mails from ms crm to other people within the domain, but when they send a mail to a hotmail domain for instance, that mail never reaches the recepient. On the Crm Server, the event log shows this message: Message delivery to the host '65.54.244.40' failed while delivering to the remote domain 'hotmail.com' for the following reason: The remote server did not respond to a connection attempt. What could be the reason. Exchange specialists say it has nothing to do with exchange, but all with Ms Crm. The mails never reach the exchange server, in none of t...

Where is the Delete Messages options?
I've looked and looked without success. I'm pretty sure I saw it before. Its where it asks you if you want to save a copy of messages on the server and then should give an option for it to be deleted from the server when you delete it from your Deleted folder in Outlook. That seems like a good way of syncing things. Gary Gary wrote: > I've looked and looked without success. I'm pretty sure I saw it before. > Its where it asks you if you want to save a copy of messages on the server > and then should give an option for it to be deleted from the...

Need an unbound text box and command button (Search)
I need to create an unbound text box with a command button (Search) on my form which will enable the user to find the current record for a space no. I would like the user to only have to type in the space no. My fields are: SpaceNo Current "Yes" I am not experienced at writing code. Thanks so much. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200911/1 On Wed, 25 Nov 2009 23:09:36 GMT, "Uschi via AccessMonster.com" <u25116@uwe> wrote: If you don't write code, it may be easier to instruc...

Want Input boxes to accept unicode strings on Standard Windows XP
I have a MFC application that is currently built with MBCS mode. If I run the program on a Chinese OS (Windows XP), the input boxes (Edit Controls) can accept Chinese chars and display correctly. If I run it on a standard English XP, the input boxes won't accept Chinese chars (display as "????") -- please note that I have already installed CKJ on the system and IE and Outlook can display Chinese correctly. Is this just because of different MFC libraries used for the application? Can I force the application running on Standard XP to use the unicode libraries so ...

CCheckListBox passing messages?
Hey! I have this CDialog in which I have a CCheckListBox. I wish to add buttons to the listbox so I create CButtons using the listbox as a parent. Everyting is just fine until I wish to capture the BN_CLICKED event from the buttons. It seems that the message doesn't get passed on from the listbox. How do I solve this? Thanks /Marcus "Marcus Seyffarth" <marcus@ettsexett.com> wrote in message news:eBAE7vNwEHA.3416@TK2MSFTNGP09.phx.gbl... > Hey! > > I have this CDialog in which I have a CCheckListBox. I wish to add buttons > to the listbox so I create CBu...

Error message in windows mail 12-21-09
I just set up my account and the existing messages imported fine, but when I try to send mail I get the following error: Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Subject 'new e-mail', Account: 'mail.td-wm.com', Server: 'mail.td-wm.com', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error: 10053, Error Number: 0x800CCC0F Please help. Double check that all your account settings are correct. If they are, then e-mail scanning is a likely...

weird /strange???
I have a piece of code which is in a multithread program: .... bool b,b1; b1 = MyData.success; //MyData is protected using Mutex, b1=true here by using Visual Studio watch window b = (b1 == true);//return false ?????? b = (true && b1);//return true .... "kathy" <yqin_99@yahoo.com> schrieb im Newsbeitrag = news:1142359707.474751.38170@i40g2000cwc.googlegroups.com... >I have a piece of code which is in a multithread program: >=20 > ... > bool b,b1; > b1 =3D MyData.success; > //MyData is protected using Mutex, b1=3Dtrue here by using Visual = Studio &g...

View the source of a message (Outlook 2000)
Hi to all! Since some months I search for a possibility to view the entire source of a message in Outlook 2000 SP-3 (background: by some means or other there is sometimes a message slipping through my filters - and then I DO NOT want to see it in Outlook's state-of-the-art multimedia viewer). In case you have questions: Yes, I know that I can view the header of the message by right-clicking on it in the overview and selecting "Options". Yes, I know that I can view the source of just the body by right-clicking on it in the message view and selecting "View source". B...

Entourage strange junk problem
Hi, My co-worker got some very strange problem with her Entourage IMAP account. 1. When she reply a certain mailadress (that is in her adressbook) it don�t move to "sent items" but to junk box. When she then mark it "this is not junk mail" it then moves to the inbox. 1. She have now turned off the junkmail protection totally in Entourage. But when i assign a mail to a category it turns into junkmail, but only for certain catergorys. Further on all mail from the one adress that making the trouble described above always change to "junk mail" when she a...

Selecting Text Box
Is there a keyboard command that one can use with the mouse to select the text box (frame) rather than trigger the Edit Text mode? When there are many objects on the page, getting the mouse to click on the right frame can be a real problem. But if the cursor is in the right box, some keyboard command (with or without the mouse) should help select the right object. Thanks! ...

Can I display the current date in a text box?
I know how to display the current date in a cell, but can I display it in a text box? And how would I do that? You would have to have some code to load it, such as Textbox1.Text = Format(Date,"dd mmm yyyy") or link the texbox to a cell with the formula =TODAY() -- HTH RP (remove nothere from the email address if mailing direct) "stephiebrady" <stephiebrady@discussions.microsoft.com> wrote in message news:C78C4C78-C12C-4A8F-9121-E377ACAE3B5B@microsoft.com... > I know how to display the current date in a cell, but can I display it in a > text box? And ...

Strange "button"
I got an .xls from someone and had to populate some cells with data extracted from the application database, which I did OK. My problem is the fact that the .xls came with something like a button (not created by me) that I want to delete, but simply can't. I can't select it, like I can do with the forms controls I'm used to work with, although it appears to be a normal command-button. What could that object be? And how could I simply get rid of that? Ok, I finally found the answer. "BEDE" wrote: > I got an .xls from someone and had to populate some cells with d...

error in receiving messages.
I started getting an error message last night when I tryed to set my emails, and am still getting the same message this morning. The message is as follows The connection to the server has failed. Account: 'mail.charter.net', Server: 'mail.charter.net', Protocol: POP3, Port: 110, Secure(SSL): No, Socket Error: 10061, Error Number: 0x800CCC0E What so I need to do. Thanks, Bill "bransn1" <bransn1@discussions.microsoft.com> wrote in message news:774E5DA8-C0DB-4354-8C35-A8482F1876EA@microsoft.com... >I started getting an error message last n...

outbox message will not send or delete
In outbox I have a file with a video clip in windows media. It will not send and I can not delete. Dialog box says outlook has already begun sending. thanks for any help ...

check boxes
I downloaded and worked on a template on someone elses computer using check boxes. I sent that template to my laptop to complete working on the template and the check boxes now show up like this: {form check box} How do I get this to go back to a check box? Hi JOLOJO58, Simple: Press Alt-F9 to toggle the field code view. -- Cheers macropod [Microsoft MVP - Word] "JOLOJO58" <JOLOJO58@discussions.microsoft.com> wrote in message news:9C83A55C-B768-43BE-A171-762EEA78DEAC@microsoft.com... >I downloaded and worked on a template on someone elses computer...

Importing backup messages .mbx to any new Outlook version
Hi, I have a complete folder from winnt\profiles... \outlook with messages that I need to import to outlook. I have always had problems importing files. These extensions are .mbx . they completely differ from the inbox.dbx or sent items.dbx I used before. I cant quite remember if it was MS outlook or Outlook Express, but I need to import these files, give input, anything, all. Now im using Outlook Express 6, and can get MS outlook installed. Please respond ASAP, these files are from 99. ...

Error Message #7
I Get a Error message saying "Not enough system resources to display porperly" when i try to open my excel 2002 Program. What can i do to work in my excel??? But i can access to some level but this error message keeps on coming on the screen.. If you have other programs open at the same time, try starting Excel with them closed.........could be you need more RAM Vaya con Dios, Chuck, CABGx3 "Naresh h" <Naresh h@discussions.microsoft.com> wrote in message news:6E0EC63C-8992-483C-9CAD-2DF264A394E1@microsoft.com... > I Get a Error message saying "Not enou...

Combo box #18
Hi I'd like to have a drop-down list in one cell and based on the selection in this cell, there needs to be another list of drop downs in an adjacent cell. How do i do this? Eg - first cell would have drop down - A, B , C If A is selected, the drop-down needed in anotehr cell is AA, AB, AC, AD. And if B is selected, the second cell should drop down BA, BB, BC, BD. Pls help. thanks > I'd like to have a drop-down list in one cell and based on > the selection in this cell, there needs to be another list > of drop downs in an adjacent cell. How do i do this? See here h...

Access 2007-Table not displaying the values from a combo box
I have built a database to schedule senior/disabled transportation appointments. I have created two tables and associated forms for data entry. I placed a combo box in the Schedule form so end users choose a client and fields complete on the form with client name, address, city, and home phone number. I did instruct Access to store the data in the SeniorIntakeID field in the Schedule table. I wrote a report that staff execute to see what is scheduled for a given date, for each driver. On the report I want to see the actual client's name, address, city, and home phone n...

Unable to export outlook express 6 messages
Trying to export outlook express 6 message to another system. When exporting the messages I get the following error "The export could not be performed An error occurred while initializing MAPI". Choose Profile option does not appear, only error. I tried to copy these messages to a temp file and then import them on the new system, but not all the messages/folders show up in the import selection menu after selecting "Import Mail for an OE6 Store Directory" Any Ideas? Ask in an Outlook Express forum. This is an Microsoft Office Outlook forum. Outlook Express is fami...

Formating, paragraph marks, boxes etc, how do I get rid of them?
One day I opened up excel and it had all these marks for formating in my form. This also happened in word. How do I get rid of them? Josh: In Word, paragraph marks can be turned on/off by clicking the paragraph icon (looks like a capital P but with two, vertical strokes instead of one). I just finished wandering through Excel 2000 looking for the same icon and the only mention of the paragraph mark is related to object linking and embedding. I've also done a lot of forms in Excel and don't remember ever running into paragraph marks. Are you using OLE in the spreadsheet...

Find Related Messages in Outlook 2007
When using the "Find related messages" feature in Outlook 2003, it used to look in the Inbox, Drafts and Sent Items folder. Outlook 2007 defaults to the entire mailbox, including the Deleted Items folder. Is there a way to adjust the default settings for the "Find related messages" function? I'd like to avoid seeing messages that I have already deleted. Thanks, Mark AFAIK, no. You can sort and group by folder to make it less of a problem. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions...

Mailbox size limits
The other day one of my users was unable to send messages. They started queuing up in his Outbox and failing with the error that the Exchange Store was too big. He has the biggest mailbox on our system, but after looking into this a bit - I can't find any reason why he was getting this error. Environment: Exchange 2003 SP2 on a Windows 2000 SP4 server One Mailbox Store set to a 25 GB limit (currently using 18 GB) Outlook 2003 client The user in question has a 1.75 GB mailbox (16,700 items) His account was set to use the Mailbox store limits - which is default I believe - and the Store...