|
MrVanx wrote: when i access a COM object do i need to include any particular files
You'll need whatever header files that have define the interfaces you use. You may need link libraries as well. objbase.h/ole32.lib are the basics. The documentation for COM interfaces you
use should tell you which ones you need.
WIA is new to XP. As an alternative, and for compatibility with previous windows versions,
there's DirectShow (SDK is in the Platform SDK). There's also the old Video For Windows (VFW).
VFW has been replaced by DirectShow for the most part (in fact, legacy video device drivers for
VFW are supported in DirectShow).
|
|
|
|
|
Depending on which manufacturer of camera you are using, they may have an SDK to download. I've downloaded one from one of the major WEBCAM manufacturers and am using their SDK to develop personal stuff. The SDK is really old (like 2-3 years) but still works with most of their cameras. I forget who'se SDK it is, exactly. I know Logitech gives out their SDK; however, they want you to sign an NDA agreement and check out your company before doing so. Needless to say, I'm not using logitech cameras. YMMV
Will this solve your problem? I don't know.
|
|
|
|
|
Hey people, thanks for the replies.
Im really not knowledgeable enough in C++ to program it without a VERY steep learning curve (talking about MONTHS).
I have the datasheet for the camera (including the CCD chip, the USB chip and how the whole device works), but i am just not able to devote enough time to getting it working that way.
My solution is to use the MATLAB image aquisition toolbox to get a still image and save it as a bitmap. The C++ program then reads this bitmap to obtain the data, its a VERY CRUDE way of doing this and uses alot of memory
Never mind eh.
(I have another question for the board but ive started a new thread on this)
|
|
|
|
|
hi all
does anybody know if there is a (simple?) way of controlling a thread's CPU usage?
Specifically, I have a hard-working thread running in the background, and I wouldn't mind if it utilizes 95% of CPU time when the running machine isn't busy. However, it doesn't seem to be doing that.
there are no facts, only interpretations
|
|
|
|
|
I have been looking on the net for random number generators and found something called "Mersenne Twister" on this page: http://en.wikipedia.org/wiki/Mersenne_twister. And there you find som pseudocode that I don't fully understand. For example, how do I write this line in C++?:
MT[ i ] := last_32bits_of((69069 * MT[i-1]) + 1)
And from the second function, how do I write the following code in C++?
y := 32nd_bit_of(MT[ i ]) + last_31bits_of(MT[i+1])
Is this the most efficient way of checking if a number is even?: if(x % 2 == 0){do something...;}
The most confusing parts here are "last_32bits_of", "32nd_bit_of" and "last_31bits_of". I don't really understand what that mean at all. I am totaly lost here!!
And finnaly when I have my three functions, how do I use them??? Say I want a random number between 13 and 12 456 123. How are these functions intended to be used??
I know there are a C# version and native C++ version of a class here on code project that uses this algorithm, but I wanted to develop something on my own. And first I need to understand this pseudocode so I can develop my own not so complex class. I have been looking in to the two versions mentioned above but I could not figure out how it really worked.
best regards, Andreas
|
|
|
|
|
AAsterlund wrote: The most confusing parts here are "last_32bits_of", "32nd_bit_of" and "last_31bits_of". I don't really understand what that mean at all. I am totaly lost here!!
I would guess that these operations result in a number longer than 32 bits. Probably 64 bits. You can use bitwise and shift operators and/or casting to extract a range of bits from these numbers. I think to implement this correctly you would need to know if the numbers are stored in big or little endian and possibly adjust the algorithm according for your platform
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
AAsterlund wrote: MT[ i ] := last_32bits_of((69069 * MT[i-1]) + 1)
MT[i] = (int)(((69069LL * MT[i-1]) + 1LL) & 0x00000000FFFFFFFFLL);
AAsterlund wrote: y := 32nd_bit_of(MT[ i ]) + last_31bits_of(MT[i+1])
y = ((MT[i] >> 31) & 0x0000001) + (MT[i+1] & 0x7FFFFFFF);
|
|
|
|
|
The answer to my question may be just an explaination why I can not declare a data array in a method that is part of a class library.
i.e.,
someMethod(int len) {
...
int *item = new int[len+1]; // fails - new is, here, and unresolved external
int *more = new int[8]; // a constant length doesn't help
/* Actual Error Message
ListMagic error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z)
*/
classObj *okThink = new classObj(); // allowed - here, new exist again
...
}
How can I make this type of data declarations work, or, perhaps, have a reasonably close work-around? If it were a matter of location, I should have been able to declare it static and been OK (?), but none of the countless varitions I tried worked. I imagine the new operator behaviour is due to it's being an overload.
Thanks for any help, even if it's confirming I can't do what I want to do.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
|
|
|
|
|
Hi,
I am making VC++.NET windows application. I made a configuration file (app.config) for my database server settings. But when I am trying to get setting from the file using “ConfigurationSettings” class I am getting NULL in it. Here is my code for that.
<code>NameValueCollection* configCol = ::ConfigurationSettings::AppSettings;</code>
Can I know what is the problem in this?
Thanks in advance,
Priyank
|
|
|
|
|
Since nobody has answered this question for long time, I want to have a try.
priyank_ldce wrote: NameValueCollection* configCol = ::ConfigurationSettings::AppSettings;
Doesn't this require mentioning some setting name, i.e.
NameValueCollection* configCol = ::ConfigurationSettings::AppSettings["someproperty"];
|
|
|
|
|
Hi, I was wondering what the purpose of the .pdb file that is automatically generated in my release build is? I'm sure it's for debugging purposes, so do I need it with my release build?
Thanks
|
|
|
|
|
I think this is pre-linker file. You can delete it When you release. Here it also generate .ilk file. Also safe to delete.
|
|
|
|
|
At least in Windows Forms application, the Release build generates the .pdb by default. It can be useful for development and testing purposes. You may control this feature in project properties at Configuration Properties / C/C++ / General / Debug Information Format.
|
|
|
|
|
|
I have a function that queries an Oracle DB. For some reason I receive two errors on each statement in my __finally block. Is there something wrong with my declarations?
Errors:
error C2065: 'myReader' : undeclared identifier
error C2227: left of '->Close' must point to class/struct/union/generic type
error C2065: 'myOracleConnection' : undeclared identifier
error C2227: left of '->Close' must point to class/struct/union/generic type
My code that generates the errors:
cPacket ^queryPacket(String ^cmd, String ^con)
{
//test if the passed arguments are empty
if(con->Equals(""))
{
MessageBox::Show("Oracle Connection String Empty o.O","Error in Form1::queryPacket");
}
if(cmd->Equals(""))
{
MessageBox::Show("Oracle Command String Empty o.O","Error in Form1::queryPacket");
}
try
{
OracleConnection ^myOracleConnection = gcnew OracleConnection(con);
OracleCommand ^myOracleCommand = gcnew OracleCommand(cmd, myOracleConnection);
myOracleConnection->Open();
OracleDataReader ^myReader = myOracleCommand->ExecuteReader(CommandBehavior::CloseConnection);
myReader->Close();//I put this in here to debug. The statement doesnt throw any errors and inteliSense picks up the myReader object so I'm assuming that it works fine.
}//end try
catch (Exception ^ex)
{
MessageBox::Show(ex->Message,"Exception in class PaCCaP's function queryPacket",
MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
}//end catch
__finally
{
myReader->Close(); //this is where the first 2 errors are generated
myOracleConnection->Close(); //and the second 2
}//end finally
I'm hoping this is something small that I've overlooked, possibly in my declarations?
Also, It It's not too much to ask, How do you create a 1-dimensional array of objects in the 2005 syntax (I just switched over from 2003 and trackable ^ pointers are a bit fuzzy to me.
All suggestions are appreciated.
Thanks!
|
|
|
|
|
myReader and myOracleConnection go out of scope at the end of the try block. Declare them outside the try block.
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
cpp_and_asm wrote: How do you create a 1-dimensional array of objects in the 2005 syntax
I think this is it
array<Object^>^ myarray = gcnew array<Object^>(size goes here);
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
Thanks Alot Josh!!
|
|
|
|
|
|
This should do it
for( ;; )
{
cout << "I will not post in the wrong forum" << endl;
}
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
Dammit my solution was the hard way!
|
|
|
|
|
One way:
#if (_MANAGED == 1)
#pragma unmanaged
#endif
TCHAR str[50] = _T("how are you ?");
size_t index = _tcscspn(str, _T("@$#?"));
if (index < _tcslen(str))
else
#if (_MANAGED == 1)
#pragma managed
#endif or
#if (_MANAGED == 1)
#pragma unmanaged
#endif
char str[50] = "how are you ?";
size_t index = strcspn( str, "@$#?");
if (index < strlen(str))
else
#if (_MANAGED == 1)
#pragma managed
#endif
-- modified at 18:34 Monday 5th February, 2007
Fixed so my reply applies to this forum
|
|
|
|
|
As Josh pointed out ( sort of ), this is the C++/CLI forum, you wanted the Visual C++ forum
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
What's the deal with so many new nameless members?
|
|
|
|
|
Nishant Sivakumar wrote: What's the deal with so many new nameless members?
I would suspect it's an invasion of druids... if only their netiquette indicated that. :->
I long for the good old times when everyone introduced themselves with their real name, not the bb41854 -like garbage.
|
|
|
|