|
hi every one..........
i want some one to help me how could i call DLL file in my C# program......
plzzz.......in detail cause iam new to C#.....
thx
Islam Is The Only Solution
|
|
|
|
|
mo7amed wrote:
i want some one to help me how could i call DLL file in my C# program......
Assuming you are refering to a Win32 .dll, you need to use the [DllImport] arttribute and define the function call within your code:
[DllImport("user32")]
public static extern int MessageBox(int hWnd,
String pText ,
String pCaption ,
int uType);
If you are refering to a .NET assembly .dll you will need to reference it in your project.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Hi Nick .
Thks .. Actually, by referencing it works fine in a C# application. However, I do have one strange problem .
When I put it in a web service it fails. I'm not sure why. I can see all the methods in intellisense. But my first function call ALWAYS returns NULL....I assumed if it worked in my C# app it would work in a service as well ..
Any ideas ??
Note: This is a DLL(COM) that was meant to be called from VB6.
|
|
|
|
|
I'm putting in a reference to a COM obj in my C# program. This DLL was originally written for VB programmers to reference in VB6 apps. I realize that this DLL is "unmanged" code.
What are the repercussions of running unmanaged code ?
Are there any ?
Is there a way to make it managed ???
Thks in advance .
|
|
|
|
|
What does the component do? Can it be easily written in C#? When making calls, the parameters and the returning result will have to be Marshalled to a fro, I suppose it depends on what the component does as to whether or not you will see a difference.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Does the built in wndproc in windows forms get all messages as it should , or are some messages removed / modified before / after the one handle the message ?
im trying to make a custom caption here , and it works quite nice , but i have a major problem , as soon as i click the caption bar , windows draws its default min/max/close buttons over my custom gfx.
should it do this? , or is it .net that is messing with the drawing code?
and what decides the position of the mainmenu on a form?
i know the menu could be relocated coz other skinning apps do this , so how is it done?
do i have to resort to ownerdrawing on the menues?
and also , what messages are responsible for answering to the animate window api?
coz when i doubleclick the caption , the window is maximized and animated , and at that time the window uses the standard windows caption , my custom caption drawing code is not called (it is located under the wm_ncpaint , and obviously that message is not sent to the window when animating)
//Roger
|
|
|
|
|
WndProc() does not get all messages. Like with MFC, PreProcessMessage() handles everything from the message loop, and only dispatches whatever is deemed necessary, to WndProc(). I have had to override PreProcessMessage() to do more fundamental window manipulation.
Also, apparently for convenience, you can call a windowed control/form's SetStyle() method with ControlStyles.EnableNotifyMessage set to true, so you can catch the WndProc messages in OnNotifyMessage(). However, it won't catch anything WndProc doesn't already get.
As for custom window styles and extended styles (WS_* and WS_EX_* stuff), which are not to be confused with control/class styles (what GetStyle() and SetStyle() deal with), you need to override the CreateParams property, and set your styles there. There is an example on the CreateParams help page.
In general, you will have to do a lot of custom drawing to achieve what you are trying to do. Main menus are normally automatically placed right below the caption, and displace the client area downwards, so you will have to roll your own. Hope some of this helps.
Cheers
|
|
|
|
|
I heared that vb.net code converted to c#.net then to
microsoft intermediate language, is this correct?
|
|
|
|
|
no, it goes direct to msil.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hello
Well i am new to C# and dont know much about it. i designed a form and tried to call it on menuitem. when i click menu item for very first time, the forms appears, but once i have closed the form and try to reclick the menu item again the error message occurs
" An unhandled exception of 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "Emp"".
plz guide me in this regards
Arkr
|
|
|
|
|
Can you post the code for "menuitem" click?
Sounds like the variable is getting garbage collected between the first and second uses.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG
|
|
|
|
|
Suppose EMP is the form, which i want to be appeared when menuitem is clicked, i simply create the instance of the Emp class
private Emp emp = new Emp();
and call
private void menuItem_Click (object sender, System.EventArgs e)
{ emp.Show();
}
Is it OK?
|
|
|
|
|
That should be fine.
This way, you'll have access to public methods/members of the Emp form variable.
You can also control when it should close/hide.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG
|
|
|
|
|
Hello,
I am a begginer in c#. I have one textbox. In this textbox user can enter any kind of data in xml format. The xml file format can be any type. What is the simple procudure to validate the xml file entered by user. what is the easy procudure to write simple xml editor(if user types open tag it should automically display close tag) using c#.
thanks in advance,
chito
|
|
|
|
|
Does someone knows how to load a PCX Image with a library or something else?
Trully, if there evil in this world, It lies within the heard of mankind
Shock The Dark Mage
shock@romhack.net
Main Project: Aeru IRC - http://www.sf.net/projects/aeruirc
|
|
|
|
|
Even though this applies to all .NET languages, I figured I'd ask it here since those VB.NET guys don't really get it, right guys?
Anyway, I was messing around with the managed DirectX classes the other day and got curious. I noticed in the assemblies that there's actually static methods on the assembly, not on a class. Well, this interested me so I dug deeper and saw that no external modules are P/Invoked but unmanaged code is embedded in the assembly. The only thing I can come up with is that they were written in MC++.
Then I started to wonder if the managed DirectX assemblies contained enough code to run that DX9 wasn't required. I tried it on a WinXP machine with the "factory-installed" DX8.1 and it worked! Of course, DX9-specific functionality may not work, but the basic stuff did.
So my question is, does anyone know how far back version support for the managed DirectX assemblies go, or do these contain enough information that DirectX doesn't even need to be installed. I'm kind of doubting it, but it'd be nice.
This will work great for our Web-deployed app that uses a "touchless installation", i.e. doesn't require an install. All dependent assemblies not in the GAC are downloaded automatically by Fusion, a component of .NET often overlooked. If MDX9 works this way, this paves the way for some awesome easter eggs...er, 3D object support.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Can anyone tell me, is there any advantage to using aximp/tlbimp for creating Interop DLLs over letting VS.NET do its stuff (by customising the toolbox to add a COM object)?
Is aximp mainly for those not using VS? Is VS using aximp to "do its stuff"?
Just wondering... what is the relationship, if any?
Paul
Pleasently caving in, I come undone - Queens of the Stone Age, No One Knows
|
|
|
|
|
aximp.exe is a simple cmdline that in the end just calls the System.Windows.Forms.Design.Aximporter.GenerateFromFile(string typelibfilename) method from the System.Design.dll namespace.
There is strictly no point in using this cmdline instead of letting VS.NET do it. After all, that's the same reason why you choose to compile C# code with the IDE instead of the cmdline.
|
|
|
|
|
Thanks SR.
This is exactly what I expected but I saw aximp mentioned in an article or two and it started to niggle at me. Figured someone here would know and I'd be able to forget all about it .
Paul
Pleasently caving in, I come undone - Queens of the Stone Age, No One Knows
|
|
|
|
|
Actually, there's a couple reasons: overriding the default namespace, generating source code, and providing a key pair (although you can do the latter via project options in VS.NET, but it's often forgotten). It's *rare* one has to do this, but I did have to for a couple ActiveX controls that were poorly written in the first place (but we needed them...drats).
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Exist in .NET something like WindowFromPoint ??
W.
|
|
|
|
|
[DllImport("user32.dll")]
private static extern IntPtr WindowFromPoint(Point point);
From Eric Gunnersons Win32Window library on GotDotNet.com
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
I'm sure that others have noticed this behaviour, but I have searched all over for a resolution to no avail, so I'll post it here.
When using windows XP visual styles (via manifest file) with a TabControl there are numerous display issues.
The most well-known is the fact that the TabPage background is not correctly painted with the WinXP gradient - this I actually don't care about as my tab pages are filled with either listviews or picture boxes, so the background is irrelevant. This issue has of course been addressed here on the CP already.
The major problem for me is that of you select anything other than a top alignment for your tabpages in conjunction with using winXP visual styles the tabs themselves are drawn totally messed up, along with the text on tabs mysteriously dissapearing.
The app I am developing is heavily reliant on tabcontrols, using a mixture of regular (align=top) controls, with a few left-aligned tabcontrols. Resorting the top-aligned controls throughout will simply waste far too much desktop space, so is not an option.
So here's where I'm at - it's either ditch WinXP visuals, or draw the tabs myself. I really don't want to have to resort to losing the XP look, so drawing the tabs myself is the way I'd like to go. The problem with this is that I simply cannot find an overridable method that allows me to paint the actual tabs (painting the tabpages is no problem), and at this stage the thought of writing my own TabControl from scratch is almost enough to make me turn to the drink.
Can anyone help?
|
|
|
|
|
Furty wrote:
So here's where I'm at - it's either ditch WinXP visuals, or draw the tabs myself. I really don't want to have to resort to losing the XP look, so drawing the tabs myself is the way I'd like to go. The problem with this is that I simply cannot find an overridable method that allows me to paint the actual tabs (painting the tabpages is no problem), and at this stage the thought of writing my own TabControl from scratch is almost enough to make me turn to the drink.
No dont drink! How about using the MagicLibrary's Dockin Controls. I have found the are almost a substitute for MDI forms and the TabControl.
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
Ah, come on. Drinking in moderation never hurt anyone and has even helped to churn out some interesting code form time to time.
Just wanted to vouch for Magic. We use them a lot at work and I and my colleagues have even suggested many improvements to the author. There's not very good documentation, but after "suggesting" that every third-party control libraries "require" it and throwing the NDoc project I help with at him and offering to help with the documentation process, docs will soon be on the way.
Other than that, you can't really find a better *free* library - or even a commercial library for that matter.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|