|
I am not sure, but the USB driver may get the message and broadcast.
Application is getting the message MM_MIM_LONGDATA when acknowledgement comes from H/W.
The code for opening the MIDI port is:
MMRESULT mReturnCode=MMSYSERR_NOERROR; <br />
CWnd* pMainDialog = (CWnd*)AfxGetApp()->m_pMainWnd;<br />
HWND hWnd = pMainDialog->m_hWnd;<br />
mReturnCode = midiInOpen(&hdlMidiIn,uhInID,(DWORD)((LONG_PTR)hWnd),(DWORD)NULL,CALLBACK_WINDOW|MIDI_IO_STATUS);
My application is Dialog-based.
Best Regards,
Suman
|
|
|
|
|
You stated you're using a windowproc? How are you doing this with an MFC window?
Have you tried getting the message in your maindialog class using the message map?
ON_MESSAGE(MM_MIM_LONGDATA, OnMIMLongData)
...
LRESULT CMainDialog::OnMIMLongData(WPARAM wParam, LPARAM lParam)
{
MIDIHDR *pMIDIHdr = (MIDIHDR *)lParam;
...
return 0L;
}
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Mark Salsbery wrote: You stated you're using a windowproc? How are you doing this with an MFC window?
The declaration is in Dialog's header file as follows:
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
And the implementation is in Dialog's cpp file as follows:
LRESULT CYSPController1Dlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) <br />
{<br />
ubyt ubMidiData;<br />
switch( message ) {<br />
case MM_MIM_DATA: <br />
<br />
break;<br />
case MM_MIM_LONGDATA: <br />
ReceiveLongMsg( lParam ); <br />
break;<br />
}<br />
return CDialog::WindowProc(message, wParam, lParam); <br />
}<br />
Mark Salsbery wrote: Have you tried getting the message in your maindialog class using the message map?
Yes, I have also tried your suggestion but the result is same.
I confirmed the message is missing by running the USB monitoring software(Device Monitoring Studio by HHD), while printing the message from H/W in file by MFC application. the monitoring tool getting all the messages from H/W but the application is missing a single message. I am looking in the problem. Thanks for your great help.
Best Regards,
Suman
|
|
|
|
|
Functionality of WindowProc() and message map seems same, but is there any difference between them?
Best Regards,
Suman
|
|
|
|
|
Overriding the WindowProc method is fine but generally with MFC apps you'd use the message
map mechanism.
Either way, if your window isn't getting the message then the problem is elsewhere.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Hey guys, I have a form with two list boxes on it, both are inside a scroll box. I have multi select on, as I need the user to be able to click and drag the mouse to select multiple items without holding ctrl or shift. If I select any item in listbox #1, then select one in listbox #2, scroll down so neither are visible any longer. Now, if I click on anything that's not in the same listbox that was last clicked, (ie following the example above I click on an item in listbox #1 after scrolling down), the scroll box (which the listboxes are in) automatically scrolls all the way to the top, highlighting every item in that listbox from the one I clicked up to the item that is at the same mouse position as before scrolling. I believe it is a problem with losing focus, and I tried doing
On Mouse Down: ListBox->SetFocus(), but that didn't help (don't know if that's the right format). Any help would be appreciated, sorry if this is a really simple question. Thanks,
I found out the exact problem (I think)...now...just how to fix it :P The focus changes from one listbox to the next when it's clicked (both are within the scroll box). I need a way to have two separate focuses (foci?), one for each listbox. And when the scroll box moves all the way up, it's always a set amount : the number of times you clicked down (so...the number of vertical increments). So if I select something in one of the listboxes, then click one something in the other, then scroll down twice. After clicking on the first listbox, the scroll bar will move 2*increment of the scroll bar up and select all items within that range, in that listbox.
Alex
-- modified at 6:46 Tuesday 17th July, 2007
|
|
|
|
|
Hi to all,
How to create a (ActiveX) Control in VC++6 as collection of multiple MFC Controls?
I want to create a (ActiveX) Control that can have a 2 Static Control, 1 EditBox & multiple Buttons in it. And using that (ActiveX) Control, i want to create multiple instaces of it on Dialog.
|
|
|
|
|
The following MFC code calls my own OnInitDialog function which in turn sets focus to my dialog window's first control and then returns a boolean value of FALSE. However, the focus is NOT set and tabbing fails when my dialog page appears. WHY?????? Is there a problem with MFC?
The focus setting works when a dialog in initiated via the MFC "DoModal()" command.
Thank you for your assistance.
/////////////////////////////////////////////////////////////////////////////
// AfxDlgProc - does nothing since all messages are handled via AfxWndProc
INT_PTR CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM)
{
if (message == WM_INITDIALOG)
{
// special case for WM_INITDIALOG
CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd));
if (pDlg != NULL)
return pDlg->OnInitDialog();
else
return 1;
}
return 0;
}
Michael A. Rinaldi
|
|
|
|
|
You do not need to post your question more than once. Please read the forum guidelines.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
See here[^]. In short calling SetFocus should not be calling in dialogs: instead WM_NEXTDLGCTL should be used.
Steve
|
|
|
|
|
The following MFC code calls my own OnInitDialog function which in turn sets focus to my dialog window's first control and then returns a boolean value of FALSE. However, the focus is NOT set and tabbing fails when my dialog page appears. WHY?????? Is there a problem with MFC?
The focus setting works when a dialog in initiated via the MFC "DoModal()" command.
Thank you for your assistance.
/////////////////////////////////////////////////////////////////////////////
// AfxDlgProc - does nothing since all messages are handled via AfxWndProc
INT_PTR CALLBACK AfxDlgProc(HWND hWnd, UINT message, WPARAM, LPARAM)
{
if (message == WM_INITDIALOG)
{
// special case for WM_INITDIALOG
CDialog* pDlg = DYNAMIC_DOWNCAST(CDialog, CWnd::FromHandlePermanent(hWnd));
if (pDlg != NULL)
return pDlg->OnInitDialog();
else
return 1;
}
return 0;
}
Michael A. Rinaldi
|
|
|
|
|
Showing the MFC code doesn't really help us
What are you doing in your derived class OnInitDialog? How are you setting focus to a control?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Mark:
Sorry about that.
Here's my app's function that's called by the MFC code. I'm adding my own supplementary comments.
BOOL CSetupDlgMyApp::OnInitDialog()
{
CDialog::OnInitDialog();
UpdateMyNames(); // updates class object parameters
GetDlgItem(IDC_RENAME_ACCOUNT)->SetFocus(); // Here I'm trying to set my dialog page's
// focus to its first control
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Thank you for your assistance.
Michael A. Rinaldi
Michael A. Rinaldi
|
|
|
|
|
Maybe try this instead:
//GetDlgItem(IDC_RENAME_ACCOUNT)->SetFocus(); // Here I'm trying to set my dialog page's
GotoDlgCtrl(GetDlgItem(IDC_RENAME_ACCOUNT));
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
MRCres wrote: GetDlgItem(IDC_RENAME_ACCOUNT)->SetFocus(); // Here I'm trying to set my dialog page's
// focus to its first control
Is IDC_RENAME_ACCOUNT the first non-static control in the dialog's z-order?
"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
|
|
|
|
|
Yes, it is.
Michael A. Rinaldi
|
|
|
|
|
Then there's no need to call SetFocus() or return FALSE .
"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
|
|
|
|
|
Focus is being set to the first control upon dialog activation and initialization; however, tabbing is inoperative until one touches the first control to activate the subdialog. After the subdialog is opened and closed, tabbing works on the dialog controls.
Although tab controls and ordering are set in the MFC resource editor, why is tabbing not working and inoperative upon dialog window initialization and activation?
(Note that the window display occurs on a touch panel screen whereby the touching of a button is handled like a LEFT MOUSE DOWN\UP command.)
Thank you for your assistance.
Michael A. Rinaldi
|
|
|
|
|
Hi,
I am trying to use this function
<br />
CWnd::FlashWindowEx()<br />
in my CMainFrm class but it cannot compile returning the error
error C2065: 'FlashWindowEx' : undeclared identifier
However, if I use
<br />
CWnd::FlashWindow()<br />
It is ok. Does anyone know why the call to CWnd::FlashWindow() does not work ?
Thanks.
ps I have ommitted the arguements in this post.
|
|
|
|
|
Maybe you have an old version of MFC (for instance, VS6 MFC doesn't have the CWnd::FlashWindowEx method while it has the CWnd::FlashWindow one). As workaround, try to use the Win32 FlashWindowEx function.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
|
i want to extract the port information of other pc's on my lan like on which port which .exe or process is going .
Thanks
Sumedh
|
|
|
|
|
can anyone show me how to read from a text file i have opened and written to using cfile.
eg this is how i opened and wrote to the file.Check1 is a boolean variable.i would like to retrieve the value of that boolean variable.
CFile LoggingObject;
CString txt;
txt.Format("%d", check1);
LoggingObject.Open( "c:\\test.txt", CFile::modeCreate|CFile::modeReadWrite);
LoggingObject.Write (txt,sizeof(txt));
|
|
|
|
|
Since you knew how to use the Write() method, I'm surprised that you overlooked the Read() method.
sivern wrote: LoggingObject.Write (txt,sizeof(txt));
This should be:
LoggingObject.Write(txt, txt.GetLength()); Or:
LoggingObject.Write(&check1, sizeof(int));
"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
|
|
|
|