|
if i creat an application of mfc dll and i want to use its classes in c# how will i use it?
plz tell complete steps
may i have to use /clr option in mfc dll application if yes why?
may i haye to write mfc code in between namespace braces
namespace mfcdll
{
}
am i right?
r00d0034@yahoo.com
|
|
|
|
|
|
Hi Nish,
I am new to programming and have never
heard of a __gc wrapper?
Could you tell how I can find out more about
__gc wrappers?
Thanks
|
|
|
|
|
|
can u tell me how to wrep csocket class ?
plz nish
r00d0034@yahoo.com
|
|
|
|
|
You don't need to wrap CSocket. Here is how you can use CSocket in an MC++ application using IJW
AfxSocketInit();
CSocket s;
s.Create();
String* cmd = "GET /\r\n\r\n";
String* url = "www.google.com";
if(s.Connect((CString)url,80))
{
s.Send((CString)cmd,cmd->Length);
char buf[127];
while(int n = s.Receive(buf,128))
{
buf[n]=0;
System::Console::WriteLine(buf);
}
}
s.Close();
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
if u could tell that if i want to inherit a class from csocket that might be c# class how to do it ?
relpy in the same way plz sketch a little code for that.
thanks for above code you dont imagine how much it solve mine promblem.
r00d0034@yahoo.com
|
|
|
|
|
SIR,
I dont know how to use csocket class in managed code.
any bode can help me.
plz read this code clearly and
namespace mfcdll
{
class CListeningSocket : public CSocket
{
public:
CListeningSocket(){}
virtual ~CListeningSocket(void){}
//{{AFX_VIRTUAL(CListeningSocket)
public:
virtual void OnAccept(int nErrorCode);
//}}AFX_VIRTUAL
// Generated message map functions
//{{AFX_MSG(CListeningSocket)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
};
//***********************************************
public __gc class M_listeningsocket
{
public:
M_listeningsocket();
~M_listeningsocket(void);
CListeningSocket *ptr3;
//{{AFX_VIRTUAL(M_listeningsocket)
public:
virtual void OnAccept(int nErrorCode);
//}}AFX_VIRTUAL
void Create(UINT port);
bool Listen(void);
};
}
//********************************************************
///file name (m_listeningsocket.cpp)
M_listeningsocket::M_listeningsocket()
{
ptr3=new CListeningSocket( );
}
M_listeningsocket::~M_listeningsocket(void)
{
delete ptr3;
}
void mfcdll::M_listeningsocket::OnAccept(int nErrorCode)
{
ptr3->OnAccept(nErrorCode);
}
void mfcdll::M_listeningsocket::Create(UINT port)
{
if(ptr3->Create(port))
MessageBox(0,"create succ....",0,0);
else
MessageBox(0,"create not succge....",0,0);
}
bool mfcdll::M_listeningsocket::Listen(void)
{
if(ptr3->Listen())
{
MessageBox(0,"Listen succ....",0,0);
return true;
}
else
{
MessageBox(0,"Listen not succ....",0,0);
return false;
}
}
//********************************************************
if(ptr3->Create(port))
i dont know why it return false in above line what is mistake in the above code can any body tell me i will be very thank full to u.
r00d0034@yahoo.com
|
|
|
|
|
when i use csocket class in manged code
like
CSocket *ptr=new CSocket();
but when i execute if(ptr->Create(port)) it return false.i did not know why it return false can any body tell me i will be very thank full to u.
r00d0034@yahoo.com
|
|
|
|
|
|
when i use csocket class in manged code
like
CSocket *ptr=new CSocket();
but when i execute if(ptr->Create(port)) it return false.i did not know why it return false can any body tell me i will be very thank full to u.
r00d0034@yahoo.com
|
|
|
|
|
Hi,
I had posted this earlier here, but got no response.
I am trying my luck again (by changing the Subject Line...;))
I have a User Control (created using Man C++)
When I try to place this Control on a form, the Form Designer throws an Exception( 0x80131019).
And I am not allowed to place the control on the form.
This happens when the CopyLocal Property of the Reference is True.
But if I change the CopyLocal property to False,
the Designer wholeheartedly accepts the Conrtrol.
The Form Designer doesnt behave this way with controls made using C# or VB.Net.
Can someone please tell me what difference does CopyLocal property
make to the Form Designer ?
Why does this happen only with Controls created in Managed Cpp?
My control does nothing extraordinary, but just some Drawings in the OnPaint().
Please, somebody Help me.....
Thanks,
Firoz
|
|
|
|
|
|
Your assembly needs to be registered in the GAC. To do this it first needs a "strong name", sort of like a GUID.
Use SN.exe to generate a strong-name key file. In your AssemblyInfo.cpp file, specify the key file as a parameter to the AssemblyKeyFileAttribute() attribute. Rebuild your assembly.
Now use Gacutil.exe to register the assembly in the GAC. This step can be done in a custom-build-step if desired.
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2001 Microsoft Corporation. All rights reserved.
|
|
|
|
|
how can i make a button control and when it is clicked have the button stay pressed in until its clicked again???
|
|
|
|
|
Use a CheckBox and set the Appearance property to Appearance.Button .
James
|
|
|
|
|
Hey coders....
Okay I am just trying to create an instance from HWND and it won't let me.
ie.
<br />
using namespace System;<br />
#using <mscorlib.dll> <br />
<br />
public _gc class COO<br />
{<br />
HWND m_hwnd;<br />
public:<br />
COO(HWND hwnd)<br />
:m_hwnd(hwnd)<br />
{}<br />
};
When I hover over HWND it gives me (typedef HWND__ *HND) so I assume it is recognizing it but for some reason I can't use it....
If anyone could tell me why and how to get around this it would be much appreciated. Thanks...
|
|
|
|
|
|
anyone know of a way to add a hyperlink to a form that opens a URL when clicked??
|
|
|
|
|
|
The Visual C6's resource management really stinks the joint. Is it any better in .NET based on your experiences? I have been working on a multiple project workspace(about 25 projects in a workspace) and more often than not the dialog boxes give you a headache. Is it any better in .NET?
|
|
|
|
|
how could i unzip .zip files to a user entered dir in mc++
|
|
|
|
|
The same way you do it in regular C++, find or write a ZIP unpacking library and use it. Not much of an answer but its the truth
There are various ZIP libraries out there; one is available at icsharpcode.net[^] according to the site it is GPL'd but the site also says at the bottom that you can use it in a closed-source app.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
James' solution is of course the correct way, but if you (like me ) are lazy, you can instead just download Info-Zip and spawn it to do your bidding. Less flexible, and not completely .NET of course, but still a useful technique if your needs are modest...
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Hi,
I created a CustomConrol using ManagedC++.
This Control is Used in a C# Application.
When I Drop/Draw this Control to a Form, I get an error message
"Exception from HRESULT : 0x80131019".
But when I set the CopyLocal property of the Reference to False,
the Control is properly Drawn.
Why does this happen.
Why it gives Error when CopyLocal is True?
What does the Error code (0x80131019) mean ?
(I was not able to find this HRESULT Code in WinError.h)
Thanks,
FiroZ
|
|
|
|