|
Okay, I am trying to automate the download of data from a web based database. I can automate the login in and getting to the right pages, but when I try to download the database I get a "File Download - Security Warning" popup message box. I have tried to use AppActivate to put the focus on the message box and then send the keys to click the save button on the popup message box. This doesn't work correctly. The AppActivate seems to activate the message box, but when I send the keys it sends to the visual studio menus. Could someone point me in the direction of an article or explain to me how to make this work correctly? I have used Goggle (where I got the code I am using) but I can't find anything that says different than what I am doing. I am not using this on a windows form it is an aspx page.
(Sample code that I am using)
Dim objShell
objShell = CreateObject("WScript.Shell")
AppActivate("File Download - Security Warning")
objShell.SendKeys.Send("%S")
objShell.SendKeys.Send("{Enter}")
Thanks in advance for any assistance with this problem.
If you can’t have fun at work, then why go to work?
|
|
|
|
|
SendKeys is notoriously unreliable. Since Windows is a shared envrionment, the focus can move from one control or window to another at any time and for any reason. The focus can move between the AppActivate statement and your call to SendKeys.
You'll have to use a more reliable method that sends key strokes directly to a window's message pump instead. You'll use the Win32 API functions FindWindow and SendMessage at the very least.
|
|
|
|
|
Do you know of a good website or article that explains how to do this? I have been working on this about a week and it is the hold up of me finishing this project. I will try googling it, but if you know of a good resource that would be appreciated.
Thanks
If you can’t have fun at work, then why go to work?
|
|
|
|
|
Thanks for the information. I found some code but I'm not quite understanding it. Below is the snippet I am using:
Dim docName = FindWindow(vbNullString, "File Download - Security Warning")
Const BM_CLICK As Integer = &H102
SendMessage(docName, BM_CLICK, 0, 0)
I have the following two questions:
What does the &H102 stand for?
And where or how do I tell it that I want the saved button clicked? The save button does have the short cut key of Alt-S that I can send, but I don't understand where that information goes.
Thank you for any assistance with this issue.
If you can’t have fun at work, then why go to work?
|
|
|
|
|
not having a chance to use vb in 10 years, (the beginning of vb4 was my last time before this) i seem a little confused on quite alot of vb'ing. it's catching up quickly though.. )
Here's my problem question:
i want the listbox to load from a folder show only the file name, without the path and extension, and how to click the file to show the file content in a textbox and the file name in another text box.
please only reply if you have simple answers and not a whole bunch of crazy code no one like me understands until the desktop icons are gone... not funny.. ,
thanx,
trujade
.:trujade:.
|
|
|
|
|
System.IO.Directory.GetFiles, System.IO.Path.GetFileNameWithoutExtension, are the main methods you need to get file names for a folder, without extensions
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
here is the solution to my question.
new project, 2 textboxes, 1 button, 1 listbox.
Public Class Form1
'-- create a string for the folder path
Dim myDirectory As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Text = "select folder"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fbd As New FolderBrowserDialog
fbd.RootFolder = Environment.SpecialFolder.Desktop
If fbd.ShowDialog = DialogResult.OK Then
'-- set the directory for use to load each file from the folder
myDirectory = fbd.SelectedPath
End If
'-- load files in listbox, filenames only
For Each file As String In My.Computer.FileSystem.GetFiles _
(myDirectory, FileIO.SearchOption.SearchTopLevelOnly, "*.txt")
ListBox1.Items.Add(System.IO.Path.GetFileNameWithoutExtension(file))
Next
ListBox1.Select()
End Sub
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Try
Dim myFile As String = myDirectory & "\" & ListBox1.SelectedItem & ".txt"
'-- file content
TextBox1.Text = IO.File.ReadAllText(myFile)
'-- file name w/extension
TextBox2.Text = IO.Path.GetFileName(myFile)
Catch ex As Exception
End Try
End Sub
End Class
|
|
|
|
|
Hi
I am not sure whether this is the right forum to ask this question, but I am using the web browser control in Visual Studio 2008 to create my own browser. Firstly, dragging the control onto a form, and run it I can access all of my web pages, so no problem there, but I have a few questions that I need to find answers to:
1) As the web browser control is an instance of IE, then if Java Script is disabled in Internet Explorer, would it be disabled in my browser? If not, is there a way of ensuring programmatically disable it in my explorer as this is what I want? Likewise, I would like to ensure that Active X is enabled in my browser?
2) My second question is that my web application will not have an address because I want to hide this away for security reasons. Rather re-create my web browser to change the URL if the web pages move to a different server, is there away I can use an INI or some text file which will hold this information if such a thing were to happen - can someone help me on this?
3) I have used IsWebBrowserContextMenuEnabled = False to switch off right clicks in the browser - is there away to switch off key press commands, such as ctrl P, print screen in a bespoke web browser?
I hope some one can help!
Thanks
|
|
|
|
|
1 - yes, I believe the IE settings on the host machine will apply
2 - You cannot have a web application without an address. How is this related to your 'browser' ? Yes, if you want your 'browser' to open your site, you can simply hide the URL, and browse to it, and you can store it in a config file.
3 - No, I don't believe so, although I know you can handle keypress events, perhaps you can mark them as handled if control is down ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
1) This is a security issue that is not supported by the web browser control. Imagine the security risk if someone could change settings for each of the different security zones. To disable scripting, I strip the script from the page. (An exercise left to the reader.)
2) My.Settings is perfect for what you want to do. Bring up the properties for the web browser control, select (ApplicationSettings) then (PropertyBinding), scroll down to Url, expand the drop-down list, then select "new..." The rest is up to you.
3) Use <code>WebBrowserShortcutsEnabled</code> property. Check the documentation for this property, specifically the Remarks and Example sections. Following is my standard initialization for a "concealed" web browser control.
Private Sub InitializeBrowserHelper()
_browseHelper = New System.Windows.Forms.WebBrowser
_browseHelper.AllowWebBrowserDrop = False
_browseHelper.IsWebBrowserContextMenuEnabled = False
_browseHelper.WebBrowserShortcutsEnabled = False
_browseHelper.ScriptErrorsSuppressed = True
AddHandler _browseHelper.DocumentCompleted, AddressOf _browseHelper_DocumentCompleted
End Sub
|
|
|
|
|
Hi
My VB.NET Library references ADODB. When I build it, the above message comes out.
Should I run tlbimp.exe ?
Thanks
Marcello Turnbull
|
|
|
|
|
It is possible you have the wrong ADODB version. Make sure you get the Visual Studio installed version that is located in the "C:\Program Files\Microsoft.NET\Primary Interop Assemblies".
Delete the reference.
Clean Solution.
Verify Obj and Bin folders are empty.
Build Solution.
Ignore the errors.
Add the reference.
Make absolutely sure you select the correct ADODB reference!
The reference must be ADODB (upper-case on purpose) viewed from Solution Explorer.
The reference you are adding is adodb (lower-case on purpose) from the Add Reference dialog.
Component: adodb
Version : 7.0.3300.0
Runtime : v1.1.4322
Path : C:\Program Files\Microsoft.NET\Primary Interop Assemblies\adodb.dll
Rebuild Solution
|
|
|
|
|
Hello friends.
I want to create an application in .net or VB 6.0 to search file in my systems. file may be Word, Excel or PPT.
As in Windows Xp it is inbuilt file searching option but still i want to create an application like that. By which i can be able to search my files using the contents based. Any body please help me and if you have the code please mail me at anandbpsri@yahoo.co.in
with regards.
Anand Srivastava
|
|
|
|
|
|
see here[^]
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Remove the Computer from your desk and buy an abacus.
Either that or forget the words VB6.0
You will get short shrift here asking VB 6.0 Q's.
Seriously, download VB.Net, it is free and available.
------------------------------------
"I am always serious about what I do, not necessarily about how I do it."
Tom Baker
|
|
|
|
|
Hello friends.
I want to create an application in .net or VB 6.0 to search file in my systems. file may be Word, Excel or PPT.
As in Windows Xp it is inbuilt file searching option but still i want to create an application like that. By which i can be able to search my files using the contents based. Any body please help me and if you have the code please mail me at anandbpsri@yahoo.co.in
with regards.
Anand Srivastava
modified on Tuesday, April 14, 2009 1:47 PM
|
|
|
|
|
anandbpsri wrote: VB 6.0
Actually, it would end in tears.No matter where.
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Look into System.IO.Directory.GetFiles. You'll need to look into the various file extensions, but this information is easily available elsewhere on the internet
|
|
|
|
|
How to create the visual basic 6.0 class instance from c#?
Actually I add the one OCX file into my C#,Asp.Net application.
But when we create the instance of the visual basic class then it gives the error Class has no constructor defined.
Please help me about that.
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Is the .OCX registered on the machine?? You really can't have a COM component without at least an empty constructor, so I question the error you got.
|
|
|
|
|
Hi,
i have a batch file kept in webserver(IIS 6.0) under a virtualdirectory and when im trying to invoke batch file from client thru URL it"s not accessible..and it"s working fine when i place the bat file in IIS 5.0 server...
Please help me out...
|
|
|
|
|
Are you saying that you want the batch file to run on the server and execute commands there or do you want the batch to be downloaded and executed on the client??
BTW, this question has nothing to do with VB.NET and should be asked in the ASP.NET Forum, where they normally handle Web Server based questions.
|
|
|
|
|
Thanks for ur reply.....ya i want the batch file to be downloaded and executed on the client from the server......
|
|
|
|
|
The web server doesn't dictate how and if that will work. The web browser's security settings do. Without relaxing the default security settings, that won't work. Yo ucan download the file, you just can't launch it from code running in the browser.
|
|
|
|