| Finding the URL being viewed in IE from a PID or hWnd |
|
 |
Index ‹ DotNet ‹ Net Framework
|
- Previous
- 1
- 2
- Visual C#.Net >> IDispose problemHello
I'm trying to create a class that uses northwind database and use the
IDisposable interface thingy :)
Can someone explain why I get:
Error 1 'Procent.DataJox.Northwind' does not implement interface member
'System.IDisposable.Dispose()' C:\Documents and Settings\Administrator\My
Documents\Visual Studio 2005\Projects\DataJox\DataJox\Class1.cs 10 18
Procent.DataJox
and (on the using(Open()) row):
Warning 2 Possible mistaken empty statement C:\Documents and
Settings\Administrator\My Documents\Visual Studio
2005\Projects\DataJox\DataJox\Class1.cs 16 26 Procent.DataJox
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.ComponentModel;
using System.Data.SqlClient;
namespace Procent.DataJox
{
public class Northwind : IDisposable
{
private bool disposed = false;
public DataSet GetAllCustomers()
{
using(Open());
// some code here to get data
}
private void Open()
{
string connstr =
"server=localhost;database=northwind;trusted_connection=true;";
SqlConnection dbconn = new SqlConnection(connstr);
}
private void Dispose()
{
Dispose(true);
}
private void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
component.Dispose();
}
CloseHandle(handle);
handle = IntPtr.Zero;
}
disposed = true;
}
~Northwind()
{
Dispose(false);
}
}
}
- 3
- Visual C#.Net >> Working set increasesEnvironment: Windows Server 2003 EE, .Net Framework 1.1, C#
I have a problem of memory usage growing continuously.
Basically, my application is a windows service that polls a webservice
method. This method returns a string array which is normally empty, and no
action is performed. Every 30 secs (polling time) the memory usage raises of
few KB.
Do you have any idea about what can cause this working set increment?
I report here the code of the timer event handler for who feels like having
a look.
// Timer.Elapsed event handler
public static void OnTimedEvent(object source, ElapsedEventArgs e)
{
timer.Enabled=false;
IniData ini=IniData.Instance(); // initialization class (singleton)
Logger log=Logger.Instance(); // log class (singleton)
try
{
WebService jgpm=new WebService(); // The web service is secured by using
https and certificates
X509Certificate x509 =
X509Certificate.CreateFromCertFile(ini.getCerFileName());
jgpm.ClientCertificates.Add(x509);
jgpm.Url=ini.getWsUrlRoot()";
string s=x509.GetName();
string[] tickets=jgpm.getOrders(s); // WEB SERVICE METHOD
foreach (string ticket in tickets) // tickets is normally empty and the
statement is not executed
{
// ticket elaboration
}
}
catch (Exception exc)
{
log.Debug(exc.Message);
}
timer.Enabled=true;
}
- 4
- ADO >> Configuration.AppSettims returns NothingHi - can anyone please help this is driving me up the wall!! I have a config file
<?xml version="1.0" encoding="utf-8"?><configuration><appSettings><add key="connectString" value="server=DEV1-SMCT\NIIR;database=DBName;uid=username;password=password" /></appSettings></configuration
(In final release I won't have passwords in this!!
And when I load my first form I try and retrieve the value usin
str_Connection = ConfigurationSettings.AppSettings("connectString"
And every time this returns Nothin
I also tried the line str_Connection = ConfigurationSettings.AppSettings.Item("connectString").ToString but just gives an error because the object is nothing
I hope someone can point the obvious that I must be missing!
Thank
Siobha
PS Apologies - I am posting this again as I originally posted as a response to someone elses old post - just in case it doesn't get spotted
- 5
- Visual C#.Net >> A More Effecient Threading?I am working with an application that requires multithreading. I have found
a sample online that I am currently working with/learning from. However, I
am not sure if this is the most effecient way or most current way of
threading. Here is the sample I have found. I'd appreciate any
feedback/recommendations on better ways to use threading if this sample will
not suffice:
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
int iFrom = 0;
int iTo = 5;
LA = new LH[iTo - iFrom + 1];
for (int i = iFrom; i <= iTo; i++)
{
//class defines thread start routine and data
LH Line = new LH();
LH[iTr - iFrom] = Line;
//pass parameters to the new thread
Line.iTr = i;
Line.MainForm = this;
ThreadStart ts = new ThreadStart(Line.ProcessingThread);
Thread wrkThread = new Thread(ts);
Line.CurrentThread = wrkThread;
wrkThread.SetApartmentState(ApartmentState.STA);
//default is MTA
wrkThread.Name = i.ToString(); //for easier tracing
wrkThread.Start();
Thread.Sleep(2000); //add some time for processing
}
}
public class LH
{
public Form1 MainForm = null;
public int iTr = -1;
public Thread CurrentThread = null;
public void ProcessingThread()
{
int iThreadId = CurrentThread.GetHashCode();
try
{
//events here
}
catch (COMException e)
{
return;
}
catch (Exception e)
{
return;
}
Application.Run();
}
}
Thanks for the assistance.
- 6
- Net Framework >> System vs System.ObjectHi,
I have got a general question regarding the base class
library. From what I have read so far, most classes in the
base class library (and indeed custom created classes)
inherit from the System.Object namespace. And System is
the primitive type. So, what are the relationship between
this two?
What other "primitive" types are there beside
System? 'Micosoft'?
Thanks in advance.
- 7
- Net Framework >> dialer in asp.netHi,
I'm developing an web application with Visual Studio .NET 2003
using c#.
How can i give to the user an option to use a button
that will dial a phone number
(like the dialer in access)
Thanks
- 8
- Microsoft Project >> Time Phased Fields1. I am trying to customize the forms and I would like to have the resource
names listed seperately for each task.(i.e) When the field "resource names"
is selected from the list of available fields all the resources names are
listed.
2. In the "Task Usage" view work of various resources are listed in the
"Details" pane. I would like to enter the "Actual Work" under various dates,
through a form. To perform this, I would like to know under which field these
datas are stored? (i.e) the actual work and the dates. When I try storing the
project file as a Access database also, I am not able to retrieve the data.
Kannan
- 9
- 10
- Microsoft Project >> links between projectsI have questions regarding MS Project that I am hoping to get the answers soon.
1.While de-linking an external task from master plan, it does not delete the
reverse link from the child project. While opening the master plan, warning
keeps coming for re-enforcing the deleted link.
2. 'Need date change email notification' macro gets fired even if there is
no change in need date.
- 11
- Visual C#.Net >> TrackBar ChangesHi,
I have a track bar that I wish to move between 0 and 100 in increments of
10, is there a setting for this? I have tried altering the smallchange
attribute and largechange! I think I am missing something obvious!
thanks
- 12
- Visual C#.Net >> Need help with Reflection from static method and child-classHi,
Suppose I have the following pseudo-class-ish code:
class A
{
member1;
member2;
public static Method() { return member1; }
}
class B : A
{
public static string Xxstring = "XXXXX";
B()
{
member1 = Xxstring;
member2 = Xxstring + Xxstring;
}
}
Now if I do the following:
B.Method() it will not work (return null) because the B's constructor was
not called as a result of the operation.
So I was hoping if there was some way i can determine from inside A.Method
that it was called from B and then I could get the type in B, and then
replace the member1 call with the Xxstring.
I have 80 or so child-classes of type A in my code and was hoping i could
refactor by doing this. Thanks.
- 13
- ADO >> AdapterI need use adapter to update a database. However, the
table column contain an Indentity column which need
run "Set indentity_insert ON" first during the SAME
SESSION.
This is what I use:
sqlconn.open
sqlcmd.executenonquery ' run Set ... on
sqladapter.update(.....)
The adapter statement gave message that the indenity
column still off.
Anything wrong, any suggestion?
Ying
- 14
- ADO >> how to retrieve ddl script from a db object..?Hi,
How to get (plain text) ddl script for databese objects in a sql server db..?
for example:
CREATE TABLE [dbo].[T_BatchLog] (
[ndBatchLog] int IDENTITY(1, 1) NOT NULL,
[ndBatchRun] int NOT NULL,
[ddDate] datetime NOT NULL,
[sdDescription] varchar(200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_BatchLog] PRIMARY KEY CLUSTERED ([ndBatchLog]),
CONSTRAINT [FK_BatchLog_BatchRun] FOREIGN KEY ([ndBatchRun])
REFERENCES [dbo].[T_BatchRun] ([ndBatchRun])
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
ON [PRIMARY]
GO
- 15
- Visual C#.Net >> Very Easy Question, How to write log to SECURTY Event Log? Please helpIs there any special code I have to write to log event to Security
Event Log? The following code give me "Very Easy Question, How to
write log to SECURTY Event Log? Please help" Error
// Create an EventLog instance and assign its source.
EventLog myLog = new EventLog();
myLog.Source = "Security";
// Write an informational entry to the event log.
myLog.WriteEntry("Writing warning to event log.",
EventLogEntryType.Warning);
but as soon as I change "Security" to "Application" ,
everything works fine
// Create an EventLog instance and assign its source.
EventLog myLog = new EventLog();
myLog.Source = "Application";
// Write an informational entry to the event log.
myLog.WriteEntry("Writing warning to event log.",
EventLogEntryType.Warning);
Any ideas?
Thanks in advance
John
|
| Author |
Message |
christurner

|
Posted: Sun Mar 12 22:35:03 CST 2006 |
Top |
Net Framework >> Finding the URL being viewed in IE from a PID or hWnd
Hi
I'm trying to find the URL that is being viewed in an IE window, by using
the PID or the hWnd of the IE window.
Does anyone know how this could be done? or where I should be looking?
Thanks
DotNet26
|
| |
|
| |
 |
Chris

|
Posted: Sun Mar 12 22:35:03 CST 2006 |
Top |
Net Framework >> Finding the URL being viewed in IE from a PID or hWnd
Hi,
This will require interop to the windows API.
Once you have the hwnd of internet explorer you can use the EnumChildWindows
to locate the combobox, for IE 6 the class name is ComboBoxEx32 and the
control id is 0xA205. The caption of the control is the URL in the address
bar.
Hope this helps
--
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor
"Paul Aspinall" <EMail@HideDomain.com> wrote in message
news:vSUQf.154327$EMail@HideDomain.com...
> Hi
> I'm trying to find the URL that is being viewed in an IE window, by using
> the PID or the hWnd of the IE window.
>
> Does anyone know how this could be done? or where I should be looking?
>
> Thanks
>
>
|
| |
|
| |
 |
Mattias

|
Posted: Sun Mar 12 16:15:40 CST 2006 |
Top |
Net Framework >> Finding the URL being viewed in IE from a PID or hWnd
>I'm trying to find the URL that is being viewed in an IE window, by using
>the PID or the hWnd of the IE window.
>
>Does anyone know how this could be done? or where I should be looking?
If you're only interested in IE it may be better to use the COM APIs
in Shdocvw.dll. If you Tlbimp it you can write code like this to dump
info on all IE (and Windows Explorer) windows.
foreach (InternetExplorer ie in new ShellWindows())
{
Console.WriteLine(ie.HWND);
Console.WriteLine(ie.LocationName);
Console.WriteLine(ie.LocationURL);
}
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Net Framework |
- Next
- 1
- Dotnet >> Application FailIf I put my .exe file on my Local Network (in a Folder of course) and try to
run from my Pc which would be the causes ? such application don't Run.
I make the Wrap a COM component for Export data to MS-Excel:
Interop.Excel.dll
Interop.VBIDE.dll
Note: Only Run in my local PC
Best Regard
Mario
- 2
- Net Framework >> Class not registeredHi Every one,
I am developing web application using c# in Visual Studio 2005 Beta 1. When
I try to connect my SQL database, I am getting error
"System.Data.OleDb.OleDbException: Class not registered". My database is in
Sql Server 2000. I am using OLEDB namespace. For some specific business need
I am using oledb namespace instead of sql name space of system.data. Can any
body help me in resolving this.
Thanks in advance.
Shailesh.
- 3
- ADO >> How do you use OleDbLiteral?I had already posted this message in the framework group when I spotted that
this group might be more apt.
I am completely baffled by the OleDbLiteral enumeration.
How do you get from the enumerated values to the things that they
represent?
I can't see any calls or methods that do this. ToString just returns the
name of the enumerated value.
This must be a really stupid question but I can't find a single worked
example that uses this class. either through google or in the 2 ADO.NET
books that I have bought.
You need this information to generate safe SQL that will run against a
variety of back-ends.
Tom
- 4
- ADO >> SPs/ADO.NET/DataSets/DataTables/DataAdapters/TableMappingHi all,
I posted this in the EnterpriseDevelopment.SQLServer.Programming group and
got a reccomendation that I post it here too.
This is probably a no-brainer, but I'm having a heck of a time trying to
form my question the right way for the search engines to return anything
meaningful.
I'm working with SQL Server 2000 and C# on .NET 1.1.
Letâ??s say that I have a stored procedure which looks like this
CREATE PROCEDURE [Get_Configuration]
AS
SELECT * FROM Table1
SELECT * FROM Table2
SELECT * FROM Table3
Now letâ??s also say that I have some .net code that looks like
System.Data.SqlClient.SqlCommand MyCommand = new
System.Data.SqlClient.SqlCommand("Get_Configuration",this.sqlConnection1);
MyCommand.CommandType = System.Data.CommandType.StoredProcedure;
System.Data.DataSet MyDs = new DataSet();
System.Data.SqlClient.SqlDataAdapter MyAdapter = new
System.Data.SqlClient.SqlDataAdapter(MyCommand);
MyAdapter.Fill(MyDs);
What I get back is a DataSet containing the 3 DataTables I want, however all
of the DataTables are named ("Table", "Table1" and "Table2")
I want to know how I can name those tables in T-SQL so that when DataAdapter
fills the DataSet with the DataTables I can program against the table names
instead of relying on the table position indexes.
This is because I know this stored procedure will change over time and I
would rather not have to keep going back to the code to modify the table
indexes.
I have tried making in memory tables and performing an SELECT INTO, but in
that in doing that I donâ??t get any DataTables back.
I did some research on the topic and understand that this is due to the way
the DataAdapter performs the Fill method and that it makes new table Objects
for each result set that the SP provides. I also understand how TableMapping
plays into the issue. But I have a genuine situation where I don't always
know the names of the tables before hand.
I have a statistical Stored Procedure library which is broken into smaller
pieces, but are called in succession from a master statistical SP. As time
goes on I'm always adding new dimensions to the report and allowing for new
tables of data to be returned. The problem I'm having is in the fact that I
don't want to have to constantly have to keep updating my front end
application each time a place a new table in the middle of the SP.
I think I have found a work around that I can use for now, which involves
creating an extra table at either the beginning or end of the SP which
returns specific meta-data about the tables being returned, which I can read
at the beginning of my Front End's execution.....I'm just hoping that there
is someone out there who has come up with a solution to this issue.
Thanks to anyone who can help,
John Rossitter
- 5
- Visual C#.Net >> hiding a rows in DataGridViewComboBoxColumnAfter a value from the combobox has been selected in a previous row of the
DataGridView, I would like to hide that value from being selectable in the
combobox in a new row of the DataGridView.
Here is a visual sample of what I'm trying to do:
http://oha.nu/accepted_creditcards.gif
I've found code to hide rows from DataGridView, but not from the
DataGridViewComboBoxColumn.
Any help much appreciated.
thanks,
Nik Edmiidz
- 6
- 7
- 8
- ADO >> ADO.NET 2.0 - Simple question for you...I have an ASP.NET 2.0 website. I want to write a function in ADO.NET 2.0
(VB.NET) that does the following:
1. Opens up a connection to my SqlExpress db. (The connectionstring is in
the <connectionStrings> section of my web.config)
2. Runs a query, storing results in a datatable.
3. Closes connection
Can anyone assist?
Thanks!
- 9
- Visual C#.Net >> adding icons to controlsHi!
I have made a few custom controls. E.g. I have a ColorTextBox which inherits
the TextBox class...
When I build the project and add it to the toolbar (through Add/Remove
Items) the control has
the default icon next to it...
Is there a way I can change the icon displayed in the toolbar? Through some
attribute perhaps?
Thanks...
Saso
- 10
- Winforms >> tabPage.Focus() doesn't work?Hi,
I have a TabControl in a WinForm witn two tabs.
At some point I want to switch focus from the first TabPage to the second
TabPage.
The documentation says that any control (which seems to be the case for the
TabControl) that derives from Panel aren't selectable.
Since I think this is a simple wish I can't imagine that there shouldn't be
a workaround for that. Do you have helping ideas?
Thank you very much.
Torben
- 11
- Microsoft Project >> After Timesheet Update Project no longer displays in Timesheet VieWe are using Project Server 2003.
We have a regular project plan (not an administrative plan) to track
miscellaneous administrative activities. The plan contains approximately 6
Summary Tasks. Team members use the plan via the 'Create A New Task'
function when they need to record time against this plan. The plan will
display in their Task Page and they are able to enter time for the newly
created task. However, when they do an update all the project plan no longer
is displayed in their Task Page. Changing the option on the Task Page to
display All Activities doesn't have any affect. The acutal time is captured
and reported to the project manager, but the project plan no longer remains
on their Task Page. Why? This plan was also added in our Project 2003
development environment and it remains on the Task Page after an update; it
doesn't behave the same as the version in production. Why is it disappearing
in our production environment?
Also, we have another plan that is similar where by team members record
non-project related support for existing applications. The plan is the same
concept as the plan to track miscellaneous administrative activities, except
we have a Summary Task for each application that our area supports. Team
members use again use the 'Create a New Task' feature to update this plan.
This plan doesn't disappear from their Task Page in the Development or
Production environment after doing an update.
So I do know that the behavior that I am seeing with the miscellaneous
administrative activities is unique to our production environment and only to
this one plan. Help!
--
Thanks,
Kelly
- 12
- Visual C#.Net >> simulate copy commandHow do I run following from csharp from "server"?
copy file.txt \\server\printer1
Also how can I submit a text file print job to local print queue "printer1"?
Assuming I run copy command from server.
TIA!
- 13
- Dotnet >> Desktop will not display shortcutsI down loaded and installed iTunes update. Noted that it took a long time to
"finalize". When finished iTunes shortcut had disapeared. When I restarted
computer all shortcuts were gone from desktop.
Restore function will not restore to any point prior to install.
Shortcuts sent to desktop do not appear.
Any ideas?
--
RFP
- 14
- Visual C#.Net >> advice for simple scenariohey all,
i have a gridview inside my web user control that's inside my .aspx page. i
have the CRUD(create,read,update,delete) buttons on my .aspx page but outside
the user control.
the rule is i have to select a row in the gridview in order for the edit
link to be enabled. and if the new button is pushed i have to disable the
other links appropriately (Cancel is enabled, Edit is disabled, Delete would
be disabled, etc)
i guess what i'm asking what's the best way to keep the CRUD buttons sync
when my gridview is inside a user control but the CRUD buttons have to reside
outside that user control?
thanks,
rodchar
- 15
|
|
|