|
how to convert tchar to lpcwstr
|
|
|
|
|
TCHAR is single unit, LPCWSTR would be set of units.
See this[^]
|
|
|
|
|
Dear Friends
I am facing some problems in deploying my application for lower version of qt.
Basically i want to generate scripts for my application and I have chosen pythonqt for this purpose. Pythonqt has the problem with lower version of Qt (Qt 4.5.2) and also with Higher version of Qt (Qt 4.7). So I needed to get another machine where I have installed Qt-4.6.3 with in-built python version 2.6. I am successfully able to generate my application exe and it is running.
But the requirement is that this exe should run on my original machine so I built the application with the static link of Qt4.6.3-static.
My original machine has python2.3 installed.
But I am not able run on original machine. Its giving 3 library linking problem. as below
libpng14.so.14 => not found
libEGL.so.1 => not found
libpython2.6.so.1.0 => not found
I have libpng12 installed in original system......I am keeping the libong14 from my new machine in a local lib folder and exporting LD_LIBRARY_PATH to/the/local/lib but still its not able to find the libpng14
similarly for libpython2.6 I am keeping the libpython2.6 from new machine into the local lib folder. but its not recognizing.
libEGL i dont even know.
Please give me some suggesstions what can be done.
Thanks sujan
|
|
|
|
|
And what does this have to do with "Managed C++/CLI"?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
using namespace System::Runtime::InteropServices;
public ref class CTest
{
public:
static delegate bool Callback(int i);
}
While compliting I get error.
error C2144: syntax error : 'bool' should be preceded by ';'
I would like to use delegate as a callback function and select one of the serval avaliable function.
Please advice. thanks.
|
|
|
|
|
Remove the 'static' keyword - it's the cause of the error (and add a semi-colon after the class closing brace).
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
Thanks a lot it worked.
Basically I need an advice. I am woking in dot net managed C++ . I had a very large switch statement with about 50 cases
now I am refactoring the switch case. putting each case in a function and using a delagate as callback and
main ()
{
switch (ivar)
{
case 1:
{
break;
}
case 1:
{
break;
}
so on
case 50:
{
break
}
}
}
And now I am writing function
void somecode1(int a, int b)
{
somecode 1;
}
void somecode2(int a, int b)
{
somecode 2;
}
void somecode3(int a, int b)
{
somecode 50;
}
static void Parse(int iType)
{
FunList entry = m_FunList[iType];
entry.m_Callback.Invoke();
}
static void Main(string[] args)
{
Init();
i=7
Parse(i);
}
static void Init()
{
}
Can you please correct me if I am doing some thing not correct?
Is there any pattern that suits better?
Thanks
modified on Wednesday, November 24, 2010 11:21 PM
|
|
|
|
|
Folks..
I have created a wrapper project that exports two procedures that I pick up in my Win32 program created in something called Clarion for Windows. The wrapper class calls my C# objects and this works just fine. Problem is that my C# program neads different calls back to my Clarion Win32 program. For instance, my Win32 program has a function to generate new Customer ID's and the complexity of this routine is to much. Becides, I would really like to know if there is a way to do this. The connection between Clarion Win32 and C++ is by using a standard interface decleared in Clarion and passed into the exported function in C++. Problem is that I dont know how to call back to C++
Hers what I have:
Clarion(Win32) <=> C++ => C#
So Clarion can call C++ methods directly through the Interface, and therfor implicit Clarion can call .NET methods through this wrapper. But I nead the other way too.
I was hoping I could pass an Interface from C++ into my C# objects, maybe something like this:
MyNetClass::TakeCppInterface(ThisCppInterface);
I have posted on the MSDN, but only answer I got there was using MSIL or reflection, which i think is way over my head at the moment.
-----------------------------
Speaking nordic language?
Why not visiting irc.c-c.no and join #C# or #VisualBasic
-----------------------------
|
|
|
|
|
You can use a C++/CLI wrapper instead of C++ wrapper so that C++/CLI wrapper can use directly in C#
|
|
|
|
|
Well, isnt that what I allready do
I nead to call back to C++ from the C#
Her's the flow:
Clarion(Win32) Calls C++ method.
C++ then calls C# method.
C# Method calls C++ Method.
C++ Method Calls Clarion(Win32) Method
now, Clarion and C++ can comunisafe over an Interface
C++ and C# communicates through a class
But what can I use to communicate C# to C++ ?
-----------------------------
Speaking nordic language?
Why not visiting irc.c-c.no and join #C# or #VisualBasic
-----------------------------
|
|
|
|
|
can you provide a code snippet
|
|
|
|
|
Well the solution depends on the dependencies between DLL.
Assuming that Clarion is using a DLL with C++/CLI code and that DLL is using a C# DLL, then you would also define an interface in C# DLL that will be implementend by C++ code when calling back into C++.
Delegates or events could also be used in some cases. This is particulary interesting if for each C# method, you already know which (single) method would be called during processing.
Philippe Mori
|
|
|
|
|
Yes. This is what I had in mind..
But I'm not sure how to implement a C# interface in C++. As far as I know, the C# Interface is not C++ compatible becasue C++ actually dont have interfaces (i'm a noob in C++ so this statement is based on things I have read etc.)
-----------------------------
Speaking nordic language?
Why not visiting irc.c-c.no and join #C# or #VisualBasic
-----------------------------
|
|
|
|
|
To implement the interface just derive from it as you would do in C#.
Philippe Mori
|
|
|
|
|
I wil take this under consideration If I reopen the project. As by now, the whole thing is done using a .NET EXE and parameters
-----------------------------
Ole Morten Heien
HD Software / Advisor AS
-----------------------------
|
|
|
|
|
Hi
I am using UnDecorateSymbolName() method get function name and argument data type. but i want actual argument variable name? i try this code like
void ExtractCppSymbol(char *szDecoratedName)
{
char szFunc[512];
if ( UnDecorateSymbolName(szDecoratedName, szFunc, 512, UNDNAME_COMPLETE > 0 ))
{
cout<
|
|
|
|
|
Please do not post the same question in multiple forums. This has already been answered under C++.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi,
In my C++ app I'm recieving callbacks from managed code when some events are raised in a .NET control.
void CGraphControlView::ObjectDoubleClicked(System::Object^ sender, Northwoods::Go::GoObjectEventArgs^ e)
{
TRACE(_T(" Graph object double clicked\n"));
}
- How do I determine if the e->Object is of some class inherited from System::Object e.g. a GraphNode declared as:
public class GraphNode : GoBasicNode
?
/Juri
modified on Saturday, November 20, 2010 11:58 AM
|
|
|
|
|
Call GetType and then check the IsClass property.
|
|
|
|
|
Hi Nish,
I'm more or less a newbe in .NET and C#, could you show an example of how to do that.
Like
if (e->GetType() ..... then what ?
Regards
/Juri
|
|
|
|
|
if(e->Object->GetType()->IsClass)
{
}
|
|
|
|
|
Well if Object is declared as an object, e->Object will always inherit from an object (or be an object or a boxed object).
Do you have any sample of what you are trying to do?
Philippe Mori
|
|
|
|
|
Hi,
i'm working with a itextsharp dll and trying to put a watermark ,but this error of compilation i don't how handled it .
Working in c# is fine but with vc++ 2003 show me Error C2691: 'int __gc[]'
line : iTextSharp::text::pdf::BaseFont *watermarkFont = NULL;
what i should do ?
any ideas please .
private: void WaterMark (String *newPdf,String *PdfIndex,String *TmpPath)
{
iTextSharp::text::pdf::BaseFont *watermarkFont = NULL;
Single watermarkFontSize = 14;
Single watermarkFontOpacity = 0.9;
Single watermarkRotation = 45.0;
String *watermarkText1=NULL;
iTextSharp::text::pdf::PdfReader *reader = NULL;
iTextSharp::text::pdf::PdfStamper *stamper = NULL;
iTextSharp::text::pdf::PdfContentByte *underContent = NULL;
iTextSharp::text::Rectangle *rect = NULL;
iTextSharp::text::pdf::PdfReader *pages = NULL;
try
{
iTextSharp::text::pdf::PdfReader *reader = new iTextSharp::text::pdf::PdfReader(PdfIndex);
int Pages = reader->NumberOfPages;
iTextSharp::text::pdf::PdfStamper *stamper = new iTextSharp::text::pdf::PdfStamper(reader, new System::IO::FileStream(String::Concat(TmpPath,newPdf),System::IO::FileMode::Create));
for (int j = 1; j <= Pages; j++)
{
watermarkText1 = j.ToString();
underContent = stamper->GetOverContent(j);
underContent->BeginText();
watermarkFont = iTextSharp::text::pdf::BaseFont::CreateFont(iTextSharp::text::pdf::BaseFont::HELVETICA, System::Text::Encoding::ASCII->EncodingName , false);
underContent->SetFontAndSize(watermarkFont,6);
underContent->SetColorFill(iTextSharp::text::BaseColor::BLACK);
underContent->ShowTextAligned(iTextSharp::text::pdf::PdfContentByte::ALIGN_CENTER, watermarkText1, 300, 700, 0);
underContent->EndText();
}
stamper->Close();
reader->Close();
}
catch (Exception *ex)
{
throw ex;
}
}
|
|
|
|
|
I am using an old dll which is written in VC6 MFC( Builded with mfc42u.lib), I need to reuse the same in my C++/CLI application which is in VS2008( it use mf90u.lib)
while copying a string buufer to that old dll it cause an exception like "try to read/writing in protected meory"
String^ csMyString = gcnew String( "some value" );
MyClass* fromOldDll = new MyClass();
fromOldDll->m_csSomeString = static_cast<TCHAR*>(Marshal::StringToHGlobalUni(csMyString).ToPointer());
Is any other idea for implementing the same, it is not possible to modify the old dll
Thanks
Radhakrishnan G.
|
|
|
|
|
Unfortunately, you cannot always mix DLLs like that. One solution would be to recompile the old DLL using VC 2008.
|
|
|
|