|
The thing is, 0.0.0.0 is in fact the endpoint it is assigned to.
0.0.0.0 means "any" and it chooses which actual interface to use at send-time, separately for each packet. So if you are sending to the internet it will use the modem's IP and if to the LAN it'll use the NICs IP.
|
|
|
|
|
I do want to be assigned a network interface to listen for broadcasts. How to do that?
|
|
|
|
|
Well, you should still be able to listen on *all* the interfaces. If you want to assign only a specific one, you will have to find out what interfaces there are beforehand. I don't really know how to do that.
|
|
|
|
|
And pretty frustrating, I am trying to take a screenshot of my c# application, using BitBlt of the whole screen. For some reason the screenshot is taken and saved, but the application window is not part of it.
I tried doing it using Windows Media Encoder, same thing. Even the cursor changes are visible on the video, but the window is simply not there, completely transparent on the video.
Whats going on? Any ideas?
|
|
|
|
|
Answering my own question. Sorry about the vague subject of the orinal message too.
If your .NET form has any transparency key set, BitBlt will ignore the whole form. The window will not be visible to BitBlt.
|
|
|
|
|
Here is a sample program from the MSDN help files:
using System;
using System.Management;
// This example demonstrates reading a property of a ManagementObject.
class Sample_ManagementObject
{
public static int Main(string[] args) {
ManagementObject disk = new ManagementObject(
"win32_logicaldisk.deviceid=\"c:\"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " bytes");
return 0;
}
}
It seems simple enough, but when I have tried to build this code I get the following error:
error CS0234: The type or namespace name 'Management' does not exist in the class or namespace 'System' (are you missing an assembly reference?).
I have this same problem in my application and in a test standalone console application that I developed. Does anybody have any idea why I am getting this error? I see that other people are using the Management namespace in other postings, so it seems hard for me to believe that the management namespace is really not a member of the system class.
Any help would be appreciated,
Craig
Craig
|
|
|
|
|
I placed the code into a C# console application and it worked fine. From the error message you are receiving it seems like you did not add the assembly reference. To add this reference open the Solution Explorer window. Right click on the word References in the tree. In the menu that opens up click on Add Reference... In the Add Reference window that come up look for the component name System.Management and click on it to highlight it. Then press the Select button and then the OK button. Now you can recompile and you should be fine.
|
|
|
|
|
Thanks for the help. It works fine now.
Craig
|
|
|
|
|
Now re-read the error message....pretty good i'd say!
error CS0234: The type or namespace name 'Management' does not exist in the class or namespace 'System' (are you missing an assembly reference?).
|
|
|
|
|
I want to use a context menu with a tabcontrol. How can I detect which tab was right clicked?
|
|
|
|
|
In the event handler for the MouseDown events of the TabPages, you can check:
private void tab_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if ((TabPage)sender == tabPage1 && e.Button == MouseButtons.Right)
}
However, if the purpose of detecting right click on a tab page is to invoke the context menu, then such a detection is not even needed, as the same objective can be achieved without such detection in the following manner.
In the designer, draw a TabControl on you form. Draw the TabPages on this control as per your requirements (say, tabPage1 and tabPage2). Now, draw the context menu's for each TabPage as per requirements (say contextMenu1 and contextmenu2) with the required menu items. Select tabPage1 tab in designer and in its properties window, set the ContextMenu property to the value of contextMenu1 object. Similarly, the ContextMenu property of tabPage2 can be set to contextMenu2 object. Compile and run the program.
Now, when you right-click anywhere inside the area of tabPage1, you'll automatically get contextMenu1. Similarly, right-clicking anywhere in tabPage2 will show the contextMenu2 automatically.
Thus, there is no need for you to detect as to which tab was right-clicked.
|
|
|
|
|
Thanks for your reply. First of all I want to make one thing clear. I'm trying to click the actual tab, not the tabpage. I also want to use the same context menu for different tabs. Otherwise I would have no trouble finding out which tab was right clicked.
I have already tried your first aproach with one difference. I create the tabs dynamicly with the following code (somewhat pseudo):
TabPage tpNew = new TabPage();
tpNew.Text = "Some text";
tpNew.MouseUp += new MouseEventHandler(tpNew_MouseUp);
tcTabControl.TabPages.Add(tpNew);
The eventhandler tpNew_MouseUp is never called.
I can hook up the context menu a number of ways that I am aware of. Even on the TabControl itself, but I have no idea how to find out what tab were right clicked. Is it possible to fins out which of the headers that are under the X and Y coordinates when the mouse was clicked?
|
|
|
|
|
How would i go about skinning the standard windows frames around all programs and apps, much like windows blinds. Or is there a way i can skin *all* of the windows standard components? if so where would i start and how would i do so? Thanks a bunch guys.
|
|
|
|
|
I try to connect to oracle database without using DSN.
Here is my part code:
odbcConnection1 = new System.Data.Odbc.OdbcConnection();
string strConnect = "Driver={Microsoft ODBC Driver for Oracle};"+
"Server = RISK.CINERGY.COM;UID=user;PWD=pass;";
this.odbcConnection1.ConnectionString = strConnect;
I got error as below:
Error[IM002][Microsoft][ODBC Dirver Manager] Data source name not found and no default driver specified.
Can anyone tell me how to deal with it?
Thanks for your help.
|
|
|
|
|
Is there a way in gdi+ to set text kerning?
I tried using SetTextCharacterExtra with current graphics HDC, but it seems
to work randomly.
For example with arial font it works up to size 13 (with extra spacing set
to 20)
Once I try to draw with size 14 it just ignores the setting.
Is there some limitation to that function, or is there any other I can use?
Thanks.
|
|
|
|
|
Hi!
Does anyone have a simple sample to access msi files, I need information from varius tables and properties, this is quite simple in vbscript, but I need to do it in C#.
btw: first post
|
|
|
|
|
Hi Guys,
I am trying to hide the scroll bars in the Mdi Parent form by setting the autoscroll property to false but it is not working.
Please tell me how to hide the scroll bars in the form.
Regards
AAmir
|
|
|
|
|
Hi, i've created a program and i want to install it on a computer. It says i have to install the .net framework before running the program. is there an other way to install it without the .net framework? (copy some dll to surtain directories??)
|
|
|
|
|
Nope. Not that anyone is going to support anyway...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The quick answer to your question is no. One of the most important part of the .Net Framework is the CLR “Common Language Runtime”. This block of code provides the environment in which .Net programs are executed in. You can download the .Net Framework from Microsoft free of charge at ( http://www.microsoft.com/downloads/details.aspx?FamilyID=262d25e3-f589-4842-8157-034d1e7cf3a3&DisplayLang=en ) This download includes all that is needed to run applications developed under .Net Framework.
|
|
|
|
|
|
Hi all. I haven't found an answer to this through quite some googling and searching, so I hope someone can provide some tips.
Here's the deal:
How can you call unmanaged code from a C# app?
Yeah, I know about a few ways to do it, but they all seem to rely
on the DllImport attribute initialized with the name of the DLL to be called at compile-time.
For instance:
[DllImport("msvcrt.dll")]
in my case, I will not know the name of the unmanaged dll to be called
until run-time. The name of the dll will come from a config file.
So, imagine
string unmanagedDll = this.GetUnmanagedDllNameFromConfigFile();
and now, is there any way to *programmatically* do the equivalent of
[DllImport(unmanagedDll)]
?
Thanks in advance for any suggestion,
F.O.R.
|
|
|
|
|
|
Thanks, that might be just what I was looking for.
F.O.R.
|
|
|
|
|
I am planning a new project and got some great ideas on how to do things.
Since it is version 2.0 of the project and the whole application needs a rewrite (the first version is approx. 3 years old now and was done without a decent design) I might as well try something new.
I want to build the application using the 3-tier design: GUI, Business Logic and Data-Access. I want to make it possible to both use a database and a webservice for the data-access. Also I want to add offline-capabilities to the application so that if the webservice fails the users can continue their work as normal.
So far my testing with hand written proxy classes for the webservices and the classes for the database is going great. It really seams to work, you can switch between them without much hassle.
But my big question is, should I use datasets or should I write my own custom business logic classes. I like the dataset because it's a lot easier and it works great. Hand-made business classes are not really my favorite since I don't exactly know how to pick that up.
WM.
What about weapons of mass-construction?
|
|
|
|