From: Arif Ali Saiyed on
Hi All,
I was tring to create some dialogs with basic windows
controls like tabs,checkbox, picture control, buttons, URL links
etc....

I discovered that's it's very time copnsuming doing it pure Win32
way ... then I thought of exploring other technology/apps...

Delphi/ MFC/.NET

I discovered creating forms using .NET is very easy it's almost like
VB...where you just design what you want and code gets generated.....

In VS2008 I created a New Project-> Visual C++-> CLR ->Windows Form
Application .... and it worked fine

Now I wanted to create a ..NET DLL which would hold my all
dialogs ...provide some exported helper functions to invoke them from
pure Win32 Application or DLL

I created New Project-> Visual C++-> CLR ->Windows Form Control
Library.....

which does generate a DLL ...but I am not able to export any
function from this DLL
when I try to export any function

I get following two error

error C3389: __declspec(dllexport) cannot be used with /clr:pure or /
clr:safe
error C3395: 'myfunction' : __declspec(dllexport) cannot be applied to
a function with the __clrcall calling convention


how do i get of rid of this i went to propject properties and tried if
i could remove those flag /clr:pure and /clr:safe
but i could not find any option there....


I also want to used some exported structure ( which contain only
member variable and no functions)
of Win32 DLL...

This was first time ever i used .NET ..
Any URLs to learn how to do what i want to do , would be really
helpful....

Thanking you all in advance
-Arif
From: Fred on

"Arif Ali Saiyed" <arif.ali.syed(a)gmail.com> a �crit dans le message de news:
fda1bf43-6e93-4a94-99b0-e2877f6220dc(a)m3g2000yqf.googlegroups.com...
> Hi All,
> I was tring to create some dialogs with basic windows
> controls like tabs,checkbox, picture control, buttons, URL links
> etc....
>
> I discovered that's it's very time copnsuming doing it pure Win32
> way ... then I thought of exploring other technology/apps...

It's very simple with the VS Dlg Editor
(it's also not difficult with CreateWindow() calls..)


From: Arif Ali Saiyed on
Thanks Fred....
I converted my Win32 dll written in C++ to .net using /clr switch....

I added the tnew forms (I think It's same as you do form C#) ....

but now my problem was I wanted to use some Win32 DLLs written in C+
+..

I chose to use p?Invoke for it....
I am successfully able to invoke functions in Win32 DLL....

but now I am facing problem with Types....

I called following three native functions in my managed code

int function1(void);
bool function2(void);
wchar_t *function3(void);


when using the function1 , i am getting correct return value ...but
when using function2... I am always getting return value as true... i
had put a break point in function2 and i see that when it returns
false ...even then ...in managed code it is received as ... .true....

and about function3, that's also not working if I am returning say
L"Test"
and in managed code when i received it as String^ i just get "T"...


this how i have delcared native functions mentioned above in my
managed code

[System::Runtime::InteropServices::DllImportAttribute
("SystemHook.dll")]
static bool function2(void);

[System::Runtime::InteropServices::DllImportAttribute
("SystemHook.dll")]
static int function1(void);

[System::Runtime::InteropServices::DllImportAttribute
("SystemHook.dll")]
static String^ function3(void);


and this is how I am using them...

Boolean result = function2(); // here it self i can
see result is always true....
int iRes = function1();
this->checkBox6->Checked =result;

this->Text = function3(); //setting the
dialog's title