|
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?
|
|
|
|
|
Oh well. In that case, you are in for a world of hurt lol . The common controls interact with the *real* internal window scrollbar, not your external scrollbar control, so you need to customize the internal one. The internal window scrollbar is not a control, but rather painted as part of the WM_NCPAINT process, so you'll need to override that and do all your own painting for the ENTIRE non client area.
BE WARNED: There is a major gotcha that people don't know about until they try to implement this. I only know about it because I've done it in the past ...
You [B]***CANNOT***[/B] achieve custom scrollbars without API hooking. No way, no how, no workaround that. Reason being is that Windows implements the scrollbars like this:
case WM_NCPAINT:
{
// random code to do random stuff
DrawScrollBars();
// more random code to do random stuff
break;
}
Now, thats all well and good, you could override the WM_NCPAINT message and prevent the stock DrawScrollBars() function from getting called.
However, the internal scrollbar functions that the common controls use do not go through WM_NCPAINT , they call DrawScrollBars() directly and there is no way to bypass that without API hooking .
So what you'll get is you'll get your pretty new scrollbars 75% of the time and the stock scroll bars flashing through 25% of the time.
Like I said, switch to WPF (or find an API hooking library).
|
|
|
|
|
My c# console app calls a managed c++ dll. The dll is added as a reference to the c# project. If I try to start in debug mode it says error while trying to run project. unable to start program, unrecognized error in windows web service framework. It is not a web application. If I run without debugging, the console pops up and my dll produces an error that the hdf5 header files don't match the hdf5 library my c++ dll is linked to (though it compiles and builds just fine). Both c# driver and c++ dll are 64 bit on a 64 bit machine. Both the F5 and ctrl F5 errors are puzzling. Any ideas what i should do to fix?
thanks,
saroj
|
|
|
|
|
Hi,
I am using the following code to activate existing MDI child and refresh the grid at the same time. It was working fine until today but suddenly I am getting:\
System.NullReferenceException occurred
Message=Object reference not set to an instance of an object.
Source=Cure
StackTrace:
at cure_hospital_management.frmMain.repositoryItemFindFile_KeyDown(Object sender, KeyEventArgs e) in C:\Users\DELL USER\Documents\Visual Studio 2010\Projects\Cure\Cure\main_form.cs:line 1718
InnerException:
here is the code:
if (e.KeyCode == Keys.Enter && (sender as TextEdit).Text.Trim() != "")
{
this.Cursor = Cursors.WaitCursor;
is_form_exists = false;
foreach (Form search_resul_form in this.MdiChildren)
{
frmSearchResult search_form = search_resul_form as frmSearchResult;
if ((string)search_form.Tag == "BROWSE_PATIENTS")
{
search_form.find_what = "FILE";
search_form.find_text1 = (sender as TextEdit).Text.Trim();
search_form.find_text2 = null;
search_form.browse_result();
search_form.Activate();
is_form_exists = true;
break;
}
}
if (is_form_exists == false)
{
frmSearchResult SearchResultForm = new frmSearchResult(public_var);
SearchResultForm.Tag = "BROWSE_PATIENTS";
SearchResultForm.MdiParent = this;
SearchResultForm.Dock = DockStyle.Fill;
SearchResultForm.find_what = "FILE";
SearchResultForm.find_text1 = (sender as TextEdit).Text.Trim();
SearchResultForm.find_text2 = null;
SearchResultForm.Show();
}
(sender as TextEdit).Text = "";
this.Cursor = Cursors.Default;
}
Technology News @ www.JassimRahma.com
|
|
|
|
|
So, did you look at line 1718?
|
|
|
|
|
this the line:
if ((string)search_form.Tag == "BROWSE_PATIENTS")
Technology News @ www.JassimRahma.com
|
|
|
|
|
foreach (Form search_resul_form in this.MdiChildren)
{
frmSearchResult search_form = search_resul_form as frmSearchResult;
if ((string)search_form.Tag == "BROWSE_PATIENTS")
{
You will have to put in a break point and examine all the objects that may be null. Bear in mind that the error could have occurred before line 1718.
1) search_resul_form as frmSearchResult, will be null if search_resul_form is not a frmSearchResult or a derived type.
2) ((string)search_form.Tag == "BROWSE_PATIENTS" could fail for two reasons. Either search_form or Tag is null.
Alan.
|
|
|
|
|
I have noticed the following:
if I start the application and then invoke the searcH_form then invoke any other form then call the search_form it will be activated normally without a problem
but If I start the application then call anyother form and then try to call the search_form then thsi error will occur.
Technology News @ www.JassimRahma.com
|
|
|
|
|