|
How to know whether the sound card is an 5.1/7.1 channels audio supported card by code?
|
|
|
|
|
can someone please explaing what type is UINT_PTR. Is it pointer to unsigned integer or just an alias for unsigned integer?
after looking in basetsd.h file I found it is defined as :
typedef _W64 int INT_PTR;
so it seems it is unsigned integer, but then why people at microsoft has choosen such an ambiguous name for it or is it just PTR doesnt mean pointer and I am misinterpreting it.
thanks
-Saurabh
-- modified at 4:03 Friday 4th November, 2005
|
|
|
|
|
|
Like Johann said, it's used to treat a pointer as an UINT. There's INT_PTR, which treats the pointer as an INT and so on.
Pretty useful for writing platform independent code. Simply casting a pointer to unsigned int won't work on a 64 bit platform, for example.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
There is 2 definitions for UINT_PTR:
if _WIN64 is defined it is a unsigned __int64 (a integer on 64 bit)
if not it is defined as an unsigned int (a integer on 32 bit)
Eric
|
|
|
|
|
#include <vector>
#include <fstream>
#include <iostream>
//英文检索程序
using namespace std;
typedef struct Line
{
int LineNumber; //行数
int Pos; //位置
} LINE;
vector< LINE > Array_Line(200);
//进行字符串的分割
int partition( char * s1 , char * s2 , int pos )
{
int i = pos; //从欲分割的位置开始进行分割
while( s1[i] == ' ' ) //忽略字符串前的所有空格符号
{
i++;
}
if( s1[i] != '\0' ) //判断字符是否已结束
{
int j = 0;
//复制非空格符直到找到下一个空格符
while( s1[i] != '\0' && s1[i] != ' ' )
{
s2[j] = s1[i];
i++;
j++;
}
s2[j] = '\0'; //设置分割字符串之结束字符
return i;
}
return -1;
}
//子字符串的判断
bool Juge( char * strDes , char * strS )
{
int len = strlen( strDes );
for( int i = 0 ; i < len ; i++ )
{
if( strDes[i] != strS[i] )
{
return false;
}
else if( strDes[i] == strS[i] && i == ( len - 1 ) )
{
return true;
}
}
return false;
}
//在一篇文档里找出某字符串的所有行号和个数
int Counter( ifstream file , char * str )
{
int Counter = 0; //设置计数变量起始值
int Number = 0;
int index = 0;
int times = 0;
int position = 0;
char strChar[1024] = {' '};
char partition_string[255] = {' '};
while( !file.eof() )
{
Counter++; //行数加一
file.getline( strChar , 1024 , '\n' ); //读取一行的内容
int tmp = 0;
int pos = 0;
while( ( position = partition( strChar , partition_string , position ) ) != -1 )
{
pos++;
if( Juge( str , partition_string ) )
{
tmp++;
Array_Line[index].LineNumber = Counter;
Array_Line[index].Pos = pos;
Number += tmp;
index++;
}
}
}
return Number; //返回计数值
}
void main()
{
ifstream fin("I:\\Str.dat");
int number = Counter( fin , "cat" );
cout<
|
|
|
|
|
Exactly what's the problem/bug?
|
|
|
|
|
|
China_Boy wrote: access violation
dude, give us some infos !!!
Where ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
China_Boy wrote: access violation
generally result from accesing unintialized memory
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
how much does the pre-compile header help to reduce the compile time?
|
|
|
|
|
If your project is more than a couple of files - lots!
--
The Blog: Bits and Pieces
|
|
|
|
|
Hi,
i hold a pointer to an instance of an unmanaged c++ class in my managed c++ class. just like in the example i found on msdn.
msdn example
This example don't works. I get an unresolved extern symbol error, caused by calling m_pC = new CppClass();
Is there anybody who can tell me how i can create an instance of this CppClass?
Thanks
|
|
|
|
|
the only reason an "unresolved symbol" could occur on such a line is when you declared your CppClass class in its own .h header file, and forgot to #include"" this header in the .cpp file that uses it...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
no... everthing is declared in the same header file. I really have no idea what i do wrong.
I just take the given example into one header file.
|
|
|
|
|
so, what it the exact denomination of the error please ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
error LNK2001: Nichtaufgelöstes externes Symbol "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z)
and
error LNK2001: Nichtaufgelöstes externes Symbol "void __cdecl operator delete(void *)" (??3@$$FYAXPAX@Z)
here the source.
using namespace System;
namespace CTest
{
class CppClass
{
public:
CppClass() {}
~CppClass() {}
void native_f() {}
};
__gc class MClass
{
public:
MClass() { m_pC = new CppClass(); }
~MClass() { delete m_pC; }
void managed_f() { m_pC->native_f(); }
private:
CppClass * m_pC;
};
}
|
|
|
|
|
How can I move a window from one desktop to another?
In my program I use two desktops created by me. SetThreadDesktop(...) don't work.
Thank you.
- NS -
|
|
|
|
|
Hi All,
I wanna get the width and height of a character with font "Arial" or any fonts, do you have any solution for this case ?
Thanks
|
|
|
|
|
Try GetTextExtent - this will give you the width/height of a string (make sure the corrent font is selected into the DC). There is more than one way to do this - maybe others will respond...
The Rob Blog Google Talk: robert.caldecott
|
|
|
|
|
kendao wrote: I wanna get the width and height of a character with font "Arial" or any fonts, do you have any solution for this case ?
Is GetCharWidth() api of any help
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
i have an ADC device. the manufacturer provided a dll .lib and .h to operate the device. But he hasnt mentioned if the dll is release or debug. I used the dll in release and debug mode programs and found it to work in both. Can a dll work in both release and debug mode programs?
The manufacturer doesnt have any idea of release and debug dlls?
|
|
|
|
|
It's most likely a release version. It will work in debug and release builds of your code, as long as you use the same kind of runtime library (Multithreaded (DLL) vs Single-Threaded)
If you try to single-step into a function (during a debug session) and the debugger jumps to the next line in your code, then the dll is definately a release version.
|
|
|
|
|
Hello,
I need to do programming on serial port. (sending & receiving data from serial port)
Which is the best method: using MSComm or Win32 programming(CreateFile)?
And where I can get good material to understand the concept?
Thanking you,
Regards,
mysticlol
|
|
|
|
|
Hello.
There are several articles and helper classes here on CodeProject.
IMO, it's worth considdering using a ready-made class, since serial IO must use overlapped IO.
|
|
|
|