|
You posted in the (Managed) C++/CLI forum. I think you want to post this in the Visual C++ / MFC forum. People who can answer your C++ problems don't always come here. So, to better your odds of getting an answer, please post in the Visual C++ / MFC forum.
|
|
|
|
|
Hi every one,
I don't know how can I create wrapper class,wrapper code,.. in C++,if anyone knows please tell me step by step or send me sample code or link for learning.
yours sincerely ,
Orchid
|
|
|
|
|
Normally, you would have the wrapper class in an assembly. Also, I wrote the class methods inline for clarity only. This class CppWrapper is only a simple example. Marshalling can get a little complicated but it is quite easy most of the time. There is a lot of information on the internet about this, especially, written for Visual Managed C++ 2003.
using namespace System;
using namespace System::Runtime::InteropServices;
#include <iostream>
ref class CppWrapper
{
public:
void Print(String ^str)
{
IntPtr ptr = IntPtr::Zero;
try
{
ptr = Marshal::StringToHGlobalUni(str);
std::wcout << static_cast<wchar_t*>(ptr.ToPointer()) << std::endl;
}
catch (Exception ^ex)
{
Console::WriteLine(ex->Message);
}
finally
{
if (ptr != IntPtr::Zero)
Marshal::FreeHGlobal(ptr);
}
}
};
int main(array<System::String ^> ^args)
{
String ^str = L"Hello, World!";
CppWrapper ^wrapper = gcnew CppWrapper;
wrapper->Print(str);
return 0;
}
|
|
|
|
|
Dear George,
Thanks a lot for your help,
The sample code was very useful for me.
thank you again,
yours sincerely ,
Orchid.
|
|
|
|
|
Hello,
I'm a newbie in computer programming.
I'm looking for a program help me to change file attributes(Created time,Modified time and last access) like FileDate By T.YogaRamanan.
Here is link :
http://www.codeproject.com/file/FileDate.asp[^]
But I want to ignore its user interface.(No Dialog box , No Text box)
I want to choose file as coding and change file attribute as coding too.
I have tried to read source code of FileDate above.
I still can't do.
Can you help me ?
Thank you.
|
|
|
|
|
Well, the article, http://www.codeproject.com/file/FileDate.asp[^], was written in unmanaged C++ using MFC/Win32. So, is your question directed toward unmanaged C++ (then, you are in the wrong forum) or C++/CLI (Managed C++)?
|
|
|
|
|
toeh wrote: But I want to ignore its user interface.(No Dialog box , No Text box)
Then what is the problem.
U have to just take/use
int SetFileDateTime(char *szFilePath,
FILETIME ftCreated,
FILETIME ftModified,
FILETIME ftAccessed)
just copy that function or call that directly from ur module.
regards,
Divyang Mithaiwala
System Engineer & Software Engineer
|
|
|
|
|
Hi,
My name is aditya. i am a BE student in mechanical engg. now one of the subject that i have is CAME(Computer application in mechanical engg.). So i have C++ papers in which some typical questions are asked. if u could please post me the solutions to these problems it will be greatful.
1.Use concept of operator overloading to add or multiply 4*4 matrix of user inputs.
2.Use class matrix to read store display and perform multiplication operation between 2D matrix size user defined. Use 'new' and 'del' operator for creating and destroying matrix objects.
3.To draw a line of user defined length. using 'inheritance' show modification in this code to draw a rectangle of user defined dimensions.
4.A small calculator which performs +,-,*,/, and displays results only ater = key is pressed. Also displays the answer in scientific notation.
Pls i beg u to solve this problem.
My email id is- ads99free@yahoo.co.in
I need these solutions by saturday.i.e.18th november.
|
|
|
|
|
I suggest you hire a tutor, bud. I and many others aren't going to do your homework.
|
|
|
|
|
Dude, if you're not smart enough to ask in the right forum, and you're not smart enough to try and do your own homework, then perhaps you just need to apply at burger king.
|
|
|
|
|
If you get people to do your work for you, how do you expect to find a job when/if you graduate. That's the whole point of getting your degree right? To find a job?
You need so show some work on your own behalf before people asre willing to help you out.
|
|
|
|
|
hi Everybody
i planned to do soft in Borland C++
and i need to take information from Sound Card
and i've problem in findin appropriate object(component) which enables me to take info from Sound Card
please help
thanks..
Nurbek
|
|
|
|
|
You are in the wrong forum! (Managed) C++/CLI questions are welcomed!
|
|
|
|
|
so to which forum should i've written...
|
|
|
|
|
Actually, there is no general C++ forum here. IMHO, the Visual C++/ MFC forum would be your best bet since some developers may have had some experience with Borland. Otherwise, does Borland have message boards?
|
|
|
|
|
I have a service app skeleton created by the app wiz.
I'm a vc6 mFC guy, so i cudn't really figure out how a service's flow is.
MFC CWinApp::ExitInstance is called only after m_pMainWnd is closed. But for a service, After OnStart what happens? OnStop is invoked only when the service is stoped by the service manager? where am i to write my code? do we have a message loop or anything of the sort? idleprocessing?
pls tip me on these areas
thanks
snexxxxt
|
|
|
|
|
|
Hi everyone,
I created a project in VC++ (Class Library project in visual studio 2005) and I would like to use it in VB .
I defined 2 functions in classlibrary that one of them uses simple data type such as int,bool,.. in input and return value and other one uses data type such as char * .
When I use simple data type ,there is not any problem and I can call the function in vb successfully but when I use another data type such as (char * ,..)I can not call it and even I can not see the function in vb.
My question is about data type conversion between VC++ and VB.
My code is same as below :
//==============================
MyClassLibrary.h
#pragma once
using namespace System;
namespace MyClassLibrary{
public ref class InitCard
{
public :
bool VerifyPin(char *) ; //I can not see this function in VB
bool SetCardAccessKey(int); //I can see and use this function in VB successfully .
};
}
//======================My VB code is same as below :
Imports MyClassLibrary
Dim Jvm_offcard As New MyClassLibrary.InitCard
Jvm_offcard.SetCardAccessKey(2);
//Jvm_offcard.VerifyPin("1234") //there is an error on this line
I would like to know how can I use data type such as (char *,byte array ,string) between VC++ and VB code.
I would appreciate for any help .
Yours sincerely,
Orchid
|
|
|
|
|
char * is an unmanaged data type. Thus, VB.NET will not see it. You can use char * in C++/CLI because it was designed to handle unmanaged code. If you want to use char * with VB.NET, you will have to wrap the code and use marshalling with C++/CLI to bridge the managed and unmanaged worlds.
|
|
|
|
|
Dear George,
Thanks a lot for your guide,
If you have any document ,sample code or link about "use of marshalling with C++/CLI",please inform me, because I am new in marshalling subject.
yours sincerely ,
Orchid.
|
|
|
|
|
|
Dear George,
Thanks a lot for your help,
The sample code was very useful for me.
thank you again,
yours sincerely ,
Orchid.
|
|
|
|
|
I am have a sample Thread on a Windows Form Project. I have a button that Starts a Thread and does a simple loop. The loop is in located in a header file but i want it to update a a progressbar in form1. I understand i would need a delegate in form1 to update the progressbar but calling that delegate in form1 is what i am having problems with. Below is the entire Header.
#pragma once
#include "Form1.h"
namespace NamespaceThread
{
using namespace System;
ref class ThreadClass
{
public:
static void MyThread();
};
void ThreadClass::MyThread()
{
for (int i = 0; i <= 100; i++)
{
}
}
}
in form1.h i have a delegate like below
delegate void ProgressStep(int i) and below the method that should update the progressBar
public:
void ProgressStep(int i)
{
progressBar1->Value = i;
}
Could someone help me out on how to pass the value i to form1.h so i can update the progress bar?
Thanks in advance
-- modified at 13:11 Friday 10th November, 2006
-- modified at 16:31 Friday 10th November, 2006
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Any Idea's Guys?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|