|
Hi,
I am developing an implementation that needs to disable TCP-IP on a network adapter and at the same get the MAC address of the same network adapter.
Currently I am getting the MAC address using the GetIfTable call from IPHlpApi.dll, and manually disabling TCP-IP from the adapter properties as soon as the MAC is acquired. (GetIfTable returns 0 when TCP-IP is disabled).
My aim is to keep using the GetIfTable,get the application to disable TCP-IP exactly after it gets the MAC, and renable it when the application is closed, however I have no clue how to automate this.
Any help or new ideas greatly apreciated.
Kind Regards,
Dav
|
|
|
|
|
i've created a contro with this property, i let the user can select an image for the control.
During the design time, it works.
But when i compile and try it on another pc i the image is not loaded.
So what i've to do after i load the image?
[EditorAttribute(typeof(MyFileNameEditor), typeof(UITypeEditor))]
[Category("Image state"), Description("Mouse over image")]
//[DefaultValue("")]
public string MouseMovePath
{
get
{
return MouseMove_path;
}
set
{
try
{
MouseMove_path = value;
FileStream fs = new FileStream(MouseMove_path, FileMode.Open, FileAccess.Read);
move = Image.FromStream(fs);
fs.Close();
this.Invalidate();
}
catch
{
MouseMove_path = "(none)";
}
}
}
|
|
|
|
|
I don't see how this would work properly. Your Image is being loaded from a FileStream that you're immediately closing with fs.Close() . An underlying stream has to be open for as long as the Image is in use. The next call to Invalidate() makes it try to refresh the image... but it can't, so I would expect an error thrown at that point.
--
I've killed again, haven't I?
|
|
|
|
|
Hi, I want to make the tab for my program flash in the taskbar, I have done some googling, and found the following code:
using System.Runtime.InteropServices;<br />
<br />
[DllImport("user32.DLL", EntryPoint = "FlashWindow")]<br />
public static extern int FlashWindow(int hwnd, int bInvert);
But unfortunately I have not been able to get it to do anything (calling it has no effect), in fact I don't even know what the int parameters refer to. Can anybody give me a prod in the right direction?
Thanks!
Martin
|
|
|
|
|
According to pinvoke.net the second parameter should be a bool. FlashWindow[^]
There's also a FlashWindowEx[^] function which might be more suitable for your needs.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Ah, most helpful, thank you very much!
|
|
|
|
|
Hi.
I need a complete article about software layers.
Best wishes
|
|
|
|
|
Write one
|
|
|
|
|
Hi.
I have a table in SQLServer 2005, that has two fields (Name,Family), for example.
I want in C# (VS 2005), write some lines of code to add a record to this table.
How can I do it?
(All in code)
Best wishes
|
|
|
|
|
|
Is there some code snippet that would reset local IIS when used?
Something like this one that starts browser from Windows application:
Process p = new Process();
p.StartInfo = new ProcessStartInfo("http://www.nba.com");
p.Start();
Tnx!
|
|
|
|
|
Process p = new Process();
p.StartInfo = new ProcessStartInfo("net", "stop w3svc");
p.Start();
p.WaitForExit();
p.StartInfo = new ProcessStartInfo("net", "start w3svc");
p.Start();
p.WaitForExit();
You can use net start/stop with any of these (taken from here[^]):
Iisadmin IIS Admin Service
Msftpsvc FTP Publishing Service
Nntpsvc Microsoft NNTP Service
Smtpsvc Microsoft SMTP Service
W3svc World Wide Web Publishing Service
|
|
|
|
|
Tnx a lot man, I owe you one
|
|
|
|
|
Hello,
Is there a way to create native exe from VS.NET? I have an application that would be used by a client who I don't think would have .NET framework.
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
You can't create a native exe from a .net language (without spending some money at least). If you want a native exe you'll have to write it in C++.
|
|
|
|
|
There's Bartok by Microsoft Research, but it's not available to public.
Best bet would probably be to tell them that the framework is part of Windows Update
|
|
|
|
|
I haven't seen non-commercial product but there are commercial products (like this one) that can produce native executable from .NET code.
|
|
|
|
|
i have a problem in writing a c# code for steganography detection and estimating the hidden message length for color palette images using Ezstego algorith written by J.fredrick or any other algorith if this is not availabe i need clues to begin writing the code please as soon as possible
na
|
|
|
|
|
Have you searched this site for information? Steganography on Code Project[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I am having a couple of issues with threading. I have a button that starts a thread (dosync).
private void syncbut_Click(object sender, EventArgs e)
{
Thread syncThread = new Thread(new ThreadStart(dosync));
syncThread.Start();
}
when i add this to the method i get an error: Paramater 0 is not valid for 'index'.
private void dosync()
{
int filePathList = listView1.Items[0].Index;
}
however if i use the function inside the button (and not use a thread) i don't get an error and the function works fine. Could someone help me with this?
thanx in advance!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
There must be something important that your didn't showed in this code (like loading items in that listView1 asynchroniously). However try to change your dosycn proc (you are accessing listView1 from worker thread which isn't good thing):
<br />
private void dosync()<br />
{<br />
if (InvokeRequired)<br />
{<br />
BeginInvoke(new MethodInvoker(dosync));<br />
return;<br />
}<br />
<br />
int filePathList = listView1.Items[0].Index;<br />
}<br />
If it doesn't help, please submit more info and I'll gladly help if I can.
c-ya
|
|
|
|
|
Hey, guys.
I'm looking for a lib, preferably something I can use via C#, that will do the text to speech thing & allow me to save it to an audio file. Anyone know what the latest, groovy (and free) tools are for such a thing?
Christopher Duncan
Practical Strategy Consulting
Author of
The Career Programmer
Unite the Tribes
-- modified at 13:22 Sunday 14th May, 2006
|
|
|
|
|
|
|
Hello,
I have a problem with this code. Signature error, but why?
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Runtime.InteropServices;<br />
using System.Windows.Forms;<br />
<br />
namespace EnumerateSingle<br />
{<br />
public struct EditStream<br />
{<br />
public long dwCookie;<br />
public long dwError;<br />
public Delegate pfnCallback;<br />
}<br />
<br />
class RichEditC<br />
{<br />
public const long WM_USER = 0x400; <br />
public const long EM_STREAMIN = (WM_USER + 73); <br />
public const long EM_STREAMOUT = (WM_USER + 74);<br />
public const long SF_TEXT = 0x1 ;<br />
public const long SF_RTF = 0x2;<br />
public const long SF_RTFNOOBJS = 0x3; <br />
public const long SF_TEXTIZED = 0x4;<br />
public const long SF_UNICODE = 0x10; <br />
public const long SF_USECODEPAGE = 0x20;<br />
public const long SF_NCRFORNONASCII = 0x40;<br />
<br />
public delegate long RTFCallback(long dwCookie, long pbBuff, long cb, long pcb);<br />
<br />
public string buffText;<br />
<br />
[DllImport("User32.dll")]<br />
public static extern long SendMessage(long hWnd, long wMsg, long wParam, ref EditStream lParam);<br />
<br />
[DllImport("User32.dll")]<br />
public static extern void CopyMemory(object Destination, object source, long length);<br />
<br />
public static long EditStreamCallback(long dwCookie, long pbBuff, long cb, long pcb)<br />
{<br />
StringBuilder buff = new StringBuilder((int)cb);<br />
<br />
<br />
switch(dwCookie)<br />
{<br />
case 999:<br />
{<br />
CopyMemory(buff, pbBuff, cb);<br />
pcb = cb;<br />
return 0;<br />
<br />
}<br />
default:<br />
{<br />
return -1;<br />
<br />
}<br />
<br />
}<br />
}<br />
}<br />
}
And the Clientcode:
private void button3_Click(object sender, EventArgs e)<br />
{<br />
RichEditC.RTFCallback myRtfCallback = new RichEditC.RTFCallback(RichEditC.EditStreamCallback);<br />
<br />
EditStream es = new EditStream();<br />
es.dwCookie = 999;<br />
es.pfnCallback = myRtfCallback;<br />
<br />
RichEditC.SendMessage(0x80524, RichEditC.EM_STREAMOUT, RichEditC.SF_TEXT, ref es);<br />
<br />
}<br />
<br />
public long FARPROC(long pfn)<br />
{<br />
return pfn;<br />
}
Is "ref es" written in the wrong way? MSDN says that LPARAM for this SENDMESSAGE Action is a Structure, but I've defined it correctly.
Maybe anybody can help me with this problem. Thanks in advance.
|
|
|
|