|
|
Is there a way to define an assignment operator on a managed C++ class?
I tried using the C# syntax, but that doesn't seem to want to work...
What I've got (that isn't working) is something like this:
public __gc class ATTRIB
{
ATTRIB();
ATTRIB(const ATTRIB* a);
virtual ~ATTRIB();
static implicit operator ATTRIB(ATTRIB* a) { return new ATTRIB(a); }
}
|
|
|
|
|
Is it possible to create a single file NET assembly from C# and MC++?
I wrote MC++ class that is a sort of proxy for ASPI API. The rest of the program is written in C++.
I'd preffer single-file than multi-file assembly. Is it doable?
CK
|
|
|
|
|
correction: the rest of the program is of course written in C# nor C++
|
|
|
|
|
I have a class that has been written in plain C++ that makes calls into
a library that exports many functions that take char array parameters.
What I want to know is how I can get / convert the data in a .NET String
object into a plain char array so that I can pass the value into
the function call? Basically any help converting the new .NET types into
older style "unsafe" types would be helpful. Thanks.
|
|
|
|
|
You can use one of two things, either the StringBuilder or you can marshal the string data.
If you need a buffer of some sort, like you need for getting a special folder you need to use StringBuilder
Code courtesy Tomas Restrepo
[ DllImport("shell32.dll") ]
private static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, StringBuilder lpszPath, int nFolder, bool fCreate);
StringBuilder dirPath = new StringBuilder(256,1024);
bool res = SHGetSpecialFolderPath(IntPtr.Zero, dirPath, CSIDL_APPDATA, true);
If you just need to pass a string in to a function but do not modify it use marshalling. I don't know what will happen if you try to modify it, it could reflect the change, or it could blow up on you.
From Inside C# by Tom Archer
[DllImport("user32.dll", CharSet=CharSet.Unicode)]
static extern int MessageBox(
IntPtr hWnd,
[MarshalAs(UnmanagedType.LPWStr)]
string msg,
[MarshalAs(UnmanagerType.LPWStr)]
string caption,
int type
);
MessageBox(0, "Hello, World!", "This is called from a C# app!", 0);
Both code snippets are untested, but should demonstrate how to do it. I made a minor change in Tom Archer's code and that was to reflect that handles, such as HWNDs should be IntPtr's instead of int's.
HTH,
James
Sonork ID: 100.11138 - Hasaki
and a digital cookie (not chocolate chip, its computer chip) goes to whoever can be the first to tell me what Hasaki means. I know someone registered on here can tell me
|
|
|
|
|
Thanks for the good information... but is there a way I can convert to an unsafe type BEFORE actually passing the data into a function?
If I've got a String* or Stringbuilder* in Managed C++ and want to convert it into an
unmanged type like char* or LPStr, how is that possible?
-dvryce
|
|
|
|
|
Can't say I know how.
I haven't looked at MC++ too much, only because I don't have any old code I have to work with that would warrant MC++ to me.
Perhaps the DOTNET mailing list could be of some help? Its been a great resource for myself and many others. It is a high volume mailing list though so you'll probably want to subscribe to the digest version, or use the web-based interface.
Sorry I couldn't be of more help,
James
Sonork ID: 100.11138 - Hasaki
and a digital cookie (not chocolate chip, its computer chip) goes to whoever can be the first to tell me what Hasaki means. I know someone registered on here can tell me
|
|
|
|
|
Hi all,
I have an MFC App.
I'm trying to port it to MC++.
For starters, I'm just trung to port one single View.
When i give __gc , the compiler spews out errors.
macros, DECLARE_MESSAGE_MAP, et al are not MC++ compliant!
So, what do i do now?
I don't want to make this a COM Componenet & use P/Invoke.
I want to change my app to MC++.
What do you guys suggest? I port everything to WinForms?
Man, I have many CFormView , & CDialog's! It would take like eons to do that
PLEASE help guys/gals! any suggestions?
In Anticipation..........
|
|
|
|
|
This question was also posted to DevelopMentor's DOTNET mailing list and an answer came up. I'm posting it here as well so others can find the answer you received.
Brad Wilson wrote:
MFC is not "managed-compatible". If you intend to have your UI be managed, you need to re-write it in WinForms. My suggestion if you do this is to use C#, since MC++ isn't supported with the WinForms visual tools in VS.net. Gluing together MC++ and C# is obviously trivial (assuming that, at the end of the day, there's any reason to keep your C++... there may not be, if the majority of your code is UI code).
Brad
--
Read my web log at http://www.quality.nu/dotnetguy/
Sonork ID: 100.11138 - Hasaki
and a digital cookie (not chocolate chip, its computer chip) goes to whoever can be the first to tell me what Hasaki means. I know someone registered on here can tell me
|
|
|
|
|
Hello All:
Can anyone tell me what is the equivalent of using data-aware classes in vb.net? Is it by using dataset classes, i.e by creating *.xsd files? If thats the case how do we "set" the connection, database name etc., at runtime? That is at runtime the user would choose the server/database name.
Thanks for all the help
Rashmi
|
|
|
|
|
Hi!
I really need to find a simple way to produce a messagebox, similar to that one would use in a standard windows application before deleting items, saving och closing or whatever.
I used to do this in ASP by using JavaScript on the client (alert...) but I thought I would not have to bother with that now. I've been searching through the SDK several times and still can't find anything usefull. The MessageBox I found seems to work only in Windows applications, not in browsers.
Has anyone seen, heard or done anything that might help me?
Consultant, system/web developer.
IMS Consulting AB, Sweden
|
|
|
|
|
ASP.NET is a server-side thing.
To do anything like that you're still going to have to rely on client-side script.
If you want you could roll your own MessageBox component that you could place on your ASPX pages and use like the Windows version, but in the end it'll have to call down to alert as well. I also have no experience in doing such a thing :p
James
|
|
|
|
|
Hi!
Thanks
I've managed to create a messagebox component but I immediately ran in to further problems: If I want to prompt the user for confirmation or input, how do I get the value back to the server?
As you pointed out I'll be needing to use scripting inside the component, but I still can't figure out how to get the values back from the client immidiately.
I realise you are not experienced in this (nor am I), but I thought I might as well elaborate on my thread so that maybe someone else can supply more information
Consultant, system/web developer.
IMS Consulting AB, Sweden
|
|
|
|
|
I think the easiest thing to do, would be to redirect to a confirmed page.
I think this is what hotmail does in its Junk Mail folder's "Empty Folder" command. You click the button to empty the folder, that brings up the confirmation Alert box, without moving to another page.
If you click ok, it then goes to the confirmed (delete all from folder) page. I think if you click cancel it does nothing, but I've never cancelled that dialog before
HTH,
James
Sonork ID: 100.11138 - Hasaki
and a digital cookie (not chocolate chip, its computer chip) goes to whoever can be the first to tell me what Hasaki means. I know someone registered on here can tell me
|
|
|
|
|
Hi,
You all are the intellectual persons on the list. Among u some r Software Engineer, Professor, students, in short u all r gurus as well as thinkers from different race and religion.Ur time is very precious and valuable. If you don’t mind please visit this site,
http://www.orst.edu/groups/msa/everwonder.swf .(Please turn on the sound)
It will take around 5-7 min(s).Think for just 2min(s) after visiting this site and ask yourself what is the reality, what r the facts and what is the JUSTICE and RIGHTS.
If u think u waste ur time by reading this mail I’m extremely sorry.
|
|
|
|
|
Hi,
Has anyone installed the RC1 and found that an app wizard form app doesn't run (but compiles ok)?
I've searched through the newsgroups and think that it is something to do with the help - the ICON doesn't show up properly which kinda vaguly confirms this.
I've tried to update the help in RC1 with the MSDN Library help and didn't succeed - anyone any ideas?
Thanks.
Al.
|
|
|
|
|
Is it possible to use asp.net with only .net sdk beta2 installed or I need to install the VC7?
Currently I have .net sdk beta 2 installed and the compiler reports an error in .aspx file near the Inherits="something" line.
With the best regards, Vitaly.
|
|
|
|
|
This question applies to managed C++, and I think also to C#.
In managed C++, to import a .NET API into C++, you do this:
#using "dllname.dll" The fact that you import the DLL directly, instead of some other file (like a TLB or LIB) implies to me that circular dependencies between managed C++ DLLs are impossible. This concerns me. Circular dependencies are sometimes useful, as long as they're confined to a single "layer" of the architecture. (Since a layer does not have to be defined as a DLL, but a collection of DLLs that work together.)
How can I make the following example work?
File a.cpp in DLL A does this:
#using "B.dll"
File b.cpp in DLL B does this:
#using "A.dll"
Which one do you compile first? Chicken and egg! I can't find any info about solving this on MSDN.
You don't have this problem when normal (non-.NET) DLLs import from each other, because headers are used at compile time, and because you can generate a A.EXP for A.DLL, then link B.DLL against A.EXP, then go back and link A.DLL against B.LIB.
So, without getting into a long debate about the pros and cons of circular references, how can I solve this problem?
Also, does anyone know if this is a problem in C# as well as managed C++?
- Brian Morearty
|
|
|
|
|
Guys,
I'm a new .NET programmer so bear with me and tell if if I'm making the right choices.
The requirements - clients will need to access services from a browser and desktop app (maybe even multiple OS's). The response needs to be fairly fast and the client requests cannot be lost. On the server side, there is some processing and data to be stored in a DB. The data needs to be accesed mostly by using a browser interface.
This is what I'm thinking - clients will access a Web Service via SOAP. The Web Service will feed requests to a MEssage Queue which will queue as well as transact the resuests so that there is no loss. The DB access will be ADO.NET, web site will use ASP.NET and the code will be in C#.
My questions - from what I've read I need to use COM+ managed services. However I'm not clear if .NET has an MSMQ equivalent (is it MessageQueue?) which will give me all these features easily? I haven't used MSMQ before - will this approach give me a low overhead and a high bandwith?
Also the clients will not have .NET framework - to implement them can someone suggest a lightweight and simple C++ library for SOAP calls (the one on this site uses an older SOAP toolkit), or should I use ATL Server generated code instead.
Thanks a lot and please feel free to criticise!
|
|
|
|
|
Hello everyone i recently installed Visual studio .NET beta 2 DVD and i can open the winform designer. When i create a C# or VB windows program i get an error:
File or assembly name EnvDTE, or one of it's dependencies, was not found
I can right click the form file and edit the code but i cant get it to open in the designer. Any help?
Thanks
|
|
|
|
|
Hi folks,
I just installed the .NET beta 2 on my machine, and attempted to start the IDE. All seems well to begin with until, "Updating Help to reflect recent changes..." then BAM an unhandled exception and the whole application shuts down. (followed by one of those annoying bug reports to MS).
I have successfully installed the beta on other machines! Just wondering if anyone else has experienced the same problem...I couldn't find anything after searching around on msdn.
I am running win2k...
Matt
------
Accept that some days you are the pigeon and some days the statue.
|
|
|
|
|
Hello i had that problem when I first installed it on my win2k system. Did you install all the components like it makes you before you install it? If you did and did it by clicking on the server settings link on the button of the setup page and all you did was click install for each of the components, dont do that follow the instructions for each component before you install it. Then reinstall VS.NET again and it should work....
|
|
|
|
|
Hi folks,
I recently stumbled about an annoying problem while designing components:
It just seems impossible to me to create a control that allows other controls to be put upon at designtime.
As far as I understood the MSDN every control derived from UserControl has the ability to support child controls. That works ok when adding controls simply by code but I can't add them using the designer.
I tried to set AllowDrop to true and played around with the DragDrop events. The problem is I didn't found a way to extract the control from the DragEventArgs parameter (if it is there at all).
Would be great if anybody could tell me how to create a control that act like the GroupBox for example, including visual component adding.
Thanks in advance,
Matthias
|
|
|
|
|
Is there any system for loose coupling of the GUI parts like Doc/View or MVC in .NET?
Johannes
|
|
|
|