|
Why not use Console.Beep ?
Along with what the others say, the user may have the speakers physically turned down or off.
Or headphones could be plugged in but the user not wearing them.
There is also the possibility that the user is remoted into a system halfway 'round the world.
Perhaps you could allow the user to set a configuration setting to specify the volume to use.
For one application I wrote for a former employer I allowed the user to specify what sound to make (if any) as an alert.
|
|
|
|
|
Jassim Rahma wrote: even if Microsoft Windows volume is switched to mute?
Make sure you weld the PC-case shut. I'd rip that speaker out before you have the correct P/Invoke.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
if Microsoft Windows volume is switched to mute?
first you can change volume to 100% for playing sound and then change it back to 0%.
-Amir Mohammad Nasrollahi
/* LIFE RUNS ON CODE */
|
|
|
|
|
Hi,
I have problem with adding asp.net usercontrol in Usercontrol.
The 1st user control is DataList where the Companies are listed.
Now i need another usercontrol inside this one where i will list the products from each Company.
hope some one will explain how to combine this 2 controls or tell me some easy way to do this.
thanks
|
|
|
|
|
You should not post your questions in multiple places. ASP.NET UserControl In UserControl[^]
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
Hi,
I am creating a setup project for my solution in C#, and I created a merge module that include all obfuscated assembly files (.dll files, and the .exe file), then add it to the setup project
Before building the setup project, I replace assembly files (in the Bin/Debug) by obfuscated files. After building the project, .dll files still are obfuscated, however the .exe file isn't obfuscated.
Are there anyone know how to fix that ?
Thank you very much !
|
|
|
|
|
I suspect, from this question, that you are manually obfuscating the file. When your setup is built, though, it rebuilds the executable, so that the file is no longer obfuscated - (you'll see the same behaviour if you manually apply a certificate to your code). The trick is to run the obfuscation process as a PostBuild process - which means that the setup will get the obfuscated version.
|
|
|
|
|
Thanks Pete very much,
Could you please tell me more how to use PostBuild process ?
I'm using the Crypto Obfuscator software to obfuscate assembly files.
And I can see the properties of Setup project include the PostBuildEvent but I don't know how to use it (I am using Visual Studio 2010)
Thanks and regards,
Tai
|
|
|
|
|
|
Hi Pete, thank you
Could you tell me more detail about creating obfuscated setup project ?
My solution includes some project:
1. Start up project (create application file)
2. Library projects (create dll files)
3. Merge project (include obfuscated assembly files)
4. Setup project
Thanks and regards,
|
|
|
|
|
Hi, You can drag and drop the project file to Eazfuscator.Net and it will handle the Obfuscation of your binaries every time you compile with release, if you are using different Obfuscator check how to obfuscate the project file, I believe rebuilding your solution is recompiling the .exe and overwrite your Obfuscated .exe then the setup project will include the new non-Obfuscated file.
|
|
|
|
|
Thanks Samer,
I am trying to use Crypto Obfuscator and Dotfuscator. I only rebuild setup project (not the solution) but it make the .exe recompiling. I don't know why ?
|
|
|
|
|
how to perform update and delete operations on a grid view in which the data is already bounded on the time of page load
here is my code:
<asp:GridView ID="gvUsers" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
OnRowEditing = "gvUsers_RowEditing" OnRowDeleting = "gvUsers_RowDeleting" OnRowUpdating = "gvUsers_RowUpdating" >
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
c# Code:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Office"] == null)
{
Response.Redirect("Login.aspx");
}
else
{
Session.Timeout = 1;
L1.Text = "District: " + Session["district"].ToString();
L3.Text = "Department: " + Session["department"].ToString();
L4.Text = "Office: " + Session["Office"].ToString();
con.Open();
if (Session["department"].ToString() == "NIC")
{
SqlCommand cmd1 = new SqlCommand("select * from DeptMaster", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd1);
SqlCommandBuilder cmb = new SqlCommandBuilder(da);
da.Fill(ds, "deptmaster");
gvUsers.DataSource = ds.Tables["deptmaster"];
gvUsers.DataBind();
}
else
{
SqlCommand cmd1 = new SqlCommand("select * from OfficeMaster where Office ='" + Session["Office"].ToString() + "'", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd1);
SqlCommandBuilder cmb = new SqlCommandBuilder(da);
da.Fill(ds, "deptmaster");
gvUsers.DataSource = ds.Tables["deptmaster"];
gvUsers.DataBind();
}
con.Close();
}
}
Mohan@Coding.com
|
|
|
|
|
Hi,
This question looks like ASP.Net not C#, you might get a better answer, if you ask this question under ASP.Net category
Jegan
Think! Don't write a line of code unless you absolutely need to.
|
|
|
|
|
I thought I would show you guys a quick tutorial on how to build native cocoa apps using C# and MonoMac. I will be showing you how to make the famous "Hello World" app.
Lets Begin!
You will need the following:
MonoDevelop IDE
MonoDevelop Framework SDK
XCode 4.x
One you have those, open up MonoDevelop. Click on "new solution" Drop down the C# category and select "Mac (open source)" and create a MonoMac project.
Now once that is done you should have some files and folders. Double click the MainWindow.xib file and XCode should open. Add a button and a label. Now click the middle button above Editor in the top right of XCode. Find "Automatic" and click on it and go to "MainWindowController.h" Now right click and drag the button to the code and add an outlet called "guiButton" or whatever you want. Do the same with the label. Now right click and drag from the button again but this time select action and name it "buttonClicked."
Ok, that's done. Save and close XCode. Now go back to MonoDevelop and open MainWindow.designer. A bunch of new code should have been added. Verify that the outlets and action have been added before continuing.
Your file should look like this:
using MonoMac.Foundation;
namespace dontgivemeerrors
{
[Register ("MainWindowController")]
partial class MainWindowController
{
[Outlet]
MonoMac.AppKit.NSTextField guiTextField { get; set; }
[Outlet]
MonoMac.AppKit.NSButton guiButton { get; set; }
[Action ("buttonClicked:")]
partial void buttonClicked (MonoMac.Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (guiTextField != null) {
guiTextField.Dispose ();
guiTextField = null;
}
if (guiButton != null) {
guiButton.Dispose ();
guiButton = null;
}
}
}
[Register ("MainWindow")]
partial class MainWindow
{
void ReleaseDesignerOutlets ()
{
}
}
}
Ok, now open MainWindowController.cs and find "#endregion" Go under it and add the following line of code:
partial void buttonClicked (MonoMac.Foundation.NSObject sender)
{
}
Replace "buttonClicked" with name of your action. Now for the final step. Add this to that line of code:
partial void buttonClicked (MonoMac.Foundation.NSObject sender)
{
this.guiLabel.StringValue = "Hello World";
}
Now run the app by pressing the icon with 2 gears and a green gear on the top right of MonoDevelop. Press the button and the label text should change to "Hello World."
Thats it. Most of your code will be under the action void. To find your .app file, go to YourUserName -> Projects -> NameOfProject -> NameOfProject -> bin -> Debug
Happy Coding!
- Team HsM
HSM
|
|
|
|
|
Great! This is not the place for it though. Write it up as a tip/trick, or if oyu go into a lot more detail, an article.
|
|
|
|
|
24 hours from now this will be multiple pages deep in the forum, never to see the light of day again. As Dave suggested write it up as a tip/trick where it will come up as a result in the search most of us use.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hello there... please how kind design program that identifies the head from the image save in the computer
|
|
|
|
|
|
Something went wrong in trying to upvote your answer. I'll try again. It is kind of hard using this new interface from my Galaxy Tablet 7.
Edit: Seems I've got it right this time.
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
No problem. I have trouble doing that on my phone too. The new arrows are especially tricky because they only appear on mouse-over
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
|
I am trying to customize default windows scrollbar in combobox like below.
public partial class ComboEx : ComboBox
{
internal ScrollbarEx vScrollBar;
NativeListWindow listControl;
public ComboEx()
{
InitializeComponent();
DropDownHeight = 100;
vScrollBar = new ScrollbarEx();
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
}
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
COMBOBOXINFO combInfo = new COMBOBOXINFO();
combInfo.cbSize = Marshal.SizeOf(combInfo);
Win32.GetComboBoxInfo( this.Handle, ref combInfo );
listControl = new NativeListWindow(this, combInfo.hwndList);
}
protected override void WndProc(ref Message m)
{
if (m.Msg == (Win32.WM_REFLECT + Win32.WM_COMMAND))
{
if (Win32.HIWORD( (int)m.WParam ) == Win32.CBN_DROPDOWN)
{
COMBOBOXINFO combInfo = new COMBOBOXINFO();
combInfo.cbSize = Marshal.SizeOf(combInfo);
Win32.GetComboBoxInfo( this.Handle, ref combInfo );
vScrollBar.Location = new Point( this.Width-23, 1 );
vScrollBar.Size = new Size( 23, DropDownHeight );
vScrollBar.Visible = true;
Win32.SetParent(vScrollBar.Handle, combInfo.hwndList);
Win32.ShowWindow(vScrollBar.Handle, ShowWindowCommands.Show);
Win32.SetWindowPos(vScrollBar.Handle,HWND.TopMost, 155, 1, 23, 105, SetWindowPosFlags.SWP_SHOWWINDOW);
}
}
base.WndProc(ref m);
}
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
internal class NativeListWindow : NativeWindow
{
private const int WS_CHILD = 0x40000000,
WS_VISIBLE = 0x10000000,
WM_ACTIVATEAPP = 0x001C;
private int windowHandle;
private ComboEx parent;
public NativeListWindow(ComboEx owner,IntPtr handle)
{
AssignHandle(handle);
parent = owner;
}
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
protected override void OnHandleChange()
{
windowHandle = (int)this.Handle;
}
private void AdjustClientRect(ref RECT rect)
{
rect.right -= 23;
}
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
protected override void WndProc(ref Message message)
{
switch (message.Msg)
{
case Win32.NCCALCSIZE:
{
if (message.WParam != IntPtr.Zero)
{
NCCALCSIZE_PARAMS rcsize = (NCCALCSIZE_PARAMS)Marshal.PtrToStructure(message.LParam, typeof(NCCALCSIZE_PARAMS));
AdjustClientRect(ref rcsize.rect0);
Marshal.StructureToPtr(rcsize, message.LParam, false);
}
else
{
RECT rcsize = (RECT)Marshal.PtrToStructure(message.LParam, typeof(RECT));
AdjustClientRect(ref rcsize);
Marshal.StructureToPtr(rcsize, message.LParam, false);
}
message.Result = new IntPtr(1);
return;
break;
}
case Win32.WM_NCMOUSEMOVE:
{
base.WndProc(ref message);
Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
break;
break;
}
case Win32.WM_NCLBUTTONDOWN:
{
base.WndProc(ref message);
Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
break;
}
case Win32.WM_NCACTIVATE:
{
base.WndProc(ref message);
Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
break;
}
case Win32.WM_NCMOUSELEAVE:
{
base.WndProc(ref message);
Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
break;
}
case Win32.WM_NCLBUTTONUP:
{
base.WndProc(ref message);
Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
break;
}
case Win32.WM_NCHITTEST:
{
base.WndProc(ref message);
Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
break;
}
case Win32.WM_MOUSEMOVE:
{
base.WndProc(ref message);
if ((int)message.LParam > 0)
{
int x = Win32.LOWORD((int)message.LParam);
int y = Win32.HIWORD((int)message.LParam);
RECT rect = new RECT(); ;
Win32.GetWindowRect(new HandleRef(parent.vScrollBar, parent.vScrollBar.Handle),out rect);
Rectangle rc = new Rectangle(parent.vScrollBar.Location.X, parent.vScrollBar.Location.Y,
(rect.right - rect.left), (rect.bottom - rect.top));
if (rc.Contains(new Point(x, y)))
{
Win32.SetFocus(parent.vScrollBar.Handle);
Win32.SetWindowPos(parent.vScrollBar.Handle, HWND.TopMost, 155, 1, 23, 105, SetWindowPosFlags.SWP_SHOWWINDOW);
Win32.SendMessage(parent.vScrollBar.Handle, (uint)message.Msg, message.WParam, message.LParam);
}
}
break;
}
}
base.WndProc(ref message);
}
}
}
In the above code, I did the following 1. created a NativeWindow to catch the messages of combobox listcontrol by assigning combInfo.hwndList handle. 2. Placed my custom scrollbar(ScrollBarEx) in the non-client area of combobox listcontrol.
But my custom scrollbar(ScrollBarEx) doesn't receives any messages or focus. It looks like it is dead. Please look into this code and share some idea to make the scrollbar live.
|
|
|
|
|
Probably not the answer you are looking for, but Win32 / Winforms scrollbars are extremely tricky to skin. Win32 / Winforms in general is extremely tricky to skin well. It would behoove you to move to WPF for this. The entire concept of WPF is that everything can be easily skinned without you having to write any C# code (assuming you are not changing behavior). All done via XAML.
|
|
|
|
|
Sorry I can't switch to WPF. Is there any idea to achieve this in winforms?
|
|
|
|
|