|
Have a look at this[^] article - DirectX may provide you with what you are looking for.
|
|
|
|
|
I was reading about
1. WMI and WMI providers
2. Filewatcher class in DotNet
I have a question.
I I should be able to a DotNet application that uses filewatcher class to track changes
to a file name (rename).
I would like to to have my tracking application running all the time.
I want my tracking application to make use of WMI concept to generate a 'peep ... peep'
sound when a file is renamed.
Is this feasible.
That I need WMI is a guess.
Or is it that to do this I do not have to use filewatcher at all and I just need the WMI?
Reg
|
|
|
|
|
You need to handle the Renaming event of the FileSystemWatcher and use SoundPlayer class in it to play the sound.
|
|
|
|
|
Hi danish,
about using SoundPlayer class in it to play the sound
So there is no WMI here?
Regards,
NetQuestions
|
|
|
|
|
No you do not need to use WMI. There are already pre defined set of classes that can do the work.
|
|
|
|
|
I am using SQL Reporting services, it's working perfectly and shows a print button in IE, but not shown in Mozilla Firefox
|
|
|
|
|
Here is one for you Win32 experts. When I as a Framework developer need to use a Win API function, I can declare the function with parameters I need rather than with strict type checking.
For example, check out the underlined code in SendMessage()
<br />
[DllImport("user32.dll", CharSet = CharSet.Auto)]<br />
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);<br />
<br />
[DllImport("user32.dll", CharSet = CharSet.Auto)]<br />
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, StringBuilder lParam);<br />
StringBuilder? Hello? What perplexes me is that the API is expecting a pointer but we pass in a .NET StringBuilder.
Please explain to a semi-newbie what dark magic allows this to happen.
Thank you.
Gordon
|
|
|
|
|
That one is pretty simple, at least on the surface: all the compiler does is check consistency between your calling code and the prototype(s) you provide (both in C# or VB.NET), as if the native method were a managed one (but with the implementation lacking).
The compiler never looks at the DLL file at all, it does not even have to be present while building. At run-time what gets passed is not type-checked at all, so whether it is an array pointer, a StringBuilder reference, or an IntPtr, as long as it points to the actual data, it could work.
FYI: there may be some data conversion going on behind the scene, e.g. when the data passed is a string and the native method uses ANSI (8-bit!), the "Marshaling" will convert to/from Unicode (16-bit) for you automaticaally (using a temporary buffer, so also faking the pointer value!).
|
|
|
|
|
|
you're welcome.
|
|
|
|
|
Luc's given you a brilliant answer!
In my experience, anything that takes the same memory footprint can be used. This makes int/uint (4 bytes), or even long/Size (8 bytes) interchangable.
In the case of pointers, any reference type (or value type if used with ref [or out depending on the situation]) will work as it's the pointer to the object that's passed not the value pointed to.
Whether the value stored at the address can be understood on the native side or managed side once returned is another matter of course!
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
|
|
The .NET P/Invoke marshaller has special knowledge about some types.
For example when passing a String, it passes the pointer to the string data, not the pointer to the managed string object.
When passing a StringBuilder, the .NET marshaller passes a pointer to the StringBuilder's internal buffer.
Another useful idiom is the SafeHandle: you can create your own SafeHandle-derived class and directly use that in P/Invoke signatures. The .NET marshaller will pass the underlying handle (IntPtr) instead. This is extremely useful because it avoids a number of problems: for example the finalizer could run when there are no active references to your object, but the underlying handle is still being used in a P/Invoke call. Using a SafeHandle directly in the P/Invoke signature makes the GC aware that the handle is used during the lifetime of the P/Invoke call, and it'll avoid finalizing the object until the call is complete.
|
|
|
|
|
When passing a StringBuilder, the .NET marshaller passes a pointer to the StringBuilder's internal buffer.
This is the voodoo that had me baffled the most. To the .NET developer, the StringBuilder is a sophisticated managed class, but somehow the API is able to treat is like a char* (I think).
Thank you!
|
|
|
|
|
Hi,
I am in need of customizable menu,where user can change the parent and child menu at any time in a UI.Also he can grant or revoke permission for a menus or sub-menu based on user group.
Need some url ,,,,,
Thanks
Guhananth.S
|
|
|
|
|
You should start here[^]. In the top 10 is a CodeProject article, I suggest you read it. And some of the others as well.
|
|
|
|
|
|
I need to read the Comments, Keywords (Description) in the metadata of a JPG file and then be able to write a modified comment. This is proving tricky and help would be appreciated. This metadata is that which appears when the image is right-clicked and these tags can be changed there.
What I am after is to be able to edit EXIF in JPG images, but I cant find any information in VB.
modified on Monday, August 9, 2010 8:28 AM
|
|
|
|
|
I have an updatepanel with 3 dropdownlist and the selected item from the 1st one binds the 2nd, the selected item from the 2nd binds the 3rd and so on. For example you select a state and then the 2nd ddl has the list of cities in that state.
Well when a state is selected, the 2nd shows all the cities but the problem is that I can not select another city. The first on will always be selected and cb2_SelectedIndexChanged doesnt fire.
Thanks,
Martin
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:DropDownList ID="cb1" runat="server" AutoPostBack="true" />
<asp:DropDownList ID="cb2" runat="server" AutoPostBack="true" />
<asp:DropDownList ID="cb3" runat="server" AutoPostBack="true" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cb1" EventName="SelectedIndexChanged" />
</Triggers>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cb2" EventName="SelectedIndexChanged" />
</Triggers>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="cb3" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
|
|
|
|
|
|
Don't use multiple Triggers tags. If that isn't the source of your problem it is as least making it tougher to read your code. And if these dropdowns are the only things in the UpdatePanel you should consider just settings ChildrenAsTriggers and not even bother with the individual ASyncPostBackTrigger elements.
|
|
|
|
|
|
<quote>*Contents of removed message*
i created mysqldump application using C#. it is saving to some path which i given. but how to make that application to save automatically like every 3 or 4 hours daily. i written code like below
public void Dump()
{
try
{
DateTime Time = DateTime.Now;
int year = Time.Year;
int month = Time.Month;
int day = Time.Day;
int hour = Time.Hour;
int minute = Time.Minute;
int second = Time.Second;
int millisecond = Time.Millisecond;
string path;
path = "E:\\BackupMysql1\\" + year + "-" + month + "-" + day + "-" + hour + "-" + minute + "-" + second + "-" + millisecond + "_temple.sql";
StreamWriter file = new StreamWriter(path);
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqldump";
psi.RedirectStandardInput = false;
psi.RedirectStandardOutput = true;
psi.Arguments = string.Format(@"-u{0} -p{1} -h{2} {3}", "xyz", "abcd", "localhost", "database");
psi.UseShellExecute = false;
Process process = Process.Start(psi);
string output;
output = process.StandardOutput.ReadToEnd();
file.WriteLine(output);
process.WaitForExit();
file.Close();
process.Close();
}
catch (IOException ex)
{
MessageBox.Show("Error , unable to backup!");
}
}
anybody knows please reply me.
*End*
The easy way to do this is to use a scheduled job in the windows scheduler that is set to run at a set interval. Don't muck about attempting to write code to do this when the OS provides a perfectly serviceable method.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
modified on Friday, August 13, 2010 12:24 PM
|
|
|
|
|
Hello,
I have a special requirement where I need to show grouped data in expandable form. For eg:
Order Date Total Amt
+ 1 05/06/2010 100.00
Item Qty Rate Amt
A 5 10 50.00
B 2 25 50.00
This format we normally see in Access when the data is grouped or a primary key of table A is the foreign key of table B. If I clikc "+" sign next to order #, I get to see the item details belonging to that order. If the order is already expanded "-" sign lies and if their are no item details pertaining to any order their should be no sign.
I know I can do this format using Tree, but that looks too off profesional.
Can you suggest me any idea to implement this using Vb.NET.
Thanks,
Thanks & Regards,
|
|
|
|