|
Can i use winAPI functions in C#??
|
|
|
|
|
You can import functionality from a native dll.
For example:
[DllImport("kernel32", SetLastError=true)]
static extern IntPtr CreateFile(
string filename,
uint desiredAccess,
uint shareMode,
uint attributes,
uint creationDisposition,
uint flagsAndAttributes,
uint templateFile
);
You can then call CreateFile as you would a normal C# method.
You will need to know the basic conversion types from C++ to C#.
Or you can use [MarshalAs(UnmanagedType...)] attribute on a field.
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
yes, ofcourse you can use.
you can use regular static/nonstatic mfc/nonMfc dll.
+ you can use COM dll
using COM dll is easy as eating popcorn
and using other dll is hard and will need testing using marshalling etc
|
|
|
|
|
Just started C# and the compiler i am using is VS 7.0.When i try to convert a string literal to a integer my compiler is giving me problems.I have three books and i have tried all the examples on the book but they dont work.
<br />
using System;<br />
class Hello<br />
{<br />
public static void Main(string[] args)<br />
{<br />
string s1 = "123";<br />
<br />
int num = s1.ToInt32;<br />
<br />
}<br />
}<br />
Error:C:\Documents and Settings\KARANSANDHU\My Documents\Visual Studio Projects\ConsoleApplication1\Class1.cs(8): 'string' does not contain a definition for 'ToInt32'
|
|
|
|
|
You can try one of following:
int num = Int32.Parse(s1);
int num = Convert.ToInt32(s1);
i'm only pointer to myself
|
|
|
|
|
I'd like a Button to have an image on both XP themed systems and
other systems (XP w/ themes off, Win2K, Win98, etc).
I've noted and seen reported on USENET that setting Button.FlatStyle =
System disables any Image you have set. I've tried placing an ImageBox
on top of a Button with a transparent ImageBox background color, but
this does not work because the transparency is to the form behind, not
the button.
I searched everywhere for a 100% managed control, whether free or
commercial, that does what I want. I've been unable to find such a
control. I've found a ton of C++ code but I am C++ illiterate and
haven't a clue how to turn one of these into an ActiveX control.
Does anyone know of a .NET option or a fairly lightweight ActiveX
options?
Thanks,
-Jeff
JM Tilly
|
|
|
|
|
Hi Valeria. Not really. I'm looking for a button that can hold an image yet still retain the XP style when the user is on XP and has XP theme on. This commercial product:
http://www.variad.com/products/osbutton/ex_xp.asp[^]
comes close but is an ActiveX control. System.Windows.Forms.Button accepts an Image property but when XP theme is applied and you have on.FlatStyle = System the image is ignored.
Regards,
-Jeff
JM Tilly
|
|
|
|
|
Is there someone who can tell me how to start some external kind of software (ie. .EXE) from a program?
For example: I need to build a program which starts notepad and paint automatically, can I use some kind of command like: Application.Start("C:\\windows\\paint.exe")?
Thank you in advance,
Boudewijn Ector
|
|
|
|
|
System.Diagnostics.Process.Start(string filename)
"If you just say porn then you get all manner of chaff and low grade stuff." - Paul Watson, Lounge 25 Mar 03 "If a man is standing in the middle of the forest speaking and there is no woman around to hear him, is he still wrong?" - Anon
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
Does anyone know wether there is some kind of control wich can be used to display some XML\HTML pages, without starting some external program like IE or netscape.
I need this because I have to decrypt some HTML pages, show them in some kind of form and after that I need to encrypt them again.
Can someone help me with this?
Thank you in advance,
Boudewijn Ector
|
|
|
|
|
The IE Browser Control, contained in shdocvw.dll, is what is usually used.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
thank you, jdunlap
But I don't understand the way this control is working in C# --> if I place it in a form and change its properties it remains blank. How do I fix this.
|
|
|
|
|
|
I didn't know if BoudewijnEctor was wanting one that was editable or not. If he doesn't mind it being editable, FreeTextBox[^] might be good too.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Hi,
is it possible to watch for a whole local drive (recursive)? Or make it sense to watch a whole drive with a System.IO.FileSystemWatcher.
I would like to be notified if on the local machine a *.mp3 file is
created
deleted
changed
on all drives, cause my engine should handle all the mp3 files on a local compter...
how to do that in da background, without consuming to much resources ?
PS: At this time i guess this would be a a windows service
.:Greets from Jerry Maguire:.
|
|
|
|
|
If I rememebr correctly, someone dit an article on a recursive file system watcher (too ZZzzzz to search now 2am almost, have to get up at 7am).
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
Is it possible to write a win2000 driver to control a usb ir remote in C#?
|
|
|
|
|
Yes, it is possible, but will just be alot of work.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
Would it be simpler doing it in C then?
|
|
|
|
|
Hi i'm having a bit of trouble implenting a program with associated file types.
Implenting the the association is working right, and when i double click on a file with my extension the program starts and open the double clicked document. However, a new instance of my program is started for each document, and this is not the correct function i'm looking for.
So in short what i want is to only run one instance of my program and any files double clicked after an instance is started should open in the allready open instance of my program (get it ? sorry for my bad english
I've seen an article on preventing several instances of a program, but i'm lackin some knowlege on how to pass the arguments to the allready running program..
Any help would be great
|
|
|
|
|
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hey all,
I'm writing an RPG loosely based on Wizardry in C#. I was wondering what y'all thought the best way to transfer a map into the code was. As of now, I'm just writing it in a text file then using a StreamReader to put it into the code. However, the StreamReader seems to format the text when it puts it into the code. Here's a sample map:
eeeeeeeeeeeeeeeeeeeeeeee
e wwwwwwwwwwwwwwwwwwww e
e wwwwwwwwwwwwwwwwwwww e
e wwwwwwwwwwwwwwwwwwww e
exwwwwwwwwwwwwwwwwwwww e
e e
eeeeeeeeeeeeeeeeeeeeeeee
In this simplest of maps w is the wall e is the edge and x is the character location. How should I read this into the code?
Thanks,
...Zack...
GCS\P\SS d- s-:- a-- C++ U--- P--- L- E- W++ N o K- W+++ O++ M-- V PS+ PE Y+ PGP t+ 5+ X+ R++ tv++ b++ DI++ D+++ G+ e* h- r++ y+
|
|
|
|
|
Just read it into a 2d array?
Sounds simple enough to me.
Wrap it all up into a class that gives you all the basic moveForward, moveBackward, MoveLeft, moveRight, turn, lookUp, etc... methods...
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
I got a ImageList on my form and trying to attach this to a toolbar control, but the toolbar buttons show garbled image. Ex: Toolbarbutton1 should show the imagelist index 0 button, but it shows shrinked image of bitmap strip.
Already did this:
1.Added imageList1 to the form and added a couple of members via Collections property of imageList. (Question 1)
2.Added imageList1 to the Toolbar's imagelist property.
3.Set the ImageIndex(toolbar->Buttons->Collection->toolbarButton1) to the imagelist index.
4.I have added the bitmap (Add -> Add Existing Item). The bitmap strip contain 7 images. (as a Embedded resource)
Question 1. Do I need to add the bitmap strip only once for the all the images? or Do I have add it once for every image on the bitmap strip?
What settings did I miss?
Don't and drive.
|
|
|
|
|
I thought that you were supposed to add each image to the imageList as a separate image. That's what I have done before.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|