|
I had a BHO appliaction (in-process dll injected in IE) which was developed in Vs2005 c#.
I had made an msi setup with the help of Setup and Deployment Project.
This was the installer class I had added in my project which generates the required dll...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using Microsoft.Win32;
using System.IO;
namespace BHOPDF
{
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Commit(System.Collections.IDictionary savedState)
{
base.Commit(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
protected override void OnCommitting(System.Collections.IDictionary savedState)
{
string regasmPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + @"regasm.exe";
string componentPath = typeof(Installer1).Assembly.Location;
System.Diagnostics.Process.Start(regasmPath, "/codebase \"" + componentPath + "\"");
base.OnCommitting(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
protected override void OnAfterInstall(System.Collections.IDictionary savedState)
{
base.OnAfterInstall(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
protected override void OnBeforeUninstall(System.Collections.IDictionary savedState)
{ string regasmPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + @"regasm.exe";
string componentPath = typeof(Installer1).Assembly.Location;
System.Diagnostics.Process.Start(regasmPath, "/u \"" + componentPath + "\"");
base.OnBeforeUninstall(savedState);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Uninstall(System.Collections.IDictionary savedState)
{
base.Uninstall(savedState);
}
}
}
The problem is after I uninstall my setup, and If I check the registry
"Software\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects"
my dll gets un-injected.
After uninstalling, and after sometime, If I check the registry again there my dll is visible as injected. How this is happened?
What was the mistake in the code, can anyone suggest something to solve this?
|
|
|
|
|
hi,
here's the layout:
- datagridview with 5 columns, last column is CheckBox Column.
the purpose :
- by pressing a button = deleting each row that has a marked CheckBox
the current algorithem :
if (dataGridView1.RowCount > 0)
{
for (int k = 0; k < dataGridView1.RowCount; k++)
{
if ((bool)dataGridView1.Rows[k].Cells[5].Value)
{
dataGridView1.Rows.RemoveAt(k);
}
}
}
the problem :
after the first deletion, the
"(bool)dataGridView1.Rows[k].Cells[5].Value"
throws this excption :
Object reference not set to an instance of an object.
anybody ???
THANKS
Have Fun
Never forget it
|
|
|
|
|
The problem is:
You count the rows. and pass as k, but the .rows[k] is zero based index, so you need to "Count -1"
Another method is:
foreach(DataGridViewRowsCollection dvrc in dataGridView1.Rows)
{
// To show how to contiune
// dvrc.cell[5]
}
|
|
|
|
|
1.
for (int k = 0; k < dataGridView1.RowCount; k++)
is'nt tha problem becase :
k < dataGridView1.RowCount
if i have 7 rows it'll start at 0 and at 6 becase 7<7 is false
2.
i've tried to change it to foreach, but still the same problem
3. thanks
Have Fun
Never forget it
|
|
|
|
|
Do it in reverse
dataGridView1.RowCount: i=0; i--
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
I got what the problem is:
example:
[0] Item 1
[1] Item 2
[2] Item 3
If [1] and [2] are checked:
After first delition:
[0] Item 1
[] Deleted Item2
[1] Item 3
In other words, when you delete items you have less items in Datagrid view. make another count within For and make sure it count++ when you delete items. and you do like [k-count]. at first count is 0, and more items you delete, higher count woud get and correct problem
|
|
|
|
|
first of all,
thanks for responding,
i've did managed to figure it out
thanks anyway
and have a cool week
Have Fun
Never forget it
|
|
|
|
|
Anyone can advice how to implement functions like the ones in the Character map utility to a font dialogue?
Im asked to develop the code page, the character "mapping" and in a font dialogue for extended function.
The problem i have is:
1. how to load the unicode or unicode subrange from the comp. i have no problem with loading the font.
2. how to create the data grid to show all the character with the effect of the font style and font type, just like the ones in the character map utility.
Thx in advance.
|
|
|
|
|
You can develop your own CharacterMapDialog. In which have you can use the character to implement and use it in your application.
1. You can convert the Ascii character to unicode by using ToUnicode Function.
2. Set All Controls Font style to according to selected font.
If you can think then I Can.
|
|
|
|
|
I was trying to disable back button of IE window in the following way but
the back button on top left corner of IE is not disabled.
document = (HTMLDocument)webBrowser.Document;
string javaScriptcode = "javascript:window.history.forward(1);";
IHTMLWindow2 parentWindow = document.parentWindow;
parentWindow.execScript(javaScriptcode, "javascript");
How can I do this
|
|
|
|
|
If you have a webbrowser control, you can just hide the back button. You can't stop a right click and back tho. Instead, you should fix your overall design.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
hi,
I want to ask how to get size of struct that I made?
ex:
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct MT_EVENT
{
public Int64 TimeStamp; // In FILETIME format
//public LARGE_INTEGER TimeStamp; // In FILETIME format
public uint UserStatus; // Not used by API
public uint EventCode; // Event Code
public uint SubReason; // Event sub-reason
public uint XtraInfo; // Extra information, e.g. termination
public uint FuncCode; // Function active when this event occurred
public uint Board; // Board ID
public uint Channel; // Global Channel ID (GCI)
public IntPtr ptrBuffer; // Related play/record buffer pointer
public uint DataLength; // Byte length of data accessed (played/recorded)
public IntPtr ptrXtraBuffer; // Pointer to xtra buffer
public uint XtraBufferLength; // Length of buffer pointed by ptrXtraBuffer
public uint XtraDataLength; // Length of data in buffer pointed by ptrXtraBuffer
public uint EventFlag; // Falgs of the following:
// bit 0x00000001: 1 - Appl created the event
// 0 - NTi DLL created the event
// bit 0x00000002: 1 - Appl allocated ptrtraBuffer
// 0 - NTi DLL allocated ptrXtraBuffer
}
|
|
|
|
|
can I use this:
MT_EVENT evt = new MT_EVENT();
uint length= (uint) Marshal.SizeOf(evt);
|
|
|
|
|
Yes, Marshal.SizeOf() Is equlant to sizeof() in c++ and c. It is used to call WinAPI.
But this needs to be before defining class:[StructLayout(LayoutKind.Sequential)]
Example:
[StructLayout(LayoutKind.Sequential)]
public class SomeClass
{
int i;
}
|
|
|
|
|
Hi,
if you are going to pass such a struct to the native world, that would be the way to go, yes.
BTW: the value will vary, depending on Win32/Win64 as an IntPtr is elastic.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Help me to validate datagrid view column to take only flaot value.
|
|
|
|
|
Let me see it's a cell and you want to validate it.
If only someone at Microsoft had the intelligence to to put an OnCellValidating event in the DataGridView, all your problems would be solved.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi All,
I've a DataSet and I want to display all the data(actually each row in the DataSet) in a list view. I've do the following.
<br />
foreach( DataRow dr in ds.Tables[0].Rows )<br />
{<br />
ListViewItem i = listView1.Items.Add(dr.Table.Rows[0]["ID"].ToString());<br />
<br />
i.SubItems.Add(ds.Tables[0].Rows[0]["Group"].ToString());<br />
i.SubItems.Add(ds.Tables[0].Rows[0]["FirstName"].ToString());<br />
i.SubItems.Add(ds.Tables[0].Rows[0]["LastName"].ToString());<br />
}<br />
ds is the DataSet. My question is, first row display all the time. Means the same row in all. Can someone comment on this.
Thanks a lot
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Solved my-self. Refer the wrong index all the time.
I do the following.
<br />
ListViewItem i = listView1.Items.Add(dr["ID"].ToString());<br />
<br />
i.SubItems.Add(dr["Group"].ToString());<br />
i.SubItems.Add(dr["FirstName"].ToString());<br />
i.SubItems.Add(dr["LastName"].ToString());<br />
Any comments appreciate?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Hi, would like to check with you guys regarding on ListView.
I done several research on Google for listview but cant find what i wanted.
Example my database have 12 records.
I want to display all 12 data into like a table form.
example
4 rows and 3 column
can anyone show me some sample please. thanks
|
|
|
|
|
It is a bit tricky. However I have done that.
Here I am taking a datatable as my datasource
Objective:
Col1 Col2 Col3
1 2 3
4 5 6
7 8 9
10 11 12
I hope you are asking something similar to this.
Approach:
Step 1:
Create a datatable with 3 columns and 4 rows in .cs file of .aspx page PageLoad event
DataTable dtSource = new DataTable();
#region Data Table Creation
dtSource.Columns.Add("Col1");
dtSource.Columns.Add("Col2");
dtSource.Columns.Add("Col3");
#endregion
#region Add Rows
dtSource.Rows.Add("1", "2", "3");
dtSource.Rows.Add("4", "5", "6");
dtSource.Rows.Add("7", "8", "9");
dtSource.Rows.Add("10", "11", "12");
#endregion
Step 2:
Drag & drop a list view in the .aspx page
<asp:ListView ID="myListView" runat="server">
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
</ItemTemplate>
</asp:ListView>
Step 3:
In the code behind, bind the ListView to the datasource(i.e. datatable)
myListView.DataSource = dtSource;
myListView.DataBind();
Step 4:
Create a user control whose .ascx will be
<table>
<tr>
<td>
<asp:Label ID="lblHeaderCol1" runat="server" Text="Col1"></asp:Label>
</td>
<td>
<asp:Label ID="lblHeaderCol2" runat="server" Text="Col2"></asp:Label>
</td>
<td>
<asp:Label ID="lblHeaderCol3" runat="server" Text="Col3"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblContentColumn1" runat="server"></asp:Label>
</td>
<td>
<asp:Label ID="lblContentColumn2" runat="server"></asp:Label>
</td>
<td>
<asp:Label ID="lblContentColumn3" runat="server"></asp:Label>
</td>
</tr>
</table>
Step 5:
In the code behind of the usercontrol(.ascx) expose some properties
#region Properties
public string Col1 { get; set; }
public string Col2 { get; set; }
public string Col3 { get; set; }
public int Counter { get; set; }
#endregion
As you can make out that the properties name are the same as the column names
Step 6:
In the Load event of the UserControl, consume those properties by the respective label controls
protected void Page_Load(object sender, EventArgs e)
{
lblContentColumn1.Text = Col1;
lblContentColumn2.Text = Col2;
lblContentColumn3.Text = Col3;
Counter = Counter + 1;
if (Counter > 1)
{
lblHeaderCol1.Text = lblHeaderCol2.Text = lblHeaderCol3.Text = String.Empty;
}
}
Step 7:
The last step is to call the user control from the .aspx page
Call it from within the item template
<ItemTemplate>
<uc1:MyUserControl ID="MyUserControl1" runat="server" Col1=<%# DataBinder.Eval(Container.DataItem, "Col1")%> Col2=<%# DataBinder.Eval(Container.DataItem, "Col2")%> Col3=<%# DataBinder.Eval(Container.DataItem, "Col3")%> Counter = <%# Container.DataItemIndex %> />
</ItemTemplate>
So the final ListView will look similar to this
<asp:ListView ID="myListView" runat="server">
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<uc1:MyUserControl ID="MyUserControl1" runat="server" Col1=<%# DataBinder.Eval(Container.DataItem, "Col1")%> Col2=<%# DataBinder.Eval(Container.DataItem, "Col2")%> Col3=<%# DataBinder.Eval(Container.DataItem, "Col3")%> Counter = <%# Container.DataItemIndex %> />
</ItemTemplate>
</asp:ListView>
What I am doing?
Basically I have exposed the properties from the user control similar to the columns available in the source and have kept a counter.
I am calling the user control from inside the item template ; so each time the user control will be iterated.
But in that case the headers will also be iterated. Inorder to make it unique, the counter is used which will allow the header to be displayed for only the first time.
N.B.~ This is one of the solutions that came in my mind instantly.
If if get a better idea, i will tell you that.
Or else, any kind of improvement from your side, is highly welcome.
Hope this helps.
Niladri Biswas
|
|
|
|
|
Hi, thanks for your reply..
But tts aspx issint it?
my is an .exe application
|
|
|
|
|
Hi man,
You should have mentioned that you are looking for windows based solution and not web based.
Thanks anyways.
Niladri Biswas
|
|
|
|
|
I have an application that crunches lots of data and during the processing, the
application crashes and I get a message that says "fileappend function failed."
I am not a programmer and hope I have the right forum. My apologies if I have
the wrong one...if I do, please direct me to the proper forum.
Any ideas on how to correct this problem will be greatly appreciated.
Pete Brittain
|
|
|
|