|
Why, why, why ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
LOL
I was wondering how to reply to that and then decided to forget about it.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I want to show ASSERT, when we lose some of data.
I.e.
int a = 100000;
short b = a; // now a=-31072
Please, help me.
Przemek.
|
|
|
|
|
I guessed that was what you wanted thinking about it after my post. I don't believe it can be done.
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 trying to send data to console window using PostMessage with WM_KEYDOWN.
The third and fourth param for postmessage are
WPARAM wParam, // virtual-key code
LPARAM lParam // key data
i.e. PostMessage( hwndDOS, WM_KEYDOWN, ‘K’, 0X10250001 );
Any idea how to translate my array (ascii data such as abcd, <> fg etc ) to third and fourth parameter?
Thanks
|
|
|
|
|
Try this, haven't try it myselft but try you:
<br>::SendMessage(hWnd,WM_KEYDOWN, VK_K, 0);<br>
You have to vrite the virtual key (VK_K) not only K, the compiler doesn't recognize K.
I'm not sure it will work in console window!
A CONSOLE IS NOT A DOS APP!! REMEMBER THAT BUDDY!!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
I am not sure whether WM_KEYDOWN will work for a console app. You might have to do something else like redirecting STDIN or whatever.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
As I said in the message!
I've never do console apps because it's useless time for me doing console apps!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
It works with DOS window for AlphaNumerics. But any idea how to translate $ and & to VK_Key?
|
|
|
|
|
this thread
...and, yes, it will work for a console window. (Mind, the code needs a bit of cleanup )
|
|
|
|
|
I want to make a combobox control that popup a dialog.
I put my control on a dialog
named dialog1 and popup dialog2. I found dialog1's title bar become inactive.
but when combobox popup listbox, the dialog dosen't become inactive. Is anyone can help me?
thanks to all the programmers who have helped me.
|
|
|
|
|
That's the way it works.
When you popup the modal dialog the parent dialog gets disabled.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Not a modal dialog. Just like a list box in combobox!
thanks to all the programmers who have helped me.
|
|
|
|
|
Have a look here, there might be something close to what you are trying to do.
http://www.codeproject.com/combobox/
Michael
|
|
|
|
|
thanks, but I didn't find. Do u have any more suggestions?
thanks to all the programmers who have helped me.
|
|
|
|
|
I have a problem in my (nonMFC) app, in that when I get a Window rect, it does not appear to take into account the size of the caption or the menu. A further problem is that the menu sometimes takes up more than one line, when the dialog is resized, and so I need to know how many rows there are before I can use SM_CYMENU or whatever it is, to get the correct value.
Can anyone point me in a direction that is not circular ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi Christian,
Can you do (this just being a guess):
RECT vrClient;
RECT vrWindow;
POINT vpTopLeft;
GetClientRect(m_hWnd, &vrClient);
GetWindowRect(m_hWnd, &vrWindow);
vpTopLeft.x = vrClient.left;
vpTopLeft.y = vrClient.top;
ClientToScreen(m_hWnd, &vpTopLeft);
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hi ,
Is it possible to load other ActiveX controls from one ActiveX Control at
run time.
The ActiveX control I have to develop..whose responsibility is to load
the other activeX controls and PASS parameters they require at run time
The parameters I have to pass and the class ID of the control I will be
getting
from the html page in which my activeX control is present.
For Example:
<html>
<head>
</head>
<object classid="CLSID of My ActiveX control" width="300" height="250">
<param name "TotalControlsToLoad" value ="N">
<param name "Control ID" value ="ToLoad1">
<param name="Control ID" value= "ToLoad2">
.......................
.......................
<param name="Control ID" value= "ToLoad N">
</object>
<object classid="CLSID of Some Active X control One" ID="ToLoad1">
</object>
<object classid="CLSID of Some Active X control two" ID ="ToLoad2">
</object>
</body>
</html>
1. Is it possible to for my ActiveX control to get the information of other
activeX controls in the HTML page.
2. Is it possible to load the other active X controls using my control.
3. How do I communicate with other ActiveX controls...
i.e I know control communicates with container...But how do two controls
which are
contained in the same container communicate with each other.
Please send your Inputs/Suggestions /Improvements.
Thanks in Advance,
Raju
|
|
|
|
|
I've got a dialog-based app with a button that plays a .wav file when the button is pressed. It works fine, but a problem is that if you press the button multiple times while the .wav file plays, it plays the .wav file that many times over and over. I've tried disabling the button during the play, but I think the mouse-click message isn't received by the object until after the play is over, so even though the button is disabled, I can still click a second time during the play and it will play again after the first play is over...if that made sense.
Here is what I tried. Despite all this, the .wav still plays twice if I click the button twice:
void CWaveTestDlg::OnPlay()
{
if (isPlaying) return;
isPlaying = TRUE;
CWaitCursor wc;
CButton* pPlayButton;
pPlayButton = (CButton*) GetDlgItem(IDC_PLAY);
pPlayButton->EnableWindow(FALSE);
// code to play wave file
isPlaying = FALSE;
pPlayButton->EnableWindow(TRUE);
}
I've also tried overloading the WM_LBUTTONDOWN message and not
calling the base class if we isPlaying, but this didn't work
because OnLButtonDown only receives clicks from the dialog window
itself, not the button.
void CWaveTestDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if (!isPlaying)
CDialog::OnLButtonDown(nFlags, point);
}
Any help is appreciated!
|
|
|
|
|
The OnPlay code will work if the "code to play wave file" is synchronous. My suspicion is that it starts playing the wave file and then continues to the code that re-enables the Play button again.
Have you run this through the debugger?
You don't show the code to play the wave file, but take a look at the sndPlaySound function to which you can pass the SND_SYNC flag.
Regards,
Alvaro
|
|
|
|
|
Try insert next code into the OnPlay()
...
pPlayButton->EnableWindow(FALSE);
MSG message;
if (::PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
{
::TranslateMessage(&message);
::DispatchMessage(&message);
}
...
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
I believe that what is happening here is that the button gets enabled before the wave finishes playing, probably because your play-wave-whatever function returns immediately and the wave is actually played in the background
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Thanks for all your ideas...
I'm using the mciSendCommand fuction with the MCI_WAIT flag so that it doesn't return until the play is done. This seems to work because the button grays out while its playing and then is re-enabled after the play stops. Nevertheless, I can still click again on the grayed-out button while the .wav is playing and it will play again after it finishes.
I tried to insert the ::PeekMessage code with no results.
I'll look into the sndPlaySound function also, but maybe I can solve this from another approach. I copied my play wave function out of the MSDN help files for MCI, but didn't know how to handle the notify message in my dialog. Maybe someone could help me with this and it would solve the problem? Here's my complete code:
void CWaveTestDlg::OnPlay()
{
if (isPlaying) return;
isPlaying = TRUE;
CWaitCursor wc;
UpdateData(TRUE);
if (m_wave.GetLength() <= 0)
{
AfxMessageBox("Please enter a wave file name.");
return;
}
CButton* pPlayButton;
pPlayButton = (CButton*) GetDlgItem(IDC_PLAY);
ASSERT(pPlayButton != NULL);
pPlayButton->EnableWindow(FALSE);
LPTSTR pStr = m_wave.GetBuffer(0);
CString msg;
MCIERROR mciErr;
if (mciErr = playWAVEFile((HWND) this, pStr))
{
char errStr[128];
LPTSTR pErrStr = errStr;
if (mciGetErrorString(mciErr, pErrStr, 128))
msg.Format("Unknown Error playing Wave File");
else
msg.Format("Error playing wave file : %s", pErrStr);
AfxMessageBox(msg);
}
isPlaying = FALSE;
pPlayButton->EnableWindow(TRUE);
pPlayButton->SetFocus();
}
DWORD CWaveTestDlg::playWAVEFile(HWND hWndNotify, LPSTR lpszWAVEFileName)
{
UINT wDeviceID;
DWORD dwReturn;
MCI_OPEN_PARMS mciOpenParms;
MCI_PLAY_PARMS mciPlayParms;
mciOpenParms.lpstrDeviceType = "waveaudio";
mciOpenParms.lpstrElementName = lpszWAVEFileName;
if (dwReturn = mciSendCommand(0, MCI_OPEN,
MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,
(DWORD)(LPVOID) &mciOpenParms))
{
return (dwReturn);
}
wDeviceID = mciOpenParms.wDeviceID;
// Begin playback. The window procedure function for the parent
// window will be notified with an MM_MCINOTIFY message when
// playback is complete. At this time, the window procedure closes
// the device.
mciPlayParms.dwCallback = (DWORD) hWndNotify;
if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_WAIT,
(DWORD)(LPVOID) &mciPlayParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
//I inserted this next line so that the device is
//closed from within the function...cause I didn't know how
//to handle the callback notification message.
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (0L);
}
Thanks!
|
|
|
|
|
> I'll look into the sndPlaySound function also, but maybe I can solve this from another approach
Setting SND_SYNC will not help you, that is the default behaviour (the value of that flag is zero). I believe what is happening is the following:
1: You disable the button
2: You play the sound, which blocks the application (including the message pump)
3: The user queues up a button press by clicking on it while your application is blocked (you are not pumping messages)
4: Your sound finishes, and you enable the button
5: You return from the function and the message pump starts running again
6: The button click message is received, and you go back to #1
EnableWindow(...) sends a WM_ENABLE message, likely through a SendMessage(...) call, and anyone that knows Win32 should know that SendMessage(...) will bypass the message pump under certain conditions, which is what I believe is happening here. So the Enable and Disable "messages" are being processed before the queued button press.
> I tried to insert the ::PeekMessage code with no results.
That will not work, because it only checks for one message, and only processes one message if it finds one. By the time the user clicks on the button, the PeekMessage(...) code is long since past.
My suggestion would be to use the MCI functions' ability to send a notification message (MM_MCINOTIFY) to you when the sound finishes. You disable the button, play the sound Async. (do not specify the MCI_WAIT flag), and enable the button when you get the notification message that the sound has finished playing.
Peace!
-=- James.
|
|
|
|
|
James,
I figured out how to handle the MM_MCINOTIFY message and that is exactly what I needed.
I added this line to my main dialog message map:
ON_MESSAGE(MM_MCINOTIFY, OnNotifyWavDone)
I added this line to my header file after my class-wizard generated message map functions:
afx_msg LRESULT OnNotifyWavDone(WPARAM wParam, LPARAM lParam);
and I call the MCI function from my main dialog like so:
mciPlayParms.dwCallback = this->GetSafeHwnd();
if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY,
(DWORD)(LPVOID) &mciPlayParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
This closes the device only if there is an error, otherwise, the closing and re-enabling of the button are handled in the callback function:
LRESULT CWaveTestDlg::OnNotifyWavDone(WPARAM wFlags, LPARAM lDeviceID)
{
switch(wFlags)
{
case MCI_NOTIFY_SUCCESSFUL:
m_outputString.Format(_T("Playback completed"));
break;
case MCI_NOTIFY_FAILURE:
m_outputString.Format(_T("Playback interrupted!"));
break;
case MCI_NOTIFY_SUPERSEDED:
m_outputString.Format(_T("Playback stopped!"));
break;
}
mciSendCommand(lDeviceID, MCI_CLOSE, 0, NULL);
isPlaying = FALSE;
CButton* pPlayButton;
pPlayButton = (CButton*) GetDlgItem(IDC_PLAY);
ASSERT(pPlayButton != NULL);
pPlayButton->EnableWindow(TRUE);
pPlayButton->SetFocus();
UpdateData(FALSE);
return 0L;
}
Thought it might be useful to someone. I found some helpful example code here:
http://www.codeguru.com/multimedia/cd_audio.shtml#1
Thanks much,
Eric
|
|
|
|
|