|
Which project template and project type u selected ?
|
|
|
|
|
It is Visual C++ /Smart Device /MFC Smart Device Application and WTL ATL/WTL Application Wizard for Windows CE.
?
|
|
|
|
|
So I think C++/CLI is not supported for Smart Device, I can't find any information about this possibility
@+
|
|
|
|
|
It looks like the case. But under C# category, VS 2005 supports a few Device project templates. I can't figure out why there is no C+/CLI support for Device development.
Best,
Jun
|
|
|
|
|
I got an answer from Microsoft about C++/CLI for Smart Device :
There are no plans for C++/CLI on devices. Native C/C++ plus P/Invoke/COM can be used to interop with legacy C/C++ code.
|
|
|
|
|
Thanks for the heads-up.
Best,
Jun
|
|
|
|
|
I'm trying to create a .dll using ATL, which I want use in C#.
Can anybody please guide me to create a simple method / function which takes string in input parameters and returns the same(string)..
I tried a lot but always faced problem of returing string back to calling function in C#.
I did the same with C++ class library successfully but when it comes to ATL its not the same.
As I'm using other SDK API's in creation of .dll and I can't go with Class Library its having problem with "CLR and MTd". Which can't go together. Finally I decided to stick to ATL.
Now please guide me to create the methods which I can use in C# to get the string value.
Arun
|
|
|
|
|
Use the below signature for the COM method. Then use RCW to call this method from .Net
[id(1)] HRESULT ReturnString([in,out] BSTR stringValue);
cheers....MIlton KB
|
|
|
|
|
I have a 3th party dll writen in C. I have no problem calling most functions in the dll from the managed code. But there is a function that take a function pointer for setting a callback function that I am having problems with.
I have the following code:
First in a wrapper class
[DllImport("w32dll.dll")]
static void dllSetCallFp( void (*aFp)(void*) );
Then in seperate class.
delegate void funDelegate(void*);
typedef void (__cdecl *FUNPT)(void*);
funDelegate ^ fp = gcnew funDelegate(MFun);
pin_ptr<funDelegate^> pp = &fp;
IntPtr ip = Marshal::GetFunctionPointerForDelegate(fp);
FUNPT cb = static_cast<FUNPT>(ip.ToPointer());
Wrapper::dllSetCallFp(cb);
MFun is just a test function.
void Client::MFun(void* pV)
{
int i = 9;
}
The problem is I can debug into the calling of MFun but when I return I get the following errors
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
Then
'FatalExecutionEngineError'
Can anyone help me with this?
-Thanks
|
|
|
|
|
Just a thought. Is it possible to use a function pointer directly, instead of marshalling from a delegate?
Best,
Jun
|
|
|
|
|
Multidimension arrays
Read dozens of examples given on website how to do an single array with
the System::Array etc. But I can't get the hang of it how to use it properly.
I keep getting error messages when I hit the build button.
For example I want a simple 2 dimension array of the integer type.
in the old code it was:
int board[16][16];
board[3][3] = 5;
if i try to use the managed version:
array<int^,2>^ m_Board = gcnew array<int^,2>(16,16);
for (int row = 0; row < 16;row++)
{
for (int col = 0; col < 16;col++)
{
m_Board[row][col] = 0;
}
}
I get error message on my screen.
Also I can't find anything about freeing the memory in the articles.
Is it neccessary if you use it in a class.
How do I free it if it's necessary?
Can I change the size of the area dynamically?
"Knowledge shouldn't be preserved by one, but shared with others."
-- Preminition
|
|
|
|
|
|
|
I'm having a problem using the DataGrid/DataGridView within a MFC dialog (using the CWinFormsControl< > template).
I create a DataSet from a Xml file and then set it to the DataSource. I also set the DataMember to the appropriate table name, but nothing is displayed in the grid view. I tried other various approaches, but nothing seems to work.
I have no problem setting this up in WinForms - it won't work in MFC. I know the data's there because I can actually step right into it from the DataGrid object (debugger) - it just won't display - the ColumnCount is still 0.
What's the problem? Has anyone else experienced this?
|
|
|
|
|
PlayerBalance is a String Data Type
Bet is a Int32 Data Type
I use this Conversation method
Bet = System::Int32::Parse(PlayerBalance); //Its OK
But This code not work; //error C2865: '<' : illegal comparison for handle type
if(Bet < 200)
{
MessageBox:Show("OK");
}
Best Regards...
|
|
|
|
|
Hi,
Int32 is a value class, you probably used ^ there.
Int32 Bet; // should be fine
regards Tobias
|
|
|
|
|
SOLUTION
Bet = System::Int32::Parse(PlayerBalance); OK
if(*Bet > 5) //Must be use *
{
MessageBox::Show("OK");
}
Thank you 2bee
Best Regards....
|
|
|
|
|
How to Create Array of Labels on the Run-Time ?
Best Regards...
|
|
|
|
|
Hello,
if you mean with "Label" a System::Windows::Forms::Label control
then you could use this snippet:
// an array of 10 Labels
array<Label^> myLabelArray = gcnew array<Label^>(10);
regards Tobias
|
|
|
|
|
I try but error occur
error C3149: 'cli::array<type>' : cannot use this type here without a top-level '^'
|
|
|
|
|
Sorry my fault, my thoughts were faster than my fingers:
(I forgot the '^' hat operator which classifies myLabelArray as a reference type)
array<Label^>^ myLabelArray = gcnew array<Label^>(10);
Tobias
|
|
|
|
|
Thanks your help.
array<label^>^ myLabelArray = gcnew array<label^>(10); //Its work But
myLabelArray[0]->Location = Point(100,100); //NOT WORK
|
|
|
|
|
Hi,
maybe my first statement lead you in the wrong direction.
array<Label^>^ myLabelArray = gcnew array<Label^>(10);
This line just creates an array with 10 references of the type Label.
A reference type is implicitly initialized with a nullptr, thus myLabelArray[0]->Location = Point(100,100); will not work unless you initialize it first.
// will work
lab[0] = gcnew Label();
lab[0]->Location = Point(10,10);
You should also use try-catch to catch exceptions that possibly occur.
regards Tobias
|
|
|
|
|
No Error Occur But I Can't See Label on the Form
array<label^>^ myLabelArray = gcnew array<label^>(10);
myLabelArray[0] = gcnew Label();
myLabelArray[0]->AutoSize = true;
myLabelArray[0]->Location = System::Drawing::Point(100, 10);
myLabelArray[0]->Name = L"lblX";
myLabelArray[0]->Size = System::Drawing::Size(63, 13);
myLabelArray[0]->Text = "HELLO";
myLabelArray[0]->TabIndex = 50;
myLabelArray[0]->Visible = true;
Best Regards
|
|
|
|
|
Hi,
you forgot to add the label to the form.
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
array<Label^>^ myLabelArray = gcnew array<Label^>(10);
myLabelArray[0] = gcnew Label();
myLabelArray[0]->AutoSize = true;
myLabelArray[0]->Location = System::Drawing::Point(100, 10);
myLabelArray[0]->Name = L"lblX";
myLabelArray[0]->Size = System::Drawing::Size(63, 13);
myLabelArray[0]->Text = "HELLO";
myLabelArray[0]->TabIndex = 50;
myLabelArray[0]->Visible = true;
this->Controls->Add(myLabelArray[0]);
}
};
regards Tobias
|
|
|
|