|
No. If you *know* that 1 is a YY view and 0 is an XX view, then you can use a blunt cast, but you're safer to use dynamic_cast to be sure. I *always* use it and *always* check the return, even though I presume in most situations it never will. If you have more than one type, why not have more than one array ? The alternative is to create a class that holds the pointer, and calls the methods you want, and internally knows what type it is, then collect those in an array ( a std::vector I hope ).
That's a solution to what you *want* to do, when I think what you *need* to do is chance the design.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Well, I will think about it. The only reason I want to do things this way is because I have a Mainfrm that holds all these views. It is an SDI app with multiple views and one frm and one doc. This way I can bring up the views just by calling the appropraite array with the right index. After that I can call its function I need.
Can you give me an example of a better way to handle this type of situation? Thanks.
|
|
|
|
|
It depends - how does your view change, I mean, under what circumstances. How is it that an array index is the logical way to look it up ?
Having had a chance to sleep on it, I think dynamic_cast might be the best way to handle this, because it means you can safely pull the views out and turn them into whatever type of derived view they are. There is no nice way of setting it up so that you don't need to do this.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I'm not quite sure what your problem is, but it sounds kindda like a problem I ran into some time ago. I had a number of views, some derived from CFormView, som directly from CView, that were shown in a multi-view SDI app. I wanted to put some general-purpose functions into all the view, but since all my views were not derived form the same base class I couldn't use the old fashion OOP solution. I used a trick described somewhere (I'll get back to that later) that used templates to "add" functionality to existing classes. Basically, instead of defining the common functions in a base class they were added to the top-level classes by the template. If this is what you want, read on. If not, sorry for wasting your time
I haven't got the information at hand right now, but I can find it if you want. I think it was a series of papers on CodeGuru on a totally different subject (that was back when CodeGuru still contained something interesting - but then all the Gods (Chris, Tom Archer etc) moved to CP, and so did I). It is not an easy solutions, you need to modify the messagemap macros and use an implementation base class to avoid code bloat, but it works nicely once it's set up. I even put the stuff in a DLL which only complicates it further...
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I am a VC beginner.These days i met a trouble:i can't successfully open a AVI clip(the Open function returns always '0').My steps as the following:import a avi file using resource editor->select a animate ctrl and paste it onto the dialog template,and set it to auto play->add a member variable(type control),corresponded to the ctrl in the dialog->open(UID) it in InitDialog().
is there something important i missed or wrong?
God blessing me...
|
|
|
|
|
|
I have read in a book that it isn't a good way to create a vector with CAsynchSocket varibles to make a server to handle for example only 3 clients. But isn't it a good way if I don't know multithreading and so and the server is just going to handle 3 clients?
PLEASE ANSWER!!
And if you think that is ok, how can a client send a message to a client?
It must pass the the server, mustn't it? Because a client can't connnect to a client!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
In my experience ( four client/server projects deploying winsock 2.0) is to avoid CSocket and CAsyncSocket at all costs!
A basic server implementing *raw* sockets can be coded in more or less 3 hours, that includes the Multithreading side as well. A good book to buy is Programming Winsock 2.0 by Lewis Napper.
Hope this helps.
Normski. - Professional Windows Programmer
|
|
|
|
|
I need the advice from somebody who already made software product using Microsoft Speech SDK. I want to implement simplest command recognition. After trying the SDK samples and writing small prototype I found that recognition quality seems to be not enough for my product. Now I consider to check out other products such as The Dragon NaturallySpeaking® SDK.
However, Microsoft programming interface is really the best and I can waste a lot of time learning other products and finally get almost same recognition quality.
My question is: are there speech recognition engines significally better than one supplied with Microsoft Speech SDK?
I need only English support for now, and my command dictionary is supposed to contain 20-30 commands.
Any information from developers who already used Microsoft Speech SDK or other product will be helpful to me.
Thank you in advance.
|
|
|
|
|
Alex Farber wrote:
[...] I found that recognition quality seems to be not enough for my product.
What kind of hardware are you using (microphone), and how much have you trained the engine? Those have a decent effect on the accuracy of the engine.
Peace!
-=- James.
|
|
|
|
|
1) Creative VIBRA sound card
2) Andrea DA-400 2.0 Desktop Array Microphone
3) I created my profile using Speech Settings Wizard and set it's sensitivity and accuracy to the values that seem to be optimal.
The program executes my commands, but if I am just talking (event not in English), it sometimes reacts. I consider to turn on microphone only when I make the command, and turn it off after this. I am wondering if any other speech recognition engine has such paranoidal reactions?
|
|
|
|
|
Hi All,
Is there any API or Interface to query browser "in which internet zone existing web-page is?" I wanted to do it programmatically. I can see an icon and text get displayed at right-hand-side of status-bar.
Thanks for your suggestions.
-- Sumit
|
|
|
|
|
There are a lot of information on that in MSDN, so I won't copy it here. Look for interface IInternetZoneManager in MSDN and you'll find all what you need
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
Sent you by e-mail, by in case some one else want to know that, so below the code that do the work:
USES_CONVERSION;
CString csZone = _T("Unknown");
IInternetSecurityManager *pManager = NULL;
HRESULT hr = CoCreateInstance(CLSID_InternetSecurityManager, NULL, CLSCTX_INPROC_SERVER,
IID_IInternetSecurityManager,(void**)&pManager);
if (hr == S_OK) {
DWORD dwZone;
pManager->MapUrlToZone(T2OLE(lpszURL), &dwZone, 0);
pManager->Release();
switch(dwZone) {
case URLZONE_LOCAL_MACHINE:
csZone = _T("Local");
break;
case URLZONE_INTRANET:
csZone = _T("Local Network");
break;
case URLZONE_TRUSTED:
csZone = _T("Trusted");
break;
case URLZONE_INTERNET:
csZone = _T("Internet");
break;
case URLZONE_UNTRUSTED:
csZone = _T("Untrusted");
break;
default:
csZone = _T("Unknown");
break;
}
}
csZone now contains the name of zone
The lpszURL contains the URL to check
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
Hi,
I'm chasing some code that will let me insert splitter panes dynamically. For example I want to start with 2 rows, and then add extra ones when required. Any ideas?
Thanks
|
|
|
|
|
Look for CSplitterWnd in MSDN. There are methods like SplitRow() and DeleteRow() that can do the work for you
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
This is really fundamental, but no matter how i tried, I can't create modeless dialogs. I used Create and ShowWindow as stated in books but my dialog remained modal.
if (resultsdlg != NULL)
resultsdlg->SetFocus();
else
{
resultsdlg = new CResultsDialog;
resultsdlg->Create(IDD_RESULTS);
resultsdlg->ShowWindow(SW_SHOW);
}
And in the .rc file, my dialog style is:
WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
I've tried with DS_MODALFRAME, WS_CHILD, and many other combinations, but none worked. Please help!
|
|
|
|
|
I tend to put the create and showwindow calls in the constuctor, it makes the code much nicer. I also always specify this as the parent, you never know when you'll want to know who the parent is.
Have you traced to see this code is being called ? Initialised resultsdlg to NULL ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Yes, I've initialised resultsdlg to NULL and tried Create(IDD_RESULTS, this) too.
I noticed that the dialog generated is not actually modal, in that I can still access the main application. In fact, it's more like the dialog became 'Always On Top'and when I minimised it, it doesn't go into the taskbar. Strange behaviour!
|
|
|
|
|
Btw, I initially remove the ID_OK and ID_CANCEL cos I dun need them. Could this lead to the problem?
|
|
|
|
|
Are you sure it is modal? The code looks ok. Maybe you think that it is modal cause you don't see it in the task bar?
Anyway, try to give the parent to your dialog, for example the Desktop as parent (CWnd::GetDesktopWindow() )
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
Interesting, using the desktop as the parent works. But that leads to another problem, how do I access my document data from the dialog? This dialog is a protected member of my MainFrame btw.
|
|
|
|
|
Depends on what your dialog is doing. You can pass a pointer to CDocument or CView, and access the document's methods and variables, or you can even pass a pointer of CMainFrame to it and enumerate the open documents...
Another way to use messages (SendMessage() and PostMessage() ) to pass data between your frame-view-dialog.
As I said depends on what you want it to do
Philip Patrick
"Two beer or not two beer?" <shakesbeer>
Web-site: www.saintopatrick.com
|
|
|
|
|
Thanks, you've been most helpful. I managed to do it using messages
|
|
|
|
|
Hi,
i have placed a list box in my dialog, and i want to add strings to that list box. when i try to send the message LB_ADDSTRING using the SendMessage function, its showing me an error that the handle to the control is invalid. How do u get the handle to a control in the dialogbox, if the control id is know, as well as the dialog id.
Can anyone help me. I'm doing the program in SDK.
Vini
|
|
|
|