|
Can i not get ipaddress & system name in C? I know how to get this info in VC++,but that code is not running in C.The dll's are not compatible with C compiler. So please tell me how to use that code in C?
Thanks
|
|
|
|
|
pan_angel wrote: Can i not get ipaddress & system name in C? I know how to get this info in VC++,but that code is not running in C.The dll's are not compatible with C compiler. So please tell me how to use that code in C?
This forum is for C++/CLI questions. For general C and C++ questions, ask in the Visual C++ forum.
|
|
|
|
|
Hi,
I have a problem using directshow's filter graph and I could not find the answer on the internet. In my code I create a filter graph for rendering video files with audio components. I create the filters automatically using the RenderFile() function. I want to insert another filter just before the video renderer filter in order to process the video component of the file. Since i use the code for different kinds of video files I cannot find the renderer filter using its name.
For the files without audio, I enumerate the filters and I check for the output pins of the filters one by one. For the filter with no output pin I understand that its the video renderer filter, so i disconnect it and insert my OpenCV ProxyTrans filter. However, for the video files with audio I don't know how to find the video renderer file. In the method I mentioned above it is possible to find the audio renderer filter as well. Could you please help me on this? I would appreciate if you explain your solution with on of two lines of codes. Since I am a beginner in DirectShow it sometimes gets difficult for me to implement the suggestions of the expert people.
Thank you in advance.
Emrah
|
|
|
|
|
You're using C++/CLI, or are you in the wrong forum ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi, is there a way to call unmanaged C++ code from a managed C# application?
C# Application source code is available to my work-mate.(Managed)
C++ DLL source code is NOT available to my work-mate.(Unmanaged)
C#/(unmanaged)DLL application(s) often lockup.
Is there a way to prevent or mitigate this? A 'patch' if you will?
I've never seen the code my work mate is refering to...they've asked me to check on this problem they are having.
Thanks in advance.
|
|
|
|
|
Like2Byte wrote: is there a way to call unmanaged C++ code from a managed C# application?
http://pinvoke.net/[^]
led mike
|
|
|
|
|
Hey, thanks for this. I'll pass this along as well as use the tips from this page, too.
|
|
|
|
|
I wanted to add a property to my application that would be displayed as a list by the IDE. An example of one (that exists) would be the border style of a TextBox.
As is often the case, the example in the help are for trivial types, such as 'int'.
The best I've come up with (so far) is to use a StringCollection. This not only doesn't look the same, bringing up the collections editor, but supplies no way for the application to determine what the item was selected. For all practical purposes, this is useless.
The data type(s) of those that exist suggest they are either of a class, a structure, or an enumeration type, but I've frazzled myself trying to determine how to set-up/use any of these for the purpose of declaring any get_xxx and set_xxx methods.
It's clearly do-able, since MS is doing it, but, how?
Thanks;
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
|
|
|
|
|
I wish to call multiple forms using the same object (Form1 called multiple times). I need to transfer specific data to a specific instance of Form1. How do I setup an array for Form1 and assign the data to the instance of the form.
Data[1] -> Form1[1]
Data[2] -> Form1[2]
Data[3] -> Form1[3]
etc.
Can anyone help me with this problem your help will be greatly appreciated, thanks in advance.
Michael
|
|
|
|
|
List<form1> forms = gcnew List<form1>()
something like that.
But it would be better to create a setup where there are mappings whereby each form has meaning beyond an index. Not naming them Form1 would also help make your code self documenting.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I would not know the name of the form until the time I would send it data. Is there a way I could name each form as each instance is created.
Michael
|
|
|
|
|
I have been using the debugger for a while now, but that did not help me much. I tested the code below:
double endTime = 0.0;
System::DateTime startTime = System::DateTime::Now;
int lower = -1000;
int upper = 1000;
int totalNumberOfCalculations = (upper-(lower-1))*(upper-(lower-1));
array<Calculation^>^ calculations = gcnew array<Calculation^>(totalNumberOfCalculations);
int i = lower;
int j = lower;
int arrayIndex = 0;
while(i <= upper)
{
while(j <= upper)
{
calculations[arrayIndex] = gcnew Calculation(i, Calculation::SUBTRACTION, j);
arrayIndex++;
j++;
}
j=lower;
i++;
}
System::TimeSpan elapsedTime = System::DateTime::Now - startTime;
endTime = elapsedTime.TotalSeconds;
double newEndTime = endTime;
First a question about the code and debugger: I put breakpoints at the start and end of this code. And then I put a watch on the variable endTime to se the time it took to run the code. The problem is that the variable had the value of 0.0000000000 until i added the final row of code "double newEndTime = endTime;". Why is that?? Do I have to use a variable's value to se the value??
I tested the above code and it took about 1.5 seconds to run on my computer. When I changed the lower and upper values to -5000 and 5000 the computer got hung up. And when I changed the lower and upper values to -10000 and 10000 I got this message:
"An unhandled exception of type 'System.OutOfMemoryException' occurred"
Does this mean that my computer can not generate all calculations between -10000 and 10000 (like: 10000 - 7893, -8512 - 2113, 9875 - 3213 and so on...)??
I would have hoped for my application to being able to generate calculations up to at least 100 000 and maybe up to 1 000 000.
If it is to any help for you, my computer specifications are:
AMD Athlon XP 2200+ 1.80 GHz
512 MB RAM
Under given circumstances; is my computer to slow or is there a bug in my code??
best regards, Andreas
|
|
|
|
|
Hi people, im trying to capture a single image from a USB webcam then use the data in a c++ program i am using, now Im led to believe i might need to use the WIA (Windows Image Aquisition) API to connect to the camera.
Im fairly inexperienced with COM stuff so my question is:
Im trying to run some of the examples i have seen on various sites on using the WIA API, when i access a COM object do i need to include any particular files or should my compiler know already what i am doing?!?
If anyone knows of a better way to get at the image data id LOVE to know
My environment is: Compiling straight C++ with g++ using Cygwin, on Windows XP (SP2). The camera is installed and works no problems in things like TWAIN (in PSP) and MSN messenger etc...
|
|
|
|
|
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.
|
|
|
|