Guy, if you don't know the port number of the service you're trying to connect to on the server, we're not going to be able to tell you. After all, you haven't said anything about this service so we don't know what it is you're trying to connect to!
I was having some troubles with the use of COM ports on an embedded device (Pocket PC with windows mobile 5). I already opened a discussion here[^].
I finally decided to use WaitCommEvent to monitor incoming data but this doesn't seem to work as expected. The port that I'm working with is a virtual COM port which is provided by a Bluetooth stack when a Bluetooth connection is established. Here is the code:
int CSerialDriver::ReadData(char* szData, int MaxLenght)
DWORD dwMask = 0;
if (dwMask & EV_RXCHAR)
DWORD dwRead = 0;
int Count = 0;
Count = MaxLenght - BytesRead;
BytesRead += dwRead;
} while ( dwRead && (BytesRead<MaxLenght) );
The comm mask is set when the port is opened:
The problem that I encounter is that the WaitCommEvent doesn't work as expected: when I receive data, WaitCommEvent exit as expected but sometimes, all the data has not been received yet (which is logical). That's not a problem because my function will get called until all data has been received. The problem comes when I enter the function a second time and call WaitCommEvent, at this time it doesn't exit even if bytes have been received in between. Having read this article[^], WaitCommEvent should exit if bytes have been received in between.
Would it be possible that it is a bug in the driver supplied by the company that produce the Bluetooth stack ? Or did I do something wrong ?
Another question: it is stated in MSDN: Only one WaitCommEvent can be used for each open COM port handle. This means that if you have three threads in your application and each thread needs to wait on a specific comm event, each thread needs to open the COM port and then use the assigned port handle for their respective WaitCommEvent calls. (see here[^])
So, that would mean that your application could open the COM port several time. I tried that on win32 but that doesn't work at all (each time I receive an invalid handle value and the GetLastError code is "Access is denied"). I tried with different access:
Use RegCreateKeyEx for creating the path in the registry, the second parameter is where you'll set the path that you said. You can create the values in your registry by using RegSetValueEx. RegCloseKey will close the registry item that you opened.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
If my bluntness offends you, ignore it. You'll find that my sentiments (toward newbie laziness) are supported by the professionals. If I said something that was indeed incorrect, I'll admit such, and have done so in the past.
...when he tried...
Note the operative word "tried." I certainly don't claim to know any answer, but I do give most of them a try. As a matter of fact, I spent nearly ten minutes reproducing the question of which you speak, and my suggestion was spot on. While Mark's suggestion was more in with what you were after, that just supports the old adage of there being more than one way to skin a cat.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
Is there a way in MAPI to convert HTML to mime for example
<BODY LINK="#7C5828" ALINK="#7C5828" VLINK="#7C5828">
<TABLE WIDTH=100% CELLPADDING=5 CELLSPACING=0 SUMMARY="">
<TR VALIGN="top" >
<TD ALIGN="center" BGCOLOR="#FAEBA4">
<IMG SRC="1.jpg" ALT="">
<TD><ID ID="greeting">Thank you for using Microsoft® Office Outlook® 2003! </ID>
<ID ID="Intro"> This version of Outlook includes new capabilities designed to help you access, prioritize, and act on communications and information so that you may use your time more efficiently and more easily manage the ever-increasing flow of incoming e-mail.</ID><br><br>
<ID ID="Idea">To give you some idea of what is possible with Outlook 2003, we have put together a list of our favorite new features.
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
font-family:"Times New Roman";}
p.product, li.product, div.product
p.feature, li.feature, div.feature
p.description, li.description, div.description
margin:1.0in 1.25in 1.0in 1.25in;}
<body lang=3DEN-US link=3D"#7C5828" vlink=3D"#7C5828" alink=3D"#7C5828">
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
<table class=3DMsoNormalTable border=3D0 cellspacing=3D0 cellpadding=3D0 =
<td valign=3Dtop bgcolor=3D"#FAEBA4" =
style=3D'background:#FAEBA4;padding:3.75pt 3.75pt 3.75pt 3.75pt'>
<p class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'><img =
height=3D32 id=3D"_x0000_i1025" =
<td valign=3Dtop style=3D'padding:3.75pt 3.75pt 3.75pt 3.75pt'>
<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><span =
size=3D2 color=3D"#7c5828" face=3DArial><span =
for using Microsoft® Office Outlook® 2003! =
class=3Ddescription1><ID ID=3D"Intro"><font size=3D2 =
style=3D'font-size:10.0pt'>This version of Outlook includes new =
designed <span style=3D'font-style:italic'>to help you access, =
and act on communications and information</span> so that you may =
time more efficiently and more easily manage the ever-increasing flow =
incoming e-mail.</ID></span></font></span><font size=3D2 =
<span class=3Ddescription1><ID ID=3D"Idea"><font face=3DArial>To give =
you some idea
of what is possible with Outlook 2003, we have put together a list of =
favorite new features. =
Apologies for the long codes I just want to show a concrete example
Well the “while” loop will run forever, unless you end the process via the “Windows Task Manager”, because neither string is ever going to change. Of course you do not need to worry about that, because “test” is never going to equal “test1”, so the “while” loop will never run.
I recommend that next time you try to explain what you are attempting to do. The odds are that someone who frequents CP has already tried it.
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
CString test="Testing this";
CString test1="Testing the other side";
int count = 0;
while (test != test1)//wait until some other thread make test equal to test1
if (count++ == 10)//or wait until the count is not equal to 100
Last Visit: 31-Dec-99 18:00 Last Update: 16-Jun-21 6:39