|
Hello,
I would like to convert my windows forms application from C# to C++. Can this be done without rewriting the whole application? Oh, and I would not like to use MFC just plain API if possible. Any tools avaiable?
The reasons are:
C# is too slow.
C# wastes too much memory.
Before somebody complains: This can't be true! The application runs on an embedded device with a Micky Mouse processor and increadable 32 Megabyte of avaiable RAM. C# is just not good enough for this kind of maschines
The garbage collector sucks and does not rock. But I need all avaiable
Bytes for data. Every possible byte.
Operating system is windows ce (PocketPC)
Chris
P.S.: It was not my idea to use .net in the first place. I planned to use C++ with API. But the project manager insisted on .net Maybe he red too much codeproject
-- modified at 11:26 Thursday 16th February, 2006
|
|
|
|
|
There are converters that do a C# to C++/CLI conversion for you. But to convert a C# app to a Win32 API app, it's not syntax conversion that's needed - you are essentially writing a totally different app targeting a totally different environment. The only converter available would be a human coder.
Regards,
Nish
|
|
|
|
|
Like Nish said, you'd be better off rewriting the app.
Jeremy Falcon
|
|
|
|
|
dl4gbe wrote: But the project manager insisted on .net Maybe he red too much codeproject
Tsk. Tsk. Managers choosing technologies
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Michael said; "Tsk. Tsk. Managers choosing technologies"
They have a nasty habit of doing that.
I'm on-line therefore I am.
JimmyRopes
|
|
|
|
|
|
|
At my last company after writing over 100,000 lines of test and prototype code in .NET, I recommended we switch back to C++/MFC. C# was nice, I loved working in it, but for what we were doing, I felt it just isn't ready for "thick" client apps.
You will have to rewrite, and would want to anyway in order to optimize the app for Win32 CE, but it's not difficult.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: I loved working in it, but for what we were doing, I felt it just isn't ready for "thick" client apps.
Can you elaborate. I'm always interested to know where others have hit problems with writing thick clients with C#, so that I can avoid the same pitfalls.
thanks,
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
How can i tell if a remote pc is connected to the network using c#.
-- modified at 10:23 Thursday 16th February, 2006
|
|
|
|
|
you could ping it via c# and see if you get a reply. You could enumerate the network and get a list of all the machines names.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi,
thanks for the response. i have tried to ping using c# but this takes too long. what i am trying to do is get all of the machines in the active directory on my network and then check to see if each one is connected. i then load a listview item into a listview with the relevant image. this is for a network admin tool.
Thanks again for any help on this.
|
|
|
|
|
Hi!
I´m currently programming a GUI for a Command-Line-Based System. The administration is done with a command-line-Admin-Tool similar to Windows´ CMD-Dos-Box.
Unfortunately i cannot run the admin-commands on their own, because the only run in this cmd-line-based gui, which seems to be an stand-alone interpreter, not a dos-box running seperate programs...
Also there is no API available i could use.
What i´d like to do is to call a DOS-Box/Admin-Tool via the Process-Object and send my commands to it via the StandardInput-Object.
Sending works fine, but when I do the reading from StandardOutput-Stream, i cannot find an end-mark for my while-Statement.
(For testing-purposes i send everything to the system-console in order to see, what comes back from my process)
string sto = null;<br />
string ste = null;<br />
while ( ((sto = process.StandardOutput.ReadLine()) != null) || ((ste = process.StandardError.ReadLine()) != null) )<br />
{<br />
if (sto != null)<br />
System.Console.WriteLine(sto);<br />
if (ste != null)<br />
System.Console.WriteLine(ste);<br />
sto = null;<br />
ste = null;<br />
}
When the command has finished, the loop hangs in the ReadLine-Statements.
Peeking into the stream doesn´t work and hangs also...
How could i do this?
Thanks a lot!
J.
-- modified at 9:43 Thursday 16th February, 2006
|
|
|
|
|
Hello,
I am currently looking at using the System.DirectoryServices namespace to access data on a 3rd party LDAP server (not Active Directory).
After reading up and putting together a few test applications, I should be honest and state that I havent got very far at all.
Can anybody answer or point in the right direction for these questions?:
- Does .NET 1.1 DirectoryServices support connecting to a LDAP server that requires me to present a client certificate?
- If so, how do I specifcy which certificate to use? Or does it use the OS certificate store?
- If .NET 1.1 doesnt support this, does .NET 2.0?
Although I would prefer to stay within the realms of the .NET namesapce, DirectoryServices may not be the right way to go on this. If this is the case can anybody recommend a Win32 based LDAP API that does support this functionality?
|
|
|
|
|
I'm trying to populate an empty SQL Server database with DataSet, which is filled from XML file, but when I execute SqlDataAdaptor::Update() I get exception:
Update unable to find TableMapping['Table'] or DataTable 'Table'
Is it possible to Update such empty database, and what I am missing to execute method corectly?
the code is:
string strConnection;<br />
strConnection = "Data Source=SQLServer;Initial Catalog=DB1;Integrated Security=SSPI;"<br />
<br />
SqlConnection objConn = new SqlConnection(strConnection);<br />
objConn.Open();<br />
<br />
DataSet dbSet = new DataSet("myDataSet");<br />
dbSet.ReadXmlSchema("c:\\XML\\Data.xsd");<br />
dbSet.EnforceConstraints = false;<br />
dbSet.ReadXml("c:\\XML\\Data.xml");<br />
<br />
SqlDataAdapter DataAdaptor = new SqlDataAdapter("",objConn);<br />
DataAdaptor.SelectCommand.Connection = objConn;<br />
DataAdaptor.MissingMappingAction = System.Data.MissingMappingAction.Passthrough;<br />
DataAdaptor.MissingSchemaAction = System.Data.MissingSchemaAction.Add;<br />
<br />
DataAdaptor.Update(dbSet);<br />
...<br />
|
|
|
|
|
|
table 'Table' don't exist. No tables exist in the database. It's empty.
In such case is it possible the ::Update() method to create the database schema from DataSet?
|
|
|
|
|
Hi All i have a slight problem i can get information from WMI ti locate all disks of type 3 and 4. Which is great. Now the hard part how do i pass it to the html spinnerbox control i have. By the way this is media center application i am creating hence the need to use HTML as the gui.
thanks in advance
Dave
|
|
|
|
|
I've a list of panels one over the other and all inside another panel.
I want to scroll up, down these panels.
What is the correct way?
|
|
|
|
|
If assume you have a master panel called "panelMaster". Inside this, you have 10 sub panels "panel1", "panel2", ... "panel10". You can set "AutoScroll" to true for "panelMaster" and your app will display vertical scrollbars when panelMaster is not large enough to fit and display all of the subcontrols.
- Malhar
|
|
|
|
|
but i've 1000 or more panels inside, so how can i do?
|
|
|
|
|
I need this because i'm constantly leaving my USB thing in the computer, so the idea is, app runs when usb is inserted, if i log off and i've left my stick, logoff is paused/stoped, and i get a message telling me to remove it.
(this wouldn't be so bad if it was only my home computer)
|
|
|
|
|
Usually when a "stick" is connected to a pc, it has a drive letter assigned.
Test for that and then display your message. In XP the "shutdown -a" command will abort
a shutdown of the pc.
|
|
|
|
|
I have a requirement to use a dll written in Visual C++ 6.0 in my C# application. In order to establish the link between my application and the dll, I have written a ATL COM Component in Visual C++.NET [visual studio .NET version 8]. This COM component is referenced in my C# application. The COM component statically links with the 6.0 dll.
I am facing problems in passing data from C# to the dll through the COM component.
Description:
1. The dll exposes a function as:
__declspec(dllexport) int __stdcall ProblemFunction(int param1, BYTE param2, BYTE param3, BYTE *param4, DWORD *param5);
2. In the COM wrapper component, I have declared an interface method as:
[id(25), helpstring("method ProblemFunc")] HRESULT ProblemFunc([in] SHORT param1, [in] BYTE param2, [in] BYTE param3, [in, out] BYTE* param4, [in, out] LONG* param5, [out, retval] BYTE* param6);
where, param6 is used to return the value returned by dll function to the C# client application.
The implementation of this interface function is given below:
STDMETHODIMP
Wrapper::ProblemFunc(SHORT param1, BYTE param2, BYTE param3, BYTE* param4, LONG* param5, BYTE* param6)
{
*param6 = ProblemFunction(param1, param2, param3, param4, (DWORD*)param5);
return S_OK;
}
3. In the C# client application, I am calling the COM function as:
byte returnValue = DllWrapperObject.ProblemFunc(value1, (byte)value2, (byte)value3, ref value4, ref value5);
Here, I am facing problems passing value4 and value5 because:
a. For value4 I need to pass a structure.
b. For value5 I need to pass the size of the structure being passed in value4.
The structure to be passed is as required by the dll. The C++ structure is:
typedef struct
{
DWORD var1;
DWORD var2;
struct
{
DWORD var3;
char var4[16];
DWORD var5;
} var6[3];
} TEST_STRUCT;
I wrote the structure's equivalent in C# as a class as I had to create an array. The C# implementation of the above given structure is:
internal class InnerStruct
{
long var3;
char[] var4 = new char[16];
long var5;
internal static int GetSizeOfClass()
{
return (sizeof(long) + sizeof(char) * 16 + sizeof(long));
}
}
internal class TestStruct
{
long var1;
long var2;
InnerStruct[] var6 = new InnerStruct[3];
internal static int GetSizeOfClass()
{
return (sizeof(long) * 2 + InnerStruct.GetSizeOfClass() * 3);
}
}
Questions:
1. Is there any better way to define the structure equivalent in C#?
2. How can I get the size of the structure/class for passing it to the dll?
3. How to pass the handle of the structure/class object from C# to the dll so that it can fill it up and return it to the client app for future usage?
|
|
|
|
|
Ok,
You can define your C# structure like this:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct InnerStruct
{
public int var3;
[MarshalAs(ByValTStr, SizeConst = 16)]
public string var4;
public int var5
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct TestStruct
{
public int var1;
public int var2;
public InnerStruct[3] var6;
}
2. uint structSize = Marshal.Sizeof( typeof( TestStruct ) );
3.
TestStruct ts = new TestStruct();
ProblemFunc( value1, value2, value3, ref ts, structSize );
Deus caritas est
|
|
|
|