|
here's an example I just slapped together for testing ... grant it, my object names differ, but you'll get the idea ...
<br />
private void OnFormLoad(object sender, EventArgs e)<br />
{<br />
this.webBrowser1.Navigate(@"http://www.cnn.com");<br />
while (this.webBrowser1.ReadyState != WebBrowserReadyState.Complete)<br />
{<br />
Application.DoEvents();<br />
}<br />
MessageBox.Show("DONE loading!");<br />
<br />
}<br />
|
|
|
|
|
Thanks again Douglas!
I hear what you are saying, I just don't know what process to run that will refresh the WebBroswer.ReadyState until it is completed. What event or process can I keep running that will get me to WebBrowserReadyState.Complete before I run the capture code.
Here is some of the code:
private void frmMain_Load(object sender, EventArgs e)<br />
{<br />
Initialize_Site(null, null);<br />
<br />
string WebReady = axWebCap.ReadyState.ToString();<br />
<br />
while (WebReady != "READYSTATE_COMPLETE")<br />
{<br />
WebReady = axWebCap.ReadyState.ToString();<br />
}<br />
<br />
}<br />
<br />
private void frmMain_Activated(object sender, System.EventArgs e)<br />
{<br />
button1_Click(null, null);
}<br />
<br />
private void Initialize_Site(object sender, EventArgs e)<br />
{<br />
TextReader WebConfig = new StreamReader(@"c:\\IECapture\config.txt");<br />
<br />
int LineCount = 4;<br />
string[] ConfigLines = new string[LineCount];<br />
<br />
for (int i = 1; i < LineCount; i++)<br />
{<br />
ConfigLines[i] = WebConfig.ReadLine();<br />
}<br />
<br />
string Address = ConfigLines[1];<br />
axWebCap.Navigate(Address);<br />
<br />
}
Thanks,
Justin
|
|
|
|
|
You need only add a call to Application.DoEvents(); That will tell your application to pump messages and whatnot while you wait for the ReadyState to change ... so in your code, you would
private void frmMain_Load(object sender, EventArgs e)
{
Initialize_Site(null, null);
string WebReady = axWebCap.ReadyState.ToString();
while (WebReady != "READYSTATE_COMPLETE")
{
// tell application to process pending events
Application.DoEvents();
// get the readystate
WebReady = axWebCap.ReadyState.ToString();
}
//add your capture code here ...
}
-- modified at 16:19 Tuesday 3rd April, 2007
|
|
|
|
|
I think I understand now. Pardon my slowness.
So the line:
Application.DoEvents();
That is an actual event, huh? This shows my lack of knowledge in programming. I have though when people posted this it meant to run a custome function. I will try this
What does the Application.DoEvent() actually do?
Thanks a bunch for your help!
|
|
|
|
|
Well, without it ... your while loop is just going to 'hang' there, and take all the processing until it's condition is met. This is obviously not what you want to have happen ...
You want to your program to 'wait' until the ReadyState is complete. By calling DoEvents, that allows your application to process messages that are sitting in the message queue (essentially, it lets your program 'run' while you wait for that state change to occur).
Hope that helps.
|
|
|
|
|
I just did what you said and it worked like a charge. Added Application.DoEvents() to my while loop, and it works flawlessly.
Thank you SO very much Douglas. It is greatly appreciated, and thanks for putting up with a coding newb!
|
|
|
|
|
no problem. glad I could help.
|
|
|
|
|
|
Diego F. wrote: Is there any way to solve that?
Yes, make sure the icon is in the imagelist of the listview and set the imageindex for the item to it.
led mike
|
|
|
|
|
I can't solve the problem.
When I open a file in the listview1 I do that (is vb code here)
Dim files As String() = Directory.GetFiles(sourceDir)
For Each file As String In files
ImageList1.Images.Add(System.Drawing.Image.FromFile(file))
Next
I added then something like listview1.LargeImageList = ImageList1
But when using drag & drop in the second listview, the images doesn't appear. Should I load the ImageList1 in the second listview? I thought that the item contains the image and when I drop in the other listview, moves it all.
Regards,
Diego F.
|
|
|
|
|
Hallo. I'm writing AddIn for Excel 2007 in C#, using VSTO 2005 SE. I'd like to have possibility to use something similar to templates - specially saved Excel objects (for example: a pattern of the table) for further use.
For example: I'll create an Excel table which represents information about person (Name, Surname etc.) and I'd like to paste this table in a Worksheet, allow user to fill it and then commit data to Database.
How can I do this without writing any code which will creates this table at runtime.
|
|
|
|
|
You should really post this question in the VSTO[^] forum.
If you were using VSTO, you could create an Excel document-level template and use that to gather up your data ...
As for dynamically creating a table and whatnot, I'm sure that someone in the VSTO group will be able to help guide you.
|
|
|
|
|
Thanks, Douglas, for your advice.
|
|
|
|
|
Hello,
My app dependes on a sql database I want my setup project to attach the sql files to the framework or any thing else to run the database like the MSDE 2000 How can I do this?
Thanks.
Dad
|
|
|
|
|
This question is far to vague. What database are you using (SQL Server, Firebird, MySQL)? What version of the .NET Framework?
You have to supply more detailed information.
|
|
|
|
|
I am esigning a usercontrol with a panel child. Using a ControlDesigner I used EnableDesignMode to make it possible to drop controls in the panel at design time. Now i wanted to lock te panel because you can move and resize the panel inside the usercontrol. I made another ControlDesigner class to use on the panel class and override the SelectionRules to set it to locked. If I use this locked thing, the functionality of dropping controls in the panel dissapears. Howe can I implement these two things without problems?
My code:
<br />
[DesignerAttribute( typeof( AdvancedNoteDesigner ) )]<br />
public partial class AdvancedNote : UserControl<br />
{<br />
...<br />
}<br />
<br />
public class AdvancedNoteContentPanel : Panel<br />
{<br />
public AdvancedNoteContentPanel()<br />
{<br />
this.SetStyle( ControlStyles.AllPaintingInWmPaint , true );<br />
this.SetStyle( ControlStyles.OptimizedDoubleBuffer , true );<br />
this.SetStyle( ControlStyles.ResizeRedraw , true );<br />
this.SetStyle( ControlStyles.SupportsTransparentBackColor , true );<br />
this.SetStyle( ControlStyles.UserPaint , true );<br />
<br />
this.BackColor = Color.Transparent;<br />
}<br />
}<br />
<br />
internal class AdvancedNoteDesigner : ControlDesigner<br />
{<br />
public override void Initialize( IComponent component )<br />
{<br />
base.Initialize( component );<br />
<br />
AdvancedNote advancednote = (AdvancedNote)component;<br />
<br />
EnableDesignMode( advancednote.ContentPanelFront , "ContentPanelFront" );<br />
EnableDesignMode( advancednote.ContentPanelBack , "ContentPanelBack" );<br />
}<br />
}<br />
<br />
internal class AdvancedNoteContentPanelDesigner : ControlDesigner<br />
{<br />
public override SelectionRules SelectionRules<br />
{<br />
get<br />
{<br />
SelectionRules selRules = base.SelectionRules;<br />
<br />
selRules = SelectionRules.Locked;<br />
<br />
return selRules;<br />
}<br />
}<br />
}<br />
<br />
|
|
|
|
|
i have used System.Diagnostics.Process.Start("explorer.exe", "/e,/select,c:");
for Opening My Computer. it works. but i want to open My Doc, My Network place also. how it possible?
Thanks.
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
You should just be able to put "My Documents" in the arguments list and it should work fine.
So the code is:
System.Diagnostics.Process.Start("explorer.exe", "My Documents");
Hope that helps.
Ben
|
|
|
|
|
You can use the following to get that path:
<br />
string myComputerFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);<br />
You can then use that information to shell to it ...
|
|
|
|
|
hi
i want to run exe file(s) in buffer,How to do ..thanks(pe,injection,...)
Description :
my exe is Encrypted and exist in CD-drive and when user start my program, it check information of that computer and cd ... then Decrypt that exe in ram and run it from ram (on the fly),without extract on disc. but ho to do ?
|
|
|
|
|
ALL executables that you write run in RAM. You don't need to run from a disk because you can use AutoRun (assuming that it is enabled) to run the application from the CD. If you're looking to see how you can inject a virus/worm onto the client machine then you've come to the wrong place.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I think that he's aiming for is an exe that is encrypted so it can't be decompiled.
After decompiling the app he doesn't want to cache it to disk so Process.Start wont work.
|
|
|
|
|
The principle's still the same. In order to run the application, you would have an encrypted app which you would then fire off using another application. This other application would be responsible for decrypting the application and starting it off. The hint is that you could decrypt the encrypted exe to a stream and then use Assembly.Load to load the executable.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I was thinking that it could be any application, not just a .Net one.
|
|
|
|
|
But, this is the C# forum. If it's not .NET then he's in the wrong forum
Deja View - the feeling that you've seen this post before.
|
|
|
|