|
Maybe because you dn't appear to specifically wait for the speech to start or finish, if you go asynchronous you are calling pVoice->Release(); too soon and it never has a chance to get started.
|
|
|
|
|
That's it, thanks.
OTH, I'm trying to 'launch and forget' the TTS, but I have to call Release()before returning from the func, otherwise the speech object will never get destroyed.
All this occurs inside a shell interface, called by Explorer.
Can the speech object be global? (created at _Module.Init() and destroyed at _Module.Term()? I did try it but it caused a GPF.
Ideas anyone?
Thanks.
alex
'Architecture is music frozen in space.'
|
|
|
|
|
How about you launch a separate EXE and pass it information on what speech to say? Then when the EXE is done, it can exit, or else stay resident and you communicate with it next time.
That would allow your shell interface to 'exit' fairly quickly, and the speech will still be playing in the background.
|
|
|
|
|
Well, it is meant as a shell add-in, so i wouldn't want to complicate things.
Otherwise, i'm not fluent enough in ATL COM but it looks to me like launching a new thread might do the trick ?
The COM module could launch it, and the next time around (when it's called again by Explorer), it could check if the thread is still alive and either kill (Release) it before launching a new one (with a different message) or just wait for it to finish speaking and then..
How do we identify the 'speak' thread from one call to another?
Does it make any sense?
alex
'Architecture is music frozen in space.'
|
|
|
|
|
The problem with this is that you might have created the instance of the speech object on one thread and tried to delete it on another. COM is not happy about that.
What you might need to do is try to create a new thread when your COM object's DLL is loaded and retain that thread for the lifetime of the DLL load.
Then you can send information to that thread from the various COM objects instantiated to speak. Maybe that is worth a try. However, based on what your criteria were - asynchronous speech - I am already thinking a separate EXE is the better way to go.
|
|
|
|
|
Thank you, I will try that.
alex
'Architecture is music frozen in space.'
|
|
|
|
|
Hi.
I have not been writing socket programs long but I encountered the following:
1. How do I know if a network is available on the computer? If there is no cable in the port etc? This leads to the second problem.
2. I am using CAsyncSocket, when there is no cable connected to my computer and I try to connect, it will just sit there and never come back saying that it can not connect. IN non blocking mode, the Connect function come back with WSAEWOULDBLOCK so I know that it is trying to connect. Is there a notification that comes back when it can not connect after so much time?
3. What would happen if I was connected and then I pull out the cable, is there a notification mechanism that the connect is lost and closed? Or is there anything I can check?
4. For a server socket, what exactly does the backlog do? I thought that I can set a certain number of maximum sockets I can accept and spin off at one time? Is this correct? If I set it to 1, then once I accept this one, then the listen will stop listening until I call listen again with a new setting for backlog, right? I want to limit the number of sockets open and running for each port I listen to.
I know it is quite a mouth full up there, thanks in advance for any help.
|
|
|
|
|
Hi,
so I'll try to write something
1. Depends, I think you can try to query using WMI if the cable is plugged in (if the ethernet card is connected). Or you can try to ping to the nearest computer - usually default gateway. I think there are few articles here around that covers that. You can check the InternetCheckConnection function.
2. It should return with error value WSAETIMEDOUT . Problem is, that the timeout is quite long, so you have to wait quite long time. I think is in a range of minutes. But it can vary. You can check on telnet. Simply connect to some nonexistent site and you'll see the timeout size.
3. No. It's based on a nature of the TCP protocol (I assume you use). It's in fact connection protocol based on IP - this is packets. This means, that you can reliable only detect transfer timeouts. It's mainly not a problem that someone disconnects cable on your computer. Mostly this can happen one hop later - someone disconnects cable between switch and internet gateway, or between two switches. This is not reported to your computer. Only if you send data time to time in your connection, then you can detect the send timeout. Or you can set some timeouts on read. There's also possibility to set-up socket to do it for you by setting the alive monitoring heart-beat. But this must be supported by both sides socket provider - on client and server.
4. backlog - hm, I would say, that it's simply a size of waiting queue - after the queue is built, on one side new incomming connections are put into the queue, on other sude you get the incomming connection requests from the queue by using Accept function. If the size of the queue reaches the backlog limit, the susequent incomming connections are refused. And I'm really not sure, if you can change this limit once is set.
So enough for today, sorry for my english, it's not my native language and I don't have much opportunity to improve it at the moment.
If something is unclear, don't worry to ask for more
Hope this helps.
|
|
|
|
|
Here's what I'm trying to accomplish (and I admit right up front that I am a hobby coder and some of this stuff is over my head, but I learn best by trying something new)...
What I would like to be able to do is have an editable HTML document, except have areas that are "off limits." For example, having the top portion of the page, with logos and header stuff NOT editable, but everything below that editable.
I have read Rob Manderson's article on Using IHTMLEditDesigner[^]. I think I have a fair understanding of how it works. I posted essentially this message on the article's page, but no one has responded, so I figured I'd try here.
So what I was thinking is to set up separate sections (several sections) and set perhaps the background color of the off-limits areas to a light gray (so that the user can see what is off-limits). Then if the user clicks in or moves the cursor to an area of the document that is in the off-limits area, the editor would simply jump the cursor back out of the off-limits area -- perhaps to the first position below the off-limits area (or perhaps simply cancel the mouse-click or cursor move). I would also need to disable the ability to click and drag to highlight an area within the off-limits section.
So, the first question is: is it doable?
The second question is: how do I do it? And I don't expect you guys the write this for me, but point me in the direction of being able to track where the cursor is in the document and programmatically move it elsewhere, how to detect the background color of the element at the cursor location (or selected text in case the user clicks in an editable section and then drags into an off-limits section), etc.
I think I have a basic understanding of Rob's article, but I'm stuck as to where to go from here. I have tried just a simple modification of his demo program where I try to cancel the click in a DIV (or keydown or keypress or mousedown) instead of the ondrag, but so far to no avail. I guess my very first question is how do I cancel the user's ability to click or keypress within a DIV?
Thanks for any ideas/suggestions.
|
|
|
|
|
Well, either no one could answer this, or no one noticed the question, or no one wanted to answer it. Regardless, I did some checking and finally found one solution (although not necessarily the best nor necessarily the solution I want to use -- I'll know once I play with it more).
Anyway, one way to restrict where the user can edit, is to simply put the areas of the HTML document you want to protect into a DIV and within that tag include "contentEditable=false". E.g. "<DIV contentEditable=false>"
When you do that, what you will find is that keyboard input is cancelled within that section, even though you can highlight things. I kept the drag-cancel implemented in this article to prevent the user from dragging this DIV around. It all seems to work, except that I did notice that when you click within the protected DIV, the editor puts handles around the DIV area that allow you to resize that DIV area. I have not experimented yet to see what effect this has on the HTML document once you save it.
Anyway, just in case someone else was looking for an answer to this question, this is at least one partial answer.
|
|
|
|
|
Hi,
I'm having trouble with edit boxes in Visual C++. The trouble is that I want to know when a user hits enter in an edit box after that user has changed the contents of the box. What I don't want is for my function to be called on every character the user enters. I also don't want the function to be called when some other part of my program changes the contents of the edit box. You can probably tell I'm having trouble with the functions OnUpdate and OnChange. I could tolerate getting called everytime if there were some way for me to determine what caused the call (meaning a character change, an enter key hit or a data refresh from some other part of the program).
Thanks for any help anyone can give!
Rich
|
|
|
|
|
The simpilst approach may be to just subclass the control and look at the WM_CHAR messages on there way thru.
See "ID: Q174667" in the MSDN library.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi.
I had a similar situation. What I do is this:
In OnChar, I set a var to detect if something is being entered. If so, then in the DefWinProc if the message is WM_SETTEXT, then I do NOT accept it so that the Text you are entering on screen is NOT being overriden but is SAVED to variable. In the Pretranslate Message, if the message is WM_KEYDOWN with VK_RETURN, it will then accept this new entry you just entered on screen. If there is no enter and the focus is lost then it will set the text to that Last SAVED text (from other parts of the program OR last entered data.
I hope this will help a little.
|
|
|
|
|
This question is probably stupid and cannot be done, but you never know..
I use microsoft visual c++ studio, and the white background is hurting my eyes for all the time I look at it. The question is if there's a way to make the background black and the code white or something.. Is there?
|
|
|
|
|
On VC++ 6.0: Tools->Options->Format[tab].
White backgounds have always hurt my eyes, to I use a gray background. Using a black background is almost as bad.
I also set my the display properties for the system to use gray window backgounds, that way most programs, like notepad, popup with a gray background.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I suggest trying bright orange background with yellow text.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
My eyes, my eyes, ahhhh!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Yes you can use
Tools->options->Format->SourceWindow then apply the foreground and background colors
as you want
cheers
|
|
|
|
|
These helped a lot..! Thanks guys!
|
|
|
|
|
hi all,
i want to ask if any one has an experience with localizing under vs6, i am working on an application with arabic interface, and i know that is the only way to change the resources files to arabic is by editing the .rc file and change the language from:
LANGAUGE LANG_ENGLISH, SUBLANG_ENGLISH_US
to
LANGUAGE LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA
when i done this every thing goes fine, and i can compile the project with out any problem, but when i close the workspace and want to open it again it does not opened.
i tried to delete the workspace file and open the project one, but it does not opened to, and "out of memory" message box appears.
Please help me.
Razi.
|
|
|
|
|
You can change languages through the IDE. Right-click->Properties on any resource in the tree and the properties window will have a combobox where you can pick the language.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Problem Solved. I was looking for the wrong EOF sign.
I have a while loop
bool fContinue = true;<br />
do<br />
{<br />
lLastError = serial.WaitEvent();<br />
Inside this loop, I receive data and process it.
<br />
if (eEvent & CSerial::EEventRecv)<br />
{<br />
DWORD dwBytesRead = 0;<br />
char szBuffer[101];<br />
do<br />
{<br />
lLastError = serial.Read(szBuffer,sizeof(szBuffer)-1,&dwBytesRead);<br />
if (lLastError != ERROR_SUCCESS)<br />
return ::ShowError(serial.GetLastError(), _T("Unable to read from COM-port."));<br />
<br />
if (dwBytesRead > 0)<br />
{<br />
szBuffer[dwBytesRead] = '\0';<br />
<br />
printf("%s", szBuffer);<br />
write2file(szBuffer);<br />
<br />
if (strchr(szBuffer,EOF_Char))<br />
fContinue = false;<br />
}<br />
}<br />
while (dwBytesRead == sizeof(szBuffer)-1);<br />
}<br />
}<br />
while (fContinue);<br />
now what happens, that it somehow never sets fContinue to false.
but the first function I call, serial.WaitEvent(); , doesn't get something either, and I can see that in fact all the expected data has arrived. Is it that code running on the other side of the comport does not send the proper EOF? or what could it be?
thanks for any suggestions
|
|
|
|
|
Hi all, I have a DLL written in MFC (and tested extensively with MFC client apps) that I am not trying to link to from a non-MFC app. The code crashes inside the CInternetSession constructor on a call to call to AfxGetAppName. Is this a sign that I can't use the DLL in a non-MFC app, or is there something more subtle to it? Is there any workaround?
Thanks
|
|
|
|
|
Actually 2 points I should mention -- this DLL works fine with the non-MFC app except for the portion of it that uses WinInet functionality. And also, I am linking indirectly to the DLL through an ActiveX object which is written with ATL. The application which is loading the ActiveX object, is written in Visual Basic.
|
|
|
|
|
|