Hi, i am newbie on VC++ .Net.
i face a problem to convert VC# code to VC++ .Net
--------------------------------------------------------------------------
here is VC# code (Working)
--------------------------------------------------------------------------
class Class1
{
[DllImport("setupapi.dll")]//
public static extern Boolean
SetupDiClassGuidsFromNameA(string ClassN, ref Guid guids, UInt32 ClassNameSize, ref UInt32 ReqSize);
[STAThread]
static void Main(string[] args)
{
UInt32 RequiredSize = 0;
Guid[] guids=new Guid[1];
bool res=SetupDiClassGuidsFromNameA("DiskDrive",ref guids[0],RequiredSize, ref RequiredSize);
}
--------------------------------------------------------------------------
Here is the code that i convert to VC++(no working)
--------------------------------------------------------------------------
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System::Runtime::InteropServices;
using namespace System;
using namespace System::Text;
[DllImportAttribute("setupapi.dll", CharSet=CharSet::Auto)]
extern "C" Boolean
SetupDiClassGuidsFromNameA(String *ClassN, Guid* guids, UInt32 ClassNameSize, unsigned int *ReqSize);
int _tmain()
{
UInt32 RequiredSize = 0;
Guid guids = new Guid[1];
SetupDiClassGuidsFromNameA(S"DiskDrive", guids[0], RequiredSize, &RequiredSize);
Console::WriteLine(RequiredSize.ToString());
return 0;
}
--------------------------------------------------------------------------The Correct behaviour is the RequiredSize should be Greater than 0, but the code that i have convert the RequiredSize always return 0.:wallbash:
can any one help me.
Thank you.
Regards,
bxchan
Help---- VC# to VC++ .Net --- Help
Started by bxchan, Nov 06 2006 01:40 AM
1 reply to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











