|
Hello Friends,
Our clients requirement is that we have to use their DLL which is created by C,C++ code.
What I am doing in my code is that :
1. using using System.Runtime.InteropServices;
2. [DllImport(@"g:\SampleDLL.dll",EntryPoint="test",
SetLastError=true,
CharSet=CharSet.Unicode,
CallingConvention=CallingConvention.Winapi)]
3. static extern int test(int lpLibName);
4. and in code calling test function with parmeter as 10.
But I am getting error that entry point "test" not found in SampleDll.dll, but this methods defination written in that dll itself.
Please help me out of this.
Or tell me is there any other way to use that dll?
Sachin Gedam
(Software Engg.)
Pune India
|
|
|
|
|
It's COM you're after.
Here's a little appetizer
http://www.codeproject.com/dotnet/cominterop.asp
|
|
|
|
|
sorry but its not a COM object, its simple a compiled dll created by old school level C,C++ language. And we have to use that dll in our .net project.
Sachin Gedam
(Software Engg.)
Pune India
|
|
|
|
|
|
Im try to open another window with some options in it for an app. but when i try to run it i get an error message "It is invalid to start a second message loop on a single thread. Use Application.RunDialog or Form.ShowDialog instead."
But i dont know how to do the sugestions, the main app can close after the options window is open - if thats any help.
|
|
|
|
|
can u show the code where u start the second form?
|
|
|
|
|
The error message means that you tried to call Application.Run from within the UI thread. Can you show us the code that opens the other window?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
So thats the problem, yeah im trying to open it from a button click within the form.
Would i be able to use a 'goto' and put the application.run somewhere else?
public void buttonOptn_Click(object sender, System.EventArgs e)
{
Application.Run (new ChangeText());
}
|
|
|
|
|
You needn't (and shouldn't) do that. If you want the form to be opened to be modal (ie that form takes the focus and you won't be able to go to the main form until you clost it), simply do
MyNewForm f = new MyNewForm();
f.ShowDialog(this);
If you want it to modeless, instead of calling ShowDialog , just call Show()
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
dear all
i need help in how to play flash in C# application
thz all
|
|
|
|
|
The easiest way is to embed a web browser instance inside your app..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
there's an easier way. If you go to your toolbox add in manager, and search "flash player", there is a ready made component by macromedia you can simply check to add to your toolbox. Drag it to your form, and there is a property that you tell it to navigate to a url or local file to play. I'm not sure exactly what the "flash player" is called, but it is something like that. Hope this helps.
|
|
|
|
|
its helpfull
many many many thx
|
|
|
|
|
hi,
any method to add versioning information automatically in .NET? or, any method to place the build date/time in the source file then i can read it back in the binary?
thanks,
jim
|
|
|
|
|
No, but you can easily read the PE filetimestamp using the following.
DateTime compiletime = new DateTime(1970, 1,1).AddSeconds(BitConverter.ToUInt32(data, 136));
where data is a byte[] representing the PE file (assembly).
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
|
yes, this is great! thanks!!!
|
|
|
|
|
Hi
Does anyone knows if there is any ICQ client on C# under project?
Thanks
|
|
|
|
|
|
I'm doing one, and the ICQ library (I'm calling in NOscar, similar to Java's JOscar) is already working.
I did not upload it to my homepage (German, www.danielgrunwald.de) yet, but if you want to take a look at it, send me an email.
|
|
|
|
|
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)<br />
{<br />
PaintEventArgs myPaintArgs = new PaintEventArgs (e.Graphics, new Rectangle(0,0,datagrid1.Width,datagrid1.Height));<br />
this.InvokePaint(dg, myPaintArgs);<br />
}
this is the coding i used to print out datagrid, the X and Y is set to 0 and 0, the datagrid print out correctly at exactly upper left corner of the paper.
then i modify the coding.
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)<br />
{<br />
PaintEventArgs myPaintArgs = new PaintEventArgs (e.Graphics, new Rectangle(50,50,datagrid1.Width,datagrid1.Height));<br />
this.InvokePaint(dg, myPaintArgs);<br />
}
i change the cordinates to 50,50, but y the datagrid still print at the same position for cordinates 0,0??i do not wan the datagrid to be printed at that position!anyone can help me out with this??Thz!
|
|
|
|
|
You could create a bitmap with the needed dimension, create a Graphics object for it, paint the grid to this bitmap and finally draw the bitmap onto the page:
Bitmap b = new Bitmap(datagrid1.Width,datagrid1.Height);
using (Graphics bg = GraphicsFromImage(b)) {
PaintEventArgs myPaintArgs = new PaintEventArgs (bg , new Rectangle(0,0,datagrid1.Width,datagrid1.Height));
this.InvokePaint(dg, myPaintArgs);
}
e.Graphics.DrawImageUnscaled(b, 50, 50);
|
|
|
|
|
thz man!the coding works for me.. but there is another problem, my datagrid has been loaded with a datatable contains 31 records, under screen resolution of 1024*768, the screen is able to show and print out all the records, but if user change screen resolution to 800*600, the records that can show in one screen is only 21 records, the rest of the records needed to be scroll down to view, then the datagrid printed out only contains 21 records that can be shown on the screen... wat should i do??
|
|
|
|
|
I´m writing a little library, where my main object MainObject contains some properties and a collection of ElementBase (abstract) objects.
I actually have two derived classes from ElementBase , each of which has properties, some common to the base class, others specific to the type.
I would like to save this MainObject to an XML with all of its elements, according to:
- Smallest file size possible. I don´t need uncessesary properties, only the important ones (my properties, not those from base clasess)
- Backward compatibily. I want a new version to read old version successfully and the other way around. Properties not present should be defaulted, and newer properties ignored.
- Support for different types of ElementBase-derivatives, both existing and future.
My idea of the XML file was something like this:
<MainObject property1="x" property2="y">
<Element type="DerivedElement1">
<property1>value</property1>
</element>
<Element type="DerivedElement2">
<OtherProperty>value</OtherProperty>
</element>
<MainObject> So, the first question, what do you think? is this flexible enough?
And the second question, how do I write the XML to the file? I've been checking the System.Xml namespace and there are a lot of things in there. I could use an XmlTextWriter or an XmlDocument . I saw also XmlDataDocument but I believe it is for reading/writing a DataSet to XML, am I right?
I don´t really need code samples (they sure can help) but just an pointer on what's the easiest, yet powerful enough, way of achieving what I want.
{EDIT: and of course, how would I read the file to recreate the objects? )
Thanks in advance,
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I'd use the XMLTextWriter, seeing as you're creating the entire document, rather than loading/manipulating one.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|