|
you are looking for P/Invoke , you must use dllimport (and many more) look it up on google and msdn , good luck with this you will need it .
you must declere the functions as static using dllimport attribute
dll function
[DllImport("SectionDBEngine.dll", EntryPoint = "getHeadersByIndex")]
public static extern int getHeadersByIndex([In, Out] CSectionHeader[] headers, int size);
http://msdn2.microsoft.com/en-us/library/aa288468.aspx[^]
f(yf) = yf
|
|
|
|
|
I can tell you that you'll have to re-define the struct on the .NET side for sure. The second parameter seems like an array of doubles. Is that so? That will map to System.Array.
|
|
|
|
|
Hi All,
I am new with VS 2008 and also WPF Application.
I want to make a application i which i have to give look like Office 2007 instead of Menus.
i want to use Ribben UI control so for that i google it but i am unable to find proper solution that how can i prepare Ribben UI Control.
also i found some link in which they providing Ribben UI Control but not free.
Can anybody tell me that where i can get free source code for Ribben UI Control to Use in My WPF Application?
Thanks
Bankey
|
|
|
|
|
You need to buy a third party addon and accept a specific license that says you will not use the ribbon in a product that competes with Microsoft Office.
|
|
|
|
|
|
Dear gurus,
I found so much on the subject of calling a Cpp-Interface from C#, but I'm more confused now. There is no simple/understandable example.
My problem:
I have legacy-code which contains Cpp-Classes in "old-fashioned Cpp-Dll's" and I want to call interfaces of these classes from within C#-Code.
Kind regards
|
|
|
|
|
u can use DLLIMPORT from c# code
rahul
|
|
|
|
|
I don't think you can do that directly. You will have to write a C/C++ interface that will call the functions in the C++ classes. When you write your interface be careful to choose data types that will be easily marshalled by .NET.
|
|
|
|
|
Tomerland wrote: I have legacy-code which contains Cpp-Classes in "old-fashioned Cpp-Dll's" and I want to call interfaces of these classes from within C#-Code.
You can't do this directly. The classes in your C++ code have to be exposed through COM to get this to work. If they're not, you'll eitehr have to rewrite the C++ code so that they are, or write a wrapper that takes care of using the C++ classes and exposes various methods to manipulate them through COM.
Managed code cannot directly instantiate and use unmanaged code classes without a Runtime Callable Wrapper of some kind.
Tomerland wrote: There is no simple/understandable example.
Correct. That's because this is a difficult concept to understand.
|
|
|
|
|
A principal question.
I'm dealing with number-crunching applications having a rich user-interface.
To realize these applications I use a two-folded strategy:
a)
use highest-speed technology as unmanaged code,C++, pointers or assembler
b)
for the rich user-interface I want to use window-forms or wpf.
In previous days this was no problem. I used MFC; there is no integration-problem with different technologies.
But now, I have a mess. Mixing C++ and C# seems to be incredibly problematic.
If you - dear reader - have a similar type of applications, how do you solve these issues? Are you really stepping into the realm of interoperability?
Kind regards
|
|
|
|
|
Tomerland wrote: If you - dear reader - have a similar type of applications, how do you solve these issues?
I've already explained how to solve them.
Tomerland wrote: Are you really stepping into the realm of interoperability?
That's the only option you have.
|
|
|
|
|
I'll give a little very simplified example to try to get you started.
Use caution when dealing with unsafe code/pointers going
back and forth across the managed boundary. The garbage collector can change reference locations
on you as your dll is working, in that case you'll need to "pin" or use the fixed block
especially when dealing with *buffers.
say you have a .dll named "TheDll.dll" with one method: public int Add(int a int b); //...
internal static class TheDllNativeMethods{
[DllImport("TheDll.dll")]
public static extern Int32 Add(Int32 first, Int32 second);
}
public class YourClass{
public Int32 ForwardingAdd(Int32 a, Int32 b){
return TheDllNativeMethods.Add(a, b);
}
}
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
People often talk about legacy code as something like the "necessary evil"; it should be substituted by newer technologies as C# (or Java) if possible.
This may the right in many cases, but for number-crunchers such "legacy" is not obsolet, it is the only choice, because the performance of C# (Java) is much to slow
Kind regards
|
|
|
|
|
Hi there
I have a major problem with ladscape printing. when I print my documnet by PrintDocument on portrait paper it works well and every ponit prints in its own location but when I want to print in landscape all the positionings get changed in a way that some points get printed out of the paper bounds.
What is my mistake in landscape printing?
thanks.
|
|
|
|
|
UAU,
You'll need to show some code before anyone can tell you wants wrong.
Regards,
Gareth.
|
|
|
|
|
hi there
here is some code for more:
using System;<br />
using System.IO;<br />
using System.Diagnostics;<br />
using System.Data.SqlClient; <br />
using System.Drawing;<br />
<br />
<br />
namespace test<br />
{<br />
public class Class1<br />
{<br />
public static void Main()<br />
{ <br />
<br />
System.Drawing.Printing.PrintDocument doc=new System.Drawing.Printing.PrintDocument();<br />
doc.QueryPageSettings +=new System.Drawing.Printing.QueryPageSettingsEventHandler(doc_QueryPageSettings);<br />
doc.PrintPage +=new System.Drawing.Printing.PrintPageEventHandler(doc_PrintPage);<br />
doc.Print();<br />
<br />
}<br />
<br />
private static void doc_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e)<br />
{<br />
e.PageSettings=new System.Drawing.Printing.PageSettings(new System.Drawing.Printing.PrinterSettings());<br />
e.PageSettings.PaperSize =new System.Drawing.Printing.PaperSize("Custom Size",8230,4330);<br />
e.PageSettings.Landscape=true;<br />
e.PageSettings.Margins.Left=e.PageSettings.Margins.Left=<br />
e.PageSettings.Margins.Left=e.PageSettings.Margins.Left=0;<br />
<br />
<br />
}<br />
private static void doc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) <br />
{ <br />
e.Graphics.PageUnit=System.Drawing.GraphicsUnit.Millimeter;<br />
Font fnt=new Font("Tahoma",14,FontStyle.Bold);<br />
StringFormat sf=new StringFormat(StringFormatFlags.DirectionRightToLeft);<br />
sf.LineAlignment=StringAlignment.Near;<br />
sf.Alignment=StringAlignment.Near;<br />
Rectangle rec=new Rectangle(113,12,83,17);<br />
e.Graphics.DrawString("Some Text Goes here",fnt,Brushes.Black,rec,sf);<br />
}<br />
}<br />
}<br />
when I print using this code in portrait the text excatly prints in the locataion 83:17 but in landscape no test presents.
Note that I use my own paper size.
|
|
|
|
|
Hi Friends
I'm trying to get selected text from another program.like notepad,word and IE,I have an application which is running on system startup and it's show on the system tray. Now, whan I select some text from another program e.g. MS Word, IE, notepad, and then I hotkey my applicatin, I need to get selected text!
If some know the idea behind it then please help
Thanks to all
|
|
|
|
|
You need to do the following steps:
1. Get the handle to the target window. Use Spy++ to find out window names & classes to use with the Windows API.
2. Send a message to the window to get the selected text.
That is all that is needed, but you will need to DllImport a number of windows API calls to do it. Let me know if you need more clarification. The documentation on the Win API method signitures can be found here[^].
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Mates,
Have you ever tried iBATIS?
iBATIS Data Mapper framework makes it easier to use a database with Java and .NET applications.
It's very useful because it can reduce your code into a simpler accessing relational databases.
Just want to ask if someone use this kind of framework.
Thanks.
~~~~~~~~~~~~~~~~~~
The best things in life are free
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
Have you tried LINQ to SQL?
|
|
|
|
|
Hello Experst,
I creat an application using the C#.net 2005. In that I use a third party component, I can't install the third party DLL with my application because that is against the policies of that company.
So they provide merge modules for that.....
I add merge modules in my setup and deployment project, But I have following confusions...
1. Somewhere I rad merge modules are not installed directly...is there any command or proprty to set ....?
2. How can I install that third party merge module with my installer...?
Please help
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Hi!
Usually there's nothing else to do except add the merge module to your setup and build.
The only trouble I ran into once was when there are several merge modules with dependencies between them.
In that case, you'll have to copy all the merge modules to %COMMONFILES%\Merge Modules or else VS can't resolve the dependencies.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
First of all thanks for your kind reply,
I add the merge modules in my project, but this does not seems to be install automatically...
Is there any command or propety by which I can install the merge modules...?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
please help
How to insert an unicode (e.g letter "A" with circumflex) into wordpad(at current cursor position)
from c# program?
|
|
|
|
|
Just give you an idea. Why don't you make a format file. Then call this file into to your C# code.
Format File example:
1 SQLNCHAR 0 6 "\0" 2 MANDT ""
2 SQLNCHAR 0 20 "\0" 3 LIFNR ""
.
.
.
******************************
I just want to
know everything
|
|
|
|