|
The easiest way to use WinaApi in C# is P/Invoke[^]
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
It depends what you're wanting to do with it, as different things will require different API calls. Have a look at pinvoke.net[^]. They have C# examples for nearly everything!
Dave
|
|
|
|
|
Maybe you could use the difference between the Bounds and WorkingArea of the Screen object to locate the task bar.
|
|
|
|
|
I've searched everywhere, and this looks like the code i used to use before i stopped coding and started school work.
Form1 form = new Form1();
form.Show();
but now it will not open my second form that i am making in conjunction with this project.
Error 1 Cannot implicitly convert type 'WindowsFormsApplication1.Form2' to 'WindowsFormsApplication1.Form1' C:\Documents and Settings\Nick\My Documents\Visual Studio 2008\Projects\Project\Project\Form1.cs 44 26 Project
This is the error message I keep getting, i made sure the second form name was Form2 as well to make sure nothing was messing up.
|
|
|
|
|
Form2 form2 = new Form2();
form2.show();
assuming second form is called Form2 and in the same namespace.
Dave
|
|
|
|
|
Thanks for your help. I remembered what it was just not how to use it.
P.S. you were close,
Form2 form2 = new Form2();
form.show();
is the right way ^_^
modified on Monday, June 2, 2008 6:12 PM
|
|
|
|
|
No, that's utterly broken. Your form2 instance is never shown, you're showing a different form entirely. What is form2 for ?
Oh, and never create local variables and then show them modelessly ( show ). Use showdialog, or use member variables.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: Oh, and never create local variables and then show them modelessly ( show ). Use showdialog, or use member variables.
What is side-effect(problem) in using form.show() ?
Memeber variales, Does they mean memeber at class level?
|
|
|
|
|
ummm no thats wrong.
C# Beginner Nick wrote: form.show();
where have you declared the instance 'form'?
C# Beginner Nick wrote: Form2 form2 = new Form2();
If you create an instance of form2, then to show it, you use:
<br />
form2.Show();<br />
Cheers,
|
|
|
|
|
C# Beginner Nick wrote: Form2 form2 = new Form2();
form.show();
Newing a Form2 instance and Show a form that were instance somewhere else, is probably the lurking problem waiting to happen in your original post.
|
|
|
|
|
C# Beginner Nick wrote: P.S. you were close
No, I was correct.
Your initial code was:
Form1 form = new Form1();
form.Show();
doing
Form2 form2 = new Form2();
form.show();
will create an instance of Form2 (form2 ) that is not used, but will show your Form1 instance again (form ).
Dave
|
|
|
|
|
Hi,
Can a windows service run a console application?
Basically my goal is to have a windows service with a FileSystemWatcher monitor a directory. If that directory has any MS Word documents in it, convert them to pdf and then move them to their final resting place.
I've created the windows service, it finds the files and starts a MS Word in the background. But on the line that opens a document, it fails. I presume because its running from a windows service and MS Word is probably trying to display some dialog. So my thinking is that if I move the conversion functionality to a console app and just let the windows service do the monitoring it will work.
Thanks for the feedback!
Just because we can; does not mean we should.
|
|
|
|
|
Your service can launch a console app (invisible if necessary) and pass arguments to it etc... so pass the filename to be opened to the console app and let that handle the word/pdf stuff.
Dave
|
|
|
|
|
Thank you
Just because we can; does not mean we should.
|
|
|
|
|
Hello Everyone! I need help with a code that i need to write. Can someone please point me in the right direccion? What i need to do is the following:
Create a C# script that will scan LDAP for an attribute called lbpcsfax, then scan AD for lbpcsfax(lbpcsfax is like a user's property like phone#, fax# ). The script should compare both and then generate a txt file only with the discrepancies on both. Let's say a user in LDAP has a fax number and in AD appears as not having one or viceversa. The output should look like:
XPID.............Display name............LDAP fax#...............AD fax#
jpeterson........Peterson, John.......123-519-1234...........No fax# found
jmichels..........Michels, Jon............No fax# found...........232-559-2020
Then the program should copy the txt file to an email.
Program should recognize the user's credential when running from user's machine. No need to create any kind of security setting for AD.
Any help is greatly appreciated.
|
|
|
|
|
What exactly are you having problems with? If you don't know where to start, look at the System.DirectoryServices and System.DirectoryServices.ActiveDirectory namespaces and the DirectoryEntry and DirectorySearcher classes. If you have a specific area you're stuck on, please give us more details so we can help you.
|
|
|
|
|
Hi
In the article SNMP Library by zitun, the "testSet" function does not work as expected because you cannot change the name of a computer by a snmp request. Here's the message:
Error: SNMP: Variable does not exist; status: NoSuchName; index: 0
*** SNMP protocol error while processing <op>:
SNMP error status: NoSuchName
SNMP error index: 0
Error: SNMP: Variable does not exist; status: NoSuchName; index: 0
My problem is that I always get this error whenever I try to set a value in the printers on the network. There are 45 printers and all of them are Xerox - Phaser 4510. There's one in which the set command works: Lexmark T430. But this one isn't being shared like the others. My goal is to control the maximum number of printed pages by sector. If one exceeds the monthly limit then the printer must be blocked. The project is almost finished, but I'm stucked at this little set command.
I've already tested the program using the library from AdventNET but a similar message appears...
I'm afraid the solution is somewhat related to permissions on the network but this would be very strange, as I've looked a thousand times the configurations and everything is fine.
It's obvious impossible "the variable does not exist" because I CAN get the value!
-----------------
// A simple set
public static void snmpset(string hostName, string oid, string value)
{
SNMPDll.SNMPAgent agent = new SNMPDll.SNMPAgent(hostName);
SNMPDll.SNMPObject s = new SNMPDll.SNMPObject(oid);
agent.setValue(s, SNMPDll.SNMPOIDType.OctetString, value + "\0");
}
Thanks for your attention, Icaro.
|
|
|
|
|
Hello friends,
I want to keep a search option in my form. Which is consist of a combo and a text box.
The combo will contain different criteria on which the user will search. And in the text field the user will input the specific item. Suppose one wants to search things based on DepartmentId. So he will select departmentid from the combo box and he will input the departmentid number in the text box to see all result.
Now what i want to do is that whenever he selects departmentid from the combo box and suppose the first char he wrote in the text box is 1, what will happen whenever he press 1 all departmentid starts with 1 will appear in a pop-up type of somthing below so it becomes even more easier for him to select the exact departmentid. Now can anyone plzz help me?
|
|
|
|
|
Saiyed Alam wrote: Need Immediate Help
of COURSE you do.
Interesting spec. What have you tried ? Do you have any idea how to do this at all ? You've not told us what your data source is, but assuming it's a SQL database, how do *you* think you should go about this ? There's really only one way that I can see.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes sir It's a SQL Database. What I had in mind that in the key press event of that text box I will take the value of the text box and populate a new data set from the database in a popup. But I have never used any thing like popup and have no idea on it. So I need help on how to use popup.
|
|
|
|
|
OK, so now you're asking a specific question. I think a dialog with no border is your best way to create the sort of popup you will want. Just a modeless window.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank u. It will help a lot.
|
|
|
|
|
This kind of depends on what your data source is. If it's a DataSet, then you could apply a filter that matches the criteria the user entered into the searchbox and display the DataSet in some kind of ComboBox, ListBox or whatever window type you like.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
pliz tell me name of exercise book in amazon website????
a lot of tnx
|
|
|
|
|
Amazon has an excellent search facility, and they let people write book reviews, so it's pretty easy to get an idea if most people loved a book or hated it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|