|
C# bytes are .NET framework type. C++ don't have them.
in C/C++, you can use char instead...
char Header_byte[] = {0x10, 0x00};
char DataLength_byte[];
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
For VC++ declaration of byte is
byte buf[]={0x10,0x00};
I have used it in my MFC application
and works fine .
Locgically it is same as "unsinged char".
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hi,
I have encountered compiler error C2504 during compilation of a xerces based app.
There is a header file called Filterresult.h which defines a generalization of DOMNodeFilter
#pragma message("DOMNodeFilter used in Filterresult.h")
class CFilterresult : public DOMNodeFilter
{
public:
virtual short acceptNode(DOMNode const * n) const;
CFilterresult();
virtual ~CFilterresult();
};
The xerces-Header-Files I included into stdafx.h and stdafx.h is always included exactly before Filterresult.h.
But the VC++ compiler is complaining "C2504 .. DOMNodeFilter has never been defined"
Consequently I put pragma message() into **all** Header-Files which declare DOMNodeFilter and also in the header file which defines that class. I would have expected to see, that "DOMNodeFilter used in Filterresult.h" appears before the message "DOMNodeFilter defined". But this is not true..
StdAfx.cpp
class DOMNodeFilter declared in DOMDocumentTraversal.hpp
class DOMNodeFilter declared in DOMDocument.hpp
DOMNodeFilter defined in DOMNodeFilter.hpp
Kompilierung läuft...
domparser.cpp
DOMNodeFilter used in Filterresult.h
d:\tests\xercesdomparser\domparser\filterresult.h(22) : error C2504: 'DOMNodeFilter' : Basisklasse undefiniert
Best regards
Werner
|
|
|
|
|
Just a stupid question: in your Filterresult.h file, did you include either stdafx.h or DOMNodeFilter.hpp ?
|
|
|
|
|
Hi Cedric,
I modified Filterresult.h to include DOMNodeFilter.hpp. I thought this was not necessary because I had included stdafx.h always before filterresult.h in the cpp files (I feel this might have been a wrong assumption). I modified filterresult and included a pragma message("already included") into domnodefilter.h.
#if !defined(AFX_FILTERRESULT_H__D3EED92D_3C92_473B_8382_30ED607DBEEB__INCLUDED_)<br />
#define AFX_FILTERRESULT_H__D3EED92D_3C92_473B_8382_30ED607DBEEB__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
#pragma message("DOMNodeFilter used in Filterresult.h")<br />
<br />
#include <xercesc/dom/DOMNodeFilter.hpp><br />
<br />
class CFilterresult : public DOMNodeFilter <br />
{<br />
public:<br />
virtual short acceptNode(DOMNode const * n) const;<br />
CFilterresult();<br />
virtual ~CFilterresult();<br />
<br />
};<br />
<br />
#endif // !defined(AFX_FILTERRESULT_H__D3EED92D_3C92_473B_8382_30ED607DBEEB__INCLUDED_)
well the output now is still not satisfying..
Kompilierung läuft...
StdAfx.cpp
Kompilierung läuft...
domparser.cpp
class DOMNodeFilter declared in DOMDocumentTraversal.hpp
class DOMNodeFilter declared in DOMDocument.hpp
DOMNodeFilter defined in DOMNodeFilter.hpp
DOMNodeFilter.h already included
DOMNodeFilter.h already included
DOMNodeFilter.h already included
DOMNodeFilter used in Filterresult.h
DOMNodeFilter.h already included
d:\tests\xercesdomparser\domparser\filterresult.h(17) : error C2504: 'DOMNodeFilter' : Basisklasse undefiniert
|
|
|
|
|
please note.. the code section above is missing the target of the include, which is actually
#include <xercesc/dom/DOMNodeFilter.hpp>
thanks
regards
|
|
|
|
|
Sorry, I didn't have much experience in using namespaces:
DOMNodeFilter is defined within the Xerces-Namespace, which has to be referred to by the macro
XERCES_CPP_NAMESPACE_USE.
It was enough to include that macro either within Filterresult.h or before the statement
#include Filterresult.h
regards Werner
|
|
|
|
|
hi,when we speek in Microphone (during chatting)some binary data is stored in the RAM.can any one tell me the way through which i can access those bytes. i will be very thankful to u.
|
|
|
|
|
You can use DirectShow.
From MSDN:
An application can use Microsoft® DirectShow® to capture audio data from microphones, tape players, and other devices, through the inputs on the sound card. Typical scenarios include:
Recording a voiceover narration for later dubbing over a video stream.
Converting legacy analog audio content to digital format.
Capturing voice or music for transmission over a network.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directshow/htm/audiocapture.asp[^]
|
|
|
|
|
thankx a lot, i am really thankful to u,actually i am working on voicechat project,for this i have a logic;that input from mic that is temparary stored in Ram, read those bytes and at the same time send to other client,this idea is okay,plz guide me in this way.again thankx,
|
|
|
|
|
Good morning.
I'm sorry, I haven't used this functions myself. So I can't tell you weather it's possible to get the contents of the stored sound or not.
But good luck anyway.
kakan
|
|
|
|
|
Hello pakFari,
You can use the standard windows functions to do this:
MMRESULT waveInOpen
(
LPHWAVEIN phwi,
UINT uDeviceID,
LPWAVEFORMATEX pwfx,
DWORD dwCallback,
DWORD dwCallbackInstance,
DWORD fdwOpen
);
MMRESULT waveInPrepareHeader
(
HWAVEIN hwi,
LPWAVEHDR pwh,
UINT cbwh
);
MMRESULT waveInAddBuffer
(
HWAVEIN hwi,
LPWAVEHDR pwh,
UINT cbwh
);
MMRESULT waveInStart
(
HWAVEIN hwi
);
MMRESULT waveInUnprepareHeader
(
HWAVEIN hwi,
LPWAVEHDR pwh,
UINT cbwh
);
MMRESULT waveInClose
(
HWAVEIN hwi
);
Details on these functions can be found in de Win32 Developer's References.
I wrote a little example program to demonstrate these functions. This example records 60 seconds of low quality audio from the wave audio input device. I use a simple event callback mechanisme to signal the thread when recording is done. There are more elegant way's of doing this. But i think it is up to you to discover how...
HANDLE hEvent;
HWAVEIN hWaveIn;
WAVEFORMATEX WaveFormat=
{
1, //wFormatTag
1, //nChannels
8000, //nSamplesPerSec
8000, //nAvgBytesPerSec
1, //nBlockAlign
8, //wBitsPerSample
0 //cbSize
};
WAVEHDR WaveHeader;
hEvent=CreateEvent(NULL,TRUE,FALSE,NULL);
if(hEvent==NULL)
{
//Handle error
return;
}
//Open wave audio input device
if(waveInOpen(&hWaveIn,WAVE_MAPPER,&WaveFormat,(DWORD)hEvent,0,CALLBACK_EVENT)!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
WaveHeader.lpData=new BYTE[60*WaveFormat.nAvgBytesPerSec];
WaveHeader.dwBufferLength=60*WaveFormat.nAvgBytesPerSec;
WaveHeader.dwFlags=0;
//Prepare a wave header for waveform-audio input
if(waveInPrepareHeader(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
//Send a input buffer to the given waveform-audio input device
if(waveInAddBuffer(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
if(waveInStart(hWaveIn)!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
ResetEvent(hEvent);
WaitForSingleObject(hEvent,INFINITE);
if(waveInUnprepareHeader(hWaveIn,&WaveHeader,sizeof(WAVEHDR))!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
if(waveInReset(hWaveIn)!=MMSYSERR_NOERROR)
{
//Handle Error
return;
}
waveInClose(hWaveIn);
//Process data
WaveHeader.lpData[dwIndex]=//etc...
You can also use the Direct sound api.
|
|
|
|
|
Can anyone tell me what CScrollView class can do?
Where and how can i use it.
Thanks
Its not the result, its the effort to achive the result which is valueable.
|
|
|
|
|
|
If you encounter m_nMapMode==MM_NOME error, manually assgined it before that.
Use CScrollView's member func to scroll instead of its CScrollbar child wnd's.
And the class is very convienent to use.
-- modified at 4:39 Thursday 29th September, 2005
|
|
|
|
|
U have got the right question for me ?
I have just done up using the CScrollView
in my MFC project.
A CScrollView class will encapsulate all
the functions for Scrolling (vertical &
horizontal). If u use a CView as normally
done in MFC project then u need to code
everystep for the Scrolling function .But
in CScrollView derived classes u just
need to put up few line of code.
Shorltly comming up with a small application
and will upload on the codeproject .
Hope so this make u r dobut clear
:->
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
I'm moving from VC6 to VC2003 and from multi-byte to Unicode.
After fixing all the errors related to unicode, i ended with an error i
can not resolve.
************
error C2664: 'InterlockedExchangePointer' : cannot convert parameter 1
from 'T ** ' to 'void ** '
with
[
T=MyClass
]
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
********************
The code is:
***************
MyClass * mQ_waiting_for_write;
InterlockedExchangePointer(&mQ_waiting_for_write, NULL);
**************
Any ideas what is the problem?
|
|
|
|
|
This is the right way to do it:
void** arg = static_cast<void**>(static_cast<void*>(&mQ_waiting_for_write));
InterlockedExchangePointer(arg, new_Q);
or shorter:
InterlockedExchangePointer((void**)&mQ_waiting_for_write, new_Q);
|
|
|
|
|
I am having a window application in which i am using ShChangeNotifyRegister API to get File system notifications.
It is working fine . but if the explorer is terminated from the task manager and started again I am not getting any notifications . I am able to identify that Explorer has been killed and when new explorer starts I am registering my applcation again with shell .But still I am not able to get any notifications . Any solutions on how to proceed doing it ?
|
|
|
|
|
Hello,
maybe this can be of interest for someone: my multi-threading mfc-app crashed sometimes not reproducable on systems with hyper-threading active. So it would be very nice if i could tell my app to use only one cpu even if hyper-threading is active. After searching msdn and the internet for a method to do this, i found this api-function:
SetProcessAffinityMask(GetCurrentProcess(), 1);
The first parameter is the handle to the current process (my app) and the second parameter is a 32-bit value (mask) where every bit represents a cpu. Calling this function solved the problem of my hardly to reproduce exceptions.
Of course it does not fix the problem at the root because my app isn't HT-compatible at least, but now i have more time to learn about the difference between using HT and not using HT. Maybe someone knows a good starting-point for this.
Best regards,
Tabor25
|
|
|
|
|
Nice to know, thx
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Good Thank you
if any one has idea
how to do a VPN connection
through a vc++ ??
Some special API's for it
are availabel for VPN connection?
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Situation: I have a windows application – C++ MFC Dialog based – which can be stopped by users from Task Manager. (Normally behavior)
Can you please provide me a piece of code or a web reference that I can include into my project in order to prevent the application stop from the Task Manager?
Thank you.
|
|
|
|
|
|
there are many
demo code availabe just
put a search in codeproject
or Google u get one ,
i have found one code
http://www.codeproject.com/system/Hack_Windows_Task_Manager.asp
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|