|
You call waveInPrepareHeader once for each buffer, then call waveInAddBuffer initially and then every time you received a buffer back and need to submit it again.
When done, you call waveInUnprepareHeader for each buffer then waveInClose when all done. (Note that you have to get the buffer back to call waveInUnprepareHeader . It's been a long time since I've worked on wave code, but i believe you call waveInReset() to force the buffers to be returned to you.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks Joe and Bikram.
Yes, the key is re-submit the same buffer. I didn't know how to submit received buffer again.
Now with output from oh as suggested by Bikram and the hint from Jeo, I think I found a solution:
As Joe mentioned, I invoke waveInPrepareHeader only when a buffer first created.
Then, every time when I received a buffer back from OS, I set dwFlags to WHDR_PREPARED before calling waveInAddBuffer. It looks it is working. My memory and handle usages are stay constant while it is running and I am getting audio input.
|
|
|
|
|
Hi guys
I've got a dialog and a control on it.
When I leftclick on the control an OnCommand is generated on the dialog.All is right to me.
But when I do a rightclick on the control the OnCommand is not generated.
It is possible to do something easily to have the same behavior than when I do a leftclick?
Best Regards
Doc
|
|
|
|
|
you overload the WM_RBTDOWN (or something like that), and you call the function you wrote for the left click into that new one.
TOXCCT >>> GEII power
|
|
|
|
|
Thanks for the answer but the problem is that my dialog is not receiving WM_RBTDOWN or WM_COMMAND.
The WW_RBTDOWN is received by the control not by the dialog and I need that an ON_COMMAND in the dialog be generated.
Doc
|
|
|
|
|
i'm not sure i understand. if the condtrol can catch it, so, there is no pb ?!
you add a function in your dialog class, you get sure that the WM_RBTDOWM is correcty inserted into AFX code lines, and that's ok for you... no ?
TOXCCT >>> GEII power
|
|
|
|
|
When you right click in a control on a Dialog, the dialog is not receiving the OnRButtonDown, is the control that is receiving it, and I need that the dialog receive the Rbuttondown.
Doc
|
|
|
|
|
Lose the OnCommand() handler. You did not mention what the control is, so I tried it with both a list control and an edit control. For the list control, I handled the NM_CLICK and the NM_RCLICK messages. Both of these produced a ON_NOTIFY() handler in the dialog's message map. For the edit control, I added ON_WM_LBUTTONDOWN() and ON_WM_RBUTTONDOWN() to the message map of the edit control's class.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry David it's a Picture Control with a class derived from CStatic.
Best Regards
Doc
|
|
|
|
|
No matter. Derive a class from CStatic . Provide handlers for both the WM_LBUTTONDOWN and WM_RBUTTONDOWN messages. Make sure the control has the SS_NOTIFY style.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry David
Maybe it's my fault and I haven't explained correctly.
I've got a dialog with a picture control.
I've already got a Class derived from CStatic with WM_RBUTTONDOWN and WM_LBUTTONDOWN messages.Here all is clear.
But what I need is when I Right click on the Picture control, to generate an OnCommand message in my dialog.
When I left click on the picture control an Oncommand is generated in my dialog, but when I right click no.
Any suggestion?
Best Regards
Doc
|
|
|
|
|
doctorpi wrote:
Maybe it's my fault and I haven't explained correctly.
Nah, I just didn't see the need of using OnCommand() when there are other (more direct) ways of being notified. Anyway, I think you are being plagued by the control having the WS_EX_NOPARENTNOTIFY style. Removing this style at run-time results in both left and right clicks being sent to the control's parent. The parent will need to handle the WM_PARENTNOTIFY message.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Sorry for my ignorace.
But how can I remove WS_EX_NOPARENTNOTIFY at runtime?
I know GetExStyle and how to change the value (dwExStyle &= ~WS_EX_NOPARENTNOTIFY ) but to set the changed value to the control?
Best Regards
Doc
|
|
|
|
|
doctorpi wrote:
But how can I remove WS_EX_NOPARENTNOTIFY at runtime?
pic_ctrl.ModifyStyleEx(WS_EX_NOPARENTNOTIFY, 0);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks a lot guy
That was just what I need.
Doc
|
|
|
|
|
i think another way :by set mouse right key hook
HWND hWnd=::FindWindow(.....)
if(hWnd)
Hook MouseRKeyHook=SetWindowsHookEX(
WH_MOUSE,
(HookPRoc) mouseRKeyProc,
.....
)
LRESULT CALLBACK MouseRKeyProc(....)
{
when(lparam==“MK_RBUTTON")
//add you want functionality
...}
|
|
|
|
|
Hello,
I have never attempted to map drives using code, can someone point me in the right direction (what functions or pieces do I need to research). I want to be able to map drives to NT shares that require NT authentication. When I say map drives I want to be able to assign a drive letter to a share and or just connect directly and access the files.
Any help would be greatly appreciated!
Thank you,
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
IIRC you use NetUseAdd()
Ant.
|
|
|
|
|
If you want to do the share beforehand use NetShareAdd()
Ant.
|
|
|
|
|
Has anyone used USB? Is this similar to RS232 serial transfer? How do you enumerate the ports?
|
|
|
|
|
Short answer: No, it is not similar.
Longer answer: the Universal Serial Bus has basically very little to do with 'serial transfer', despite it's name. There is no concept of ports: the USB is a hub-based network of devices, much like the Ethernet of today.
Programming the USB is just as difficult: in order to send data from a computer to a device, the device must implement an USB endpoint. Usually this is achieved through a USB-compatible electronics chip. Using this chip requires a driver that the operating system loads in order to communicate with the device. You can then ask the OS to enumerate through available endpoints, open a serial connection to an endpoint and send/receive data. The OS will then worry about correctly delivering the data to the recipent connected to the bus.
Naturally, you could re-write the USB base device driver so that it would work as a serial-only device. In such a case, you could manually enumerate the ports, but you'd also lose all the benefits of the USB specification. In english, you'd be using the USB in a way it was not designed to be used. All other USB devices on the system would fail to function with the serial-only USB device. I believe such drivers are available for testing purposes, however.
For more information on how the USB works, I recommend visiting this page
I also recommend the 'USB Complete' book by Jan Axelson, ISBN# 0-9650819-5-8.
For some nice, detailed USB-programming information, visit this page.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks for the information. There seems to be a scarcity information out there on USB on the web on this subject, but maybe I was expecting it to be much simpler than it is.
-----------------------------
All truth passes through 3 stages.
First, it is ridiculed.
Second, it is violently opposed.
Third, it is accepted as being self-evident.
|
|
|
|
|
I am trying to get into view the last bit of text posted to the multiline Edit Box with a vertical scroll enabled via these lines of code:-
m_strOutput+= m_strGeneral + crlf; // Total display string; adding m_strNewText at the end
m_Output.SetWindowText(m_strOutput); // Display the new text appended onto the old text
m_Output.GetScrollInfo(SB_VERT, &scrollInfo, SIF_ALL);
scrollInfo.nPos = scrollInfo.nMax;
m_Output.SetScrollPos (SB_VERT, scrollInfo.nPos, TRUE);
m_Output is the Edit Box and I was trying to set the scroll position to the current maximum, but no luck. i.e. the botton of the text.
I still have to use the mouse to click on the Edit Box scroll bar to display the end of the posted text.
Is it that difficult to have the behavour of the Edit Box scoll reversed?
I have tried many options/varients but still no luck!
|
|
|
|
|
When doing my homework, I had this code:
<br />
....<br />
int main(){<br />
const int a=10;<br />
int* p=(int*)&a;<br />
*p=100;<br />
int i=a;<br />
cout << "p=" << p << endl;<br />
cout << "&a=" << &a << endl;<br />
cout << "*p=" << *p << endl;<br />
cout << "a=" << a << endl;<br />
cout << "i=" << i << endl;<br />
return 0;<br />
}<br />
Here is the output:
p=0012FF7C
&a=0012FF7C
*p=100
a=10
i=10
I guessed that a had to be 100, but it's 10.
It seem that compiler has replaced all instance of variable a to 10 at compile time, event if a has been allocated a storage. So the trick to change a constant by casting its pointer is not effect. Is that right?
Any comment is welcome.
Thanks.
|
|
|
|
|
I do not understand your explaination very well, but the program seems logical to me.
const int a = 10; const: means 'a' is a constant wich you cannot change.
then put a in p (thus p = 10)
then put 100 in p and then i = a;
Where is your problem?
|
|
|
|