|
I met a strange problem.
This is my code
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib, "winmm.lib")
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
DWORD datasize = 48000;
HWAVEIN mh;
WAVEFORMATEX wf;
wf.wFormatTag=WAVE_FORMAT_PCM;
wf.nChannels=1;
wf.nSamplesPerSec=8000;
wf.nAvgBytesPerSec=8000;
wf.nBlockAlign=1;
wf.wBitsPerSample=8;
wf.cbSize=0;
int r;// = ;
cout << "poo1";
int k = waveInOpen(&mh,WAVE_MAPPER,&wf,NULL,0L,CALLBACK_WINDOW);
cout << k;
cout << "poo2";
if (k == MMSYSERR_NOERROR)
cout << "success";
else
cout << "fail";
cout << "poo7";
//WAVEHDR mp;
//mp.dwFlags=0;
//mp.dwUser=0;
//mp.dwLoops=0;
//mp.dwBytesRecorded=0;
//mp.lpData = (char *)GlobalLock( GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE, datasize) );
//memset(mp.lpData, 0, datasize );
//mp.dwBufferLength = datasize;
//int p = waveInPrepareHeader( mh, &mp, sizeof(WAVEHDR) );
//cout << p;
cout << "poo4";
//waveInAddBuffer
int i ;
r= waveInGetNumDev();
cout << "poo5";
cout << r ;
cin >> i ;
//cout << " " << endl;
return 0;
}
and It runs the result following
poo0poosuccesspoo3
It's strange.
I change the code, but the program dont know.
Can somebody help me?
minihotto
|
|
|
|
|
#include<iostream.h>
#include<afxwin.h>
#include<mmsystem.h>
#pragma comment(lib, "winmm.lib")
int main(int argc, _TCHAR*argv[])
{
DWORD datasize = 48000;
HWAVEIN mh;
WAVEFORMATEX wf;
wf.wFormatTag=WAVE_FORMAT_PCM;
wf.nChannels=1;
wf.nSamplesPerSec=8000;
wf.nAvgBytesPerSec=8000;
wf.nBlockAlign=1;
wf.wBitsPerSample=8;
wf.cbSize=0;
int r;// = ;
cout << "poo1";
int k = ::waveInOpen(&mh,WAVE_MAPPER,&wf,NULL,0L,CALLBACK_WINDOW);
cout << k;
cout << "poo2";
if (k == MMSYSERR_NOERROR)
cout << "success";
else
cout << "fail";
cout << "poo7";
cout << "poo4";
//waveInAddBuffer
int i ;
r= waveInGetNumDevs();
cout << "poo5";
cout << r ;
cin >> i ;
//cout << " " << endl;
return 0;
}
Try out
mythili
|
|
|
|
|
Thanks^^
I know where is the problem.
|
|
|
|
|
It's called caching. You need to end each of the cout statements with endl .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
is it possible to use the slider control programatically? like when i move my mouse on the client area of my SDI, my slider control on my Form view is also being dragged corresponding to the movement of my mouse...if possible can someone help me.. thanks
positive vibes
|
|
|
|
|
dacky wrote: is it possible to use the slider control programatically? like when i move my mouse on the client area of my SDI, my slider control on my Form view is also being dragged corresponding to the movement of my mouse...
Handle the WM_MOUSEMOVE message. Each time your handler function gets called, you'll need to determine if you are moving left or right (based on the previous values). Move the slider control accordingly.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi,
I want to write my program settings into a configuration file, but I have CString object and CArray data structures, so what is the best way to do this?
My structures look like:
typedef struct tagFavoriteSettings<br />
{<br />
struct FavoriteElement<br />
{<br />
CString strName;<br />
CString strPath;<br />
};<br />
CArray<struct FavoriteElement,struct FavoriteElement> Elements;<br />
tagFavoriteSettings(){}<br />
}FavoriteSettings;
Thanks alot
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
The oldest way to do that is to create a .ini file (I don't recommend this approach)
The next old way would be to use CObject Serialization ( I don't recommend this but it might be best for you)
The current way is to use XML and XML API's (like MSXML.dll)
led mike
|
|
|
|
|
hi,
i have to program to validate countries, states and cities for North of America. Do you know a SOA or somethings else that returns all countries, states and cities?
thanks.
|
|
|
|
|
You will need to find a database to either download or query at runtime.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Before you said somethings to another person, you have to understand his needs and approches. If not, yours words are insignificant this means you are useless.
MK.
|
|
|
|
|
Such as this?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You can use one of the USPS Web APIs, I think the Address Validation one can do this for you. You will have to register to gain access to the API testing server, and then you have to develop, test and validate your implementation and then you get access to the production server.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I want to write a simple record program.
I have a microphone, and I can use it.
But waveInGetNumDevs returns 0.
why? Can somebody help me?
Thanks a lot.
|
|
|
|
|
minihotto wrote: I have a microphone, and I can use it.
Does Sound Recorder app works?
|
|
|
|
|
what is that????
minihotto
|
|
|
|
|
Sound Recorder is Windows "Accessories" application generally using sound card.
Has mic, line inputs and line, speakers output.
Plug your microphone in and run the app to see if it works.
|
|
|
|
|
|
I would like to code games and other applications for my Pocket PC/Palm OS devices. How would you all recommend I go about doing this? I have a full version of Visual Studio 2003 .NET. I am a pure C++ programmer and I also use MFC (no .NET). Any suggestions that you all can make on the best way to go about doing this would be greatly appreciated.
Thanks,
BP
|
|
|
|
|
|
if you want to advertise, buy an emplacement !
if you share the sources, you can also make an article about it.
but DON'T spam the boards with your ads
|
|
|
|
|
It seems its nota question
|
|
|
|
|
I like to create a functionpointer on an instance of an object.
I have a Universal-List that uses an array of pointer to different Rows.
A row has a basic-class and all specific rows ( for example customers ) are derivated from this Class.
Row -> CustomerRow
In the Universal-List i like to create an array of pointer to the member-functions of the rows.
The row exists already as an instance and i like to assign the functionpointer to the memberfonction of this instance...
Is it possible?
MSDN Help says that functionpointer must point to static functions.
But in an instance, the function is precised and accessible, so why does the fctpointer
don't save the "linkage"
Thanks
|
|
|
|
|
baerten wrote: But in an instance, the function is precised and accessible, so why does the fctpointer
don't save the "linkage"
Because with a member function, there is an explicit parameter that is passed to your function: the this parameter (pointer to the instance of the class). If you post some code, maybe we can help you. Basically, what you need to do is specify that the functions in your list are members of your class (by addind a CMyClass:: in front). But without seeing code, it is difficult.
|
|
|
|
|
void RTB::Config_Customer()<br />
{<br />
InternList = (BasicRow**)malloc(NumberofRows*sizeof(BasicRow*));<br />
for(int i=0; i<NumberofRows; i++)<br />
InternList [i] = new CustomerRow();
<br />
ActFillRow = InternList[0];
<br />
CustomerRow* ActCustomerToFill = static_cast<CustomerRow*>( ActFillRow );
MetaTable= (MetaInfo*)malloc(8*sizeof( MetaInfo));<br />
MetaTable[0].Name = "Name";<br />
MetaTable[0].Func = &CustomerRow::SetName;
MetaTable[1].Name = "Firstname";<br />
MetaTable[1].Func = &CustomerRow::SetFirstname;<br />
<br />
}
The MetaTable :
typedef struct MetaInfoForColumns {<br />
CString Name;<br />
ColumnSetter Func;<br />
} MetaInfo;
Column Setter:
typedef void (CustomerRow::*ColumnSetter)(CString); // Functionspointer
Thanks a lot
|
|
|
|