The Wayback Machine - https://web.archive.org/web/20090213072108/http://www.codeproject.com:80/script/Forums/View.aspx?fid=3785
Click here to Skip to main content
5,885,486 members and growing! (21,124 online)
Announcements
* Bold indicates new messages since 21:21 12 Feb '09




BullFrog Power
Advanced Search
Sitemap

Managed C++/CLI


Home > Forums > Managed C++/CLI

 Msgs 1 to 25 of 300 (Total in Forum: 11,562) (Refresh)FirstPrevNext
AdminThe C++ / CLI is for managed and mixed-mode C++ programming onlyadminChris Maunder10:36 9 Jan '06  
This message board is for managed and mixed-mode C++ programming only: Managed C++ in VC++.NET or C++/CLI in VC++ 2005. Please post all standard C++ programming questions in the Visual C++ board[^].

cheers,
Chris Maunder
CodeProject.com : C++ MVP

QuestionFinding and mapping audio devices in windowsmembergurindersm2hrs 6mins ago 
Hello All

I have two USB audio devices attached to the system. Using API's "SetupDiEnumDeviceInterfaces" and "SetupDiGetDeviceInterfaceDetail" I am able to figure out their unique device paths which is in this format
"\\?\hid#vid&pid&col02#7&1bca1430e&0&0001#{some id}"
"\\?\hid#vid&pid&col02#7&3db23aebe&0&0001#{some id}"

Also on using the API "waveInGetDevCaps" I am able to find out the unique strings the system is using to identify this device which are "USB Headset" and "USB Headset (2)", my question is how can i know from my application which "USB Headset" is linked to the which of the above mentioned path. Or is there a way to map the audio devices listed in “Sound and Audio Devices” settings with the actual hardware programmatically.

Any input is greatly appreciated.

OS (2000, XP, Vista), VS2005 ( VC++ IJW )

Thanks
gsm
QuestionExposing a property of a nested class to .Net VB, C# etc.memberstempsoft7hrs 58mins ago 
I have a nested managed class and I would like to expose the properties of the nested class to C# and VB. How do I do this?



In the following C++ managed class, I can see all of the properties of FitnessUserProfile in VB. I can see the Activity class within the FitnessUserProfile object in VB but I can't see any FitnessUserProfile.Activity properties.

What am I doing wrong?



I am using Visual Studio 2005.



namespace GarXface
{


public ref class FitnessUserProfile : public ICloneable
{

public:

property unsigned BirthDay
{
void set(unsigned day)
{
m_pProfile->SetBirthDay(day);
}

unsigned get()
{
return m_pProfile->GetBirthDay();
}
}


ref class Activity : public ICloneable {
internal:

Activity(void);

public:

property float MaxHeartRate
{
void set(float heartRate)
{

}

float get()
{

}

}






AnswerRe: Exposing a property of a nested class to .Net VB, C# etc.mvpN a v a n e e t h6hrs 18mins ago 
stempsoft wrote:
ref class Activity


Make the nested class public. So it can be accessed by FitnessUserProfile::Activity . BTW, why are you exposing nested class?

Smile


GeneralRe: Exposing a property of a nested class to .Net VB, C# etc.memberstempsoft5hrs 1 min ago 
Thanks but I have it working now. Not sure what I was doing wrong before.


And why wouldn't I expose a nested class? Activity is only useful within FitnessUserProfile.

Oh and you advice was wrong it generates an error:

Help file says the following:

When applied to a managed type, such as class or struct, the public and private keywords indicate whether the class will be exposed through assembly metadata. public or private cannot be applied to a nested class, which will inherit the assembly access of the enclosing class.

When used with /clr, the ref and value keywords indicate that a class is managed (see Classes and Structs (Managed)).
GeneralRe: Exposing a property of a nested class to .Net VB, C# etc.mvpN a v a n e e t h3hrs 54mins ago 
stempsoft wrote:
Oh and you advice was wrong it generates an error:


Then you are doing it incorrectly. See the following code which will execute without any errors. It show how a method declared in nested class is accessed from outside.
public ref class Outer
{
public:
ref class Inner
{
public:
void SayHello()
{
Console::WriteLine("Hi from inner");
}
};
};
You use it like
Outer::Inner^ inner = gcnew Outer::Inner();
inner->SayHello();
Does that help? Smile


Questionwhich is the best method to send data to clients, without a request from clientmembernaveen_bij21hrs 45mins ago 
i am developing a application which has got a admin module and a user module, admin module will be running on only one machine, but the user modules will be running on multiple systems. i have got some settings to be done in admin module and the same settings should be used by user module also, how to get the settings in the user module from the admin machine. whenever any settings are changed in admin module all the user modules should get the new settings.

Naveen

AnswerRe: which is the best method to send data to clients, without a request from clientmvpled mike15hrs 40mins ago 
naveen_bij wrote:
which is the best method to send data to clients, without a request from client


If the clients are not going to make a request then they have to listen or poll for the data. It's not the best method, it's the only method left after you eliminate requesting data. Essentially there is little difference between the two.
GeneralRe: which is the best method to send data to clients, without a request from clientmembernaveen_bij2hrs 16mins ago 
thanks for your response.
so i have to write a listener event in my application. Currently i don't know how to do it, but will try to do that and if any problems will get back for your help

Naveen

GeneralRe: which is the best method to send data to clients, without a request from clientmvpLuc Pattyn15hrs 34mins ago 
Hi,

I wouldn't try and push the data from server to client; just have one of these:
- have the client ask whether new admin data is available at the start of a new session;
- or have the server respond with a specific error code rather than real data whenever it feels the
client should get new admin data first.

Smile

Luc Pattyn [Forum Guidelines] [My Articles]

- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


GeneralRe: which is the best method to send data to clients, without a request from clientmembernaveen_bij1 hr 50mins ago 
thank you sir,
i thought of using UDP multicasting, where all the clients join a group and server sends a datagram to that group. so i will send a error code to the group stating that new settings are available, when the user modules receive this message they have to complete and stop all the other processes and get the new settings, because the settings are used in other processes.
can u please guide me how to do it in a better way

Naveen

QuestionAssenbly referencing problemmemberKASR120:00 11 Feb '09  
I am new to C++/CLI.
Tried to reference a dll from VC++ project with Common Language Runtime Support (/clr).

I am getting the below error message when running application.

"An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module."

What could be the problem?
AnswerRe: Assenbly referencing problemmvpled mike15hrs 52mins ago 
KASR1 wrote:
I am new to C++/CLI.


What else are you new to, programming?

KASR1 wrote:
"An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module."

What could be the problem?


Yes indeed, what could be the problem, try clicking on this link[^]
GeneralRe: Assenbly referencing problemmemberKASR11 hr 56mins ago 
Are you making fun!
I have tried searching Google and most of them were not specific to my problem.
So we posted it here.

For getting quick solution only we are posting here. Not to make fun!

Kindly give us the solution if you know or dont post a reply like this!
Questionplease help me to work folderbrowser dialog in asp.netmembersivasampathkumar23:09 10 Feb '09  
I am working on asp.net using c#
I am working on folderbrowserdialog I got an exception
>"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process."

AnswerRe: please help me to work folderbrowser dialog in asp.netmemberGeorge L. Jackson9:11 11 Feb '09  
This is the "Managed C++/CLI" forum! Please post this question in the ASP.NET or C# forum.

"We make a living by what we get, we make a life by what we give." --Winston Churchill

QuestionDeclare an array of structures containing an array into a Form's class.memberchaloens6:46 10 Feb '09  
Hello,

I'm totally new on Managed C++ and I'm creating an VS2005 C++ application on which I need to keep information for logging purposes.

The data I need to store would have been saved in the old days in a structure like this:

struct tDataEntry
{
unsigned char data[8];
long id;
unsigned int length;
unsigned int flags;
unsigned long time;
};


Being a newbie on this I immediately started getting compiler errors like "cannot define 'xxx' as a member of managed 'XXX': mixed types are not supported", so I read a little bit about Managed Code, Mixed types, the GC, etc and I searched the web for an example that could help me out but couldn't find it.

I found some articles that were close to my problem where they suggested using templates to embed a native class in a ref class but when I added the extra complexity of the arrays it just didn't work.

Anyway, I need to be able to declare a fixed size tDataEntry array in my Form class so I can fill the elements, format the information, show it, etc.

Any help on this will be appreciated! Smile

Thanks,
Chalo
AnswerRe: Declare an array of structures containing an array into a Form's class.mvpMark Salsbery7:26 10 Feb '09  
chaloens wrote:
I read a little bit about Managed Code


It may help to read a little bit more...

Visual C++: .NET Programming Guide[^]

.NET Framework Programming[^]


For your specific question...

.NET Framework Equivalents to C++ Native Types[^]

array (Visual C++)[^]

Mark Salsbery
Microsoft MVP - Visual C++

Java

GeneralRe: Declare an array of structures containing an array into a Form's class.mvpled mike7:57 10 Feb '09  
Mark Salsbery wrote:
It may help to read a little bit more


NO WAY! We write code! We don't need no stinkin readin!
QuestionC++/CLI Beginner QuestionsmemberTripShock4:07 10 Feb '09  

ref class A
{
...
};

int main()
{
A objA;

return 0;
}


I thought we were not supposed to be able to use ref classes that way...only through tracking handles and tracking references. The above code compiles and runs. Could someone please explain it to me?
AnswerRe: C++/CLI Beginner Questionsmvpled mike5:33 10 Feb '09  
TripShock wrote:
Could someone please explain it to me?


They implemented stack semantics[^] in C++/CLI
GeneralRe: C++/CLI Beginner QuestionsmemberTripShock6:20 10 Feb '09  
Why is it that I can't do this:


String yo;

GeneralRe: C++/CLI Beginner QuestionsmvpMark Salsbery6:58 10 Feb '09  
From the docs[^]:


The following reference types are not available for use with stack semantics:
*delegate
*array (Visual C++)
*String


Mark Salsbery
Microsoft MVP - Visual C++

Java

GeneralRe: C++/CLI Beginner Questionsmvpled mike7:03 10 Feb '09  
Welcome to CodeProject Beer

TripShock wrote:
Why is it that I can't do this:


Because you need to do this:

String^ yo;


That said, if you had spent like 10 minutes reading any of the tons of beginner material here on this site and all over the internet related to the CLI subject, you would already know that. 10 minutes rather than the 3 hours you have waited for an answer from an internet forum.

10 minutes or 3 hours, you decide.
QuestionAdvice for remote dabase....memberThilek1:31 10 Feb '09  
hi guys,

i am creating a VC++ program that connect to mysql database on remote server.i have tried few steps but it didnt work.i need advice on which database i should use and it must be in a remore location.

i create a mysql database on speedhosting.co.cc but its a database for php. Is it possible for a C++ program connect to it and get data from there ??

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Last Updated 9 Aug 2007
Web18 | Advertise | Privacy
Copyright © CodeProject, 1999-2009
All Rights Reserved. Terms of Use