|
You need to expose it as COM and then as how you invoke the COM component from C++, you have to call that component. Framework creates CCW wrapper for you which makes COM call from C++ to C# easier.
Thanks,
Anand.
|
|
|
|
|
If you mean "using the .NET Framework classes in a C++ application", the answer is C++/CLI
|
|
|
|
|
Using Visual C++ 6, service pack 6 on XP. I have a set of COlePropertyPages controlled by an OCX embedded in a dialog box. On one property page I have 10 edit controls. I want the user to be able to jump from control to control using the Tab button. However, when the focus is in a control and the user hits the tab button, the focus jumps to the OK button in the dialog box. From that point on, repeatedly pressing the Tab button merely jumps between the Help, OK, and Cancel buttons on the dialog box.
Trapping the WM_KEYDOWN message in the property page doesn't help, the code isn't reached. I tried subclassing one of the edit controls. Even when that edit control has the focus, and the Tab button is pressed, the WM_KEYDOWN message isn't reached. I tried using PreTranslateMessage() in the subclass, the code isn't reached (I tested all these using a break point.)
How can I make it so that the Tab button jumps from edit control to edit control?
Thanks!
|
|
|
|
|
There should be two ways of fixing this.
One way is to go to Layout -- Tab Order. This will show all of the controls in the dialog in numerical order. To change them you just click the order in which they are to be tabbed through. Then, if some of the controls are not being tabbed to and you want them enabled, go into the resource's properties and set the Tab Stop property to true.
Secondly, you can directly modify the resource file (*.rc) by moving the resources within the dialog. The order in which they are scripted is their tab stop order. Setting WS_TABSTOP as one of the controls properties identifies it as a resource to be tabbed to.
|
|
|
|
|
Thanks for your efforts, Josh, but you don't seem to understand the question. As I mentioned, this case involves property pages embedded in the dialog box using an OCX. (Maybe the correct term is ActiveX control?) So there is an rc file for the property pages in the OCX and a separate rc file for the dialog box in my main program. The tab order for the property page in the OCX rc file is already set up to go from edit control to edit control. This tab order is ignored. No matter which one of the ten edit controls has the focus, pressing the tab button causes the focus to jump to the OK button in the dialog box. Clearly the tab order for the dialog box in the rc file of the main program is the one used by the system. In the rc file for the dialog box, there are the three buttons, OK, Help, Cancel and a Tab Control in which the OCX property pages are embedded. I can set the Tab Stop property of the Tab control to TRUE, then the tab button causes the focus to jump between the three button and the title tab of the property page open. But I don't know how to make the tab button jump between the edit controls as desired.
|
|
|
|
|
The tabbing magic handled by the IsDialogMessage[^] function; it sounds like this is being called correctly because the tab key does alter the focus. Read this[^] blog entry and the comments for some insight. To me it sounds like your problem may be related to the DS_CONTROL and WS_EX_CONTROLPARENT styles, see here[^] to learn more about these.
EDIT:
You may also want to read about the PSM_ISDIALOGMESSAGE[^] message since we're talking about property pages.
Steve
modified on Wednesday, September 29, 2010 2:51 PM
|
|
|
|
|
Thanks for your reply. Your references are to the point; although maybe not since none of them seem to apply to property pages embedded with an OCX. In the dialog box, I set the Tab Control to WS_EX_CONTROLPARENT with WS_TABSTOP, but it made no difference.
The property pages are embedded in the Tab Control using CoCreateInstance to get a ISpecifyPropertyPages pointer, which is used to get a CAUUID, which is used to get an array of IPropertyPage pointers from more calls to CoCreateInstance, one for each property page.
Probably what I need to do is trap the Tab message in the dialog box, then somehow see if the property page with the edit controls is open, see if the focus is in an edit control, and if it is, send the Tab message to the property page. I don't know how to do that yet, but your answer stimulated some thinking. It seems like a lot of work for an apparently simple task..
|
|
|
|
|
Try reading this[^]. You're doing something simple wrong, it shouldn't be hard to get what you're trying to do to work.
Steve
|
|
|
|
|
Hi All!
I am trying to playback a '.wav' file, which I have no problem with doing using the MCI. What I need to do is know when playback has finished. I have now spent a day looking in to this and not found anything anywhere - please help!!!
Is using MCI the best way of doing this - I only wish to play, stop and pause sound files (mp3, wav and spx), nothing too clever, but detecting the end of the soundfile has proven to be a problem.
I am using VC6 & Windows XP
Any help and advice would be greatly appreciated!
Regards
Mike
|
|
|
|
|
Right I have had some success, but still need a bit of advice!
I have overridden WindowProc, and when the wav file starts and stops, I recieve message 1224. I can then check the wParam and lParam to see the value. lParam is 525 when the wav file finishes playing.
Does anyone know what is the definition of message 1224, and what are returned in wparam \ lparam?
Thanks for any advice on this
Regards
Mike
|
|
|
|
|
|
Thanks for helping Cool_Dev
I did think about doing this in a similar manner - setting a 1 second timer running and checking to see the position of playback to see if the end of file had been reached. It did strike me as being a bit in-elligent. I was hoping for there to be a 'MCI_NOTIFY_PLAYBACK_FINISHED' type of message that I would need to capture. I don't know if you have seen my reply to my own post - I have had some success in getting a message, but I just have the value - it would be nice to know its definition.
Thanks for lookingg and your advice
Mike
|
|
|
|
|
I have a CComboBox control :
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
and here I fill it :
pCombo->AddString("One");
pCombo->AddString("Two");
pCombo->AddString("Three");
pCombo->AddString("Four");
pCombo->AddString("Five");
and here , in drop down state I want to delete an item ( or two ) :
pCombo->ShowDropDown(TRUE);
pCombo->DeleteString(2);
pCombo->DeleteString(3);
my question is : how can I redimension the drop down window to fit remain items ?
I solve this in dirty way :
pCombo->ShowDropDown(FALSE);
pCombo->ShowDropDown(TRUE);
but is not elegant and in some systems flikering ... can you help me ?
|
|
|
|
|
Try it reverse :
pCombo->DeleteString(2);
pCombo->DeleteString(3);
pCombo->ShowDropDown(TRUE);
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
Yes , it is an solution , but in my case is imposible : in OnEditupdateCombo1 handler , depends of some conditions , while combo box is allready in drop down state , I insert / remove items ...
|
|
|
|
|
Please see the function ::GetComboBoxInfo(..) ,
you can access the list in this way
and then move it at the new calculated position
(bottom -= GetItemHeight(..)*delCount)
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
I use VC6 , so I have not access to GetComboBoxInfo method ... but I try to retrieve rect drop down window information with GetDroppedControlRect(...) method ... I write you if I succeed it ! Thank you !
|
|
|
|
|
// I use VC6...
It should be possible :
void CYourDialog::Test()
{
CComboBox* pcBox = (CComboBox*) GetDlgItem(IDC_COMBO1);
if (pcBox->GetSafeHwnd()) {
pcBox->ShowDropDown(TRUE);
COMBOBOXINFO sCBINFO = {0};
sCBINFO.cbSize = sizeof(COMBOBOXINFO);
if (::GetComboBoxInfo(pcBox->GetSafeHwnd(), &sCBINFO)) {
if (sCBINFO.hwndList) {
CWnd* pcList = CWnd::GetFromHandle(sCBINFO.hwndList);
CRect cListRect;
pcList->GetWindowRect(cListRect);
cListRect.bottom -= 20;
pcList->MoveWindow(cListRect);
}
}
}
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
I will try this , but tomorrow morning , and I will write you . Thank you !
|
|
|
|
|
I have tried it too,
you can call the function at any time :
void CYourDialog::AdjustComboBox(CComboBox* pcBox)
{
if (pcBox->GetSafeHwnd()) {
COMBOBOXINFO sCBINFO = {0};
sCBINFO.cbSize = sizeof(COMBOBOXINFO);
if (::GetComboBoxInfo(pcBox->GetSafeHwnd(), &sCBINFO)) {
if (sCBINFO.hwndList) {
CWnd* pcList = CWnd::FromHandle(sCBINFO.hwndList);
CRect cListRect;
pcList->GetWindowRect(cListRect);
cListRect.bottom = cListRect.top;
pcList->MoveWindow(cListRect);
}
}
}
}
They sought it with thimbles, they sought it with care;
They pursued it with forks and hope;
They threatened its life with a railway-share;
They charmed it with smiles and soap.
|
|
|
|
|
mesajflaviu wrote: I use VC6 , so I have not access to GetComboBoxInfo method...
What are you saying? GetComboBoxInfo() has existed since Windows 98, about the same time that VS6 came out.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
At my method list of CComboBox I have not this method : GetComboBoxInfo() ...
|
|
|
|
|
You're letting IntelliSense dictate what you (don't) have access to?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
As GetComboBoxInfo requires windows 98 or above, make sure corresponding platform sdk is with you. I think February-2003 version is the last one that can be neatly compiled by VC6 compiler.
Also just ensure that the #define WINVER in your program meets the windows version for GetComboBoxInfo in winuser.h.
|
|
|
|
|
I have not installed any SDK ... this meen I can't solve the problem without SDK ? My VS6 is naked ! 
|
|
|
|