|
I did find some interesting stuff, but I don't know how related it is to exactly what you are looking to do. You may find that ASP has as much to do with the solution as VB.NET. You may be able to reverse engineer something like this to get what you need:
Dim sPath, ot, oFSO, sFolderName, i, iNode<br />
<br />
<br />
' Get Folder Path and Folder Name.<br />
<br />
sPath = Server.MapPath(Request.ServerVariables("Path_INFO"))<br />
Do Until Right(sPath, 1) = "\"<br />
sPath = Left(sPath, Len(sPath) - 1)<br />
Loop<br />
i = Len(sPath) - 1<br />
Do Until Mid(sPath, i, 1) = "\"<br />
sFolderName = Mid(sPath, i, Len(sPath) - i)<br />
i = i - 1<br />
Loop<br />
' You can set path and folder name like this:<br />
' sPath = "C:\Inetpub\wwwroot\obout\treeview\AspTreeView\"<br />
' sFolderName = "AspTreeView"<br />
<br />
' Create objects.<br />
<br />
Set oFSO = CreateObject("Scripting.FileSystemObject")<br />
Set ot = Server.CreateObject("obout_aspTreeview_Pro.tree")<br />
<br />
' Populate first node manually. In Classic first node is "root".<br />
ot.Add "", "root", " 0, 0, 128, 1)">" & sFolderName & "", True, "book.gif" <br />
<br />
' Show folders and files.<br />
Call AddFolder(sPath, "../" & Escape(sFolderName), "root")<br />
<br />
' Write treeview to page.<br />
Response.Write ot.HTML<br />
Set ot = Nothing <br />
Set oFSO = Nothing<br />
<br />
<br />
<br />
Function AddFolder(pth, dpt, parentID)<br />
Dim oF, oFolder, oFile, oSubFolder, oItem<br />
<br />
Set oFolder = oFSO.GetFolder(pth)<br />
Set oSubFolder = oFolder.SubFolders<br />
Set oFile = oFolder.Files<br />
<br />
' Display Subfolders.<br />
For Each oItem In oSubFolder <br />
iNode = iNode + 1<br />
ot.Add parentID, "z" & iNode, "<span onclick='ob_os(this)'> " & oItem.Name & "</span>"<br />
Call AddFolder(oItem.Path, dpt & "/" & Escape(oItem.Name), "z" & iNode)<br />
Next<br />
<br />
' Display Files.<br />
For Each oF In oFile<br />
iNode = iNode + 1<br />
ot.Add parentID, "z" & iNode, " <a href=" & dpt & "/" & Escape(oF.Name) & ">" & oF.Name & "</a>", , "page.gif" <br />
Next<br />
End Function<br />
http://www.obout.com/obout/treeview/asptreeview/explorer.asp
Some other promising links:
Explorer shell extension software downloads
http://www.brightdownloads.com/software/6531.htm
Still coaxing software out of the can after all these years...
|
|
|
|
|
I found a link here that might be helpful:
http://www.codeproject.com/books/1930110286_10.asp
Still coaxing software out of the can after all these years...
|
|
|
|
|
Thanks again!
I’m jumping back-and-fourth right but I’ll be back to this TreeView thing latter. It looks like the article that you suggested just might do the trick!
Thanks
Brad
|
|
|
|
|
I happen to have the book entitled 101 Visual Basic .NET Applications and application # 35 is "Create an Explorer-Style Application," however, it contains everything except a thumbnail view option.
All 101 code samples are available for download under "Companion Content" at the following URL:
http://www.microsoft.com/mspress/books/companion/6510.asp
I also poked around in the Object Browser and found this:
Image.GetThumbnailImage Method
<br />
Public Function GetThumbnailImage( _<br />
ByVal thumbWidth As Integer, _<br />
ByVal thumbHeight As Integer, _<br />
ByVal callback As Image.GetThumbnailImageAbort, _<br />
) As Image<br />
Still coaxing software out of the can after all these years...
|
|
|
|
|
tanstaafl28 wrote:
I happen to have the book entitled 101 Visual Basic .NET Applications
I actually just bought that same book over the weekend. The Explorer-Style Application is exactly what caught my eye. But, as you also know, it doesn’t describe the one little thing that I’m looking for...I guess that they can’t cover everything.
It is a great book though. I’ve looked at it several times in the book store so I finally decided to buy it.
|
|
|
|
|
Brad, I have another idea for you. It was one of those things where I wasn't looking for anything in particular, but I was thumbing through my copy of Windows XP Annoyances when I came to a section called: "Turn File Icons into Thumbnail Previews." The instructions are straightforward:
Open Explorer, and locate any folder that contains at least one graphic image file (.jpg, gif, or bmp). Select Thumbnails from the View menu (This option may not be available unless you have Internet Explorer integration disabled). Select one of the other view modes (such as details or Large icons) to resture the display to normal.
If you've configured Explorer to display hidden files, you'll notice a new hidden file thumbs.db (which contains the thumbnail data), in any folder you view. As long as this file is present, the folder's view will always be set to Thumbnails. If you delete the file, and then re-open the folder, it should be back to the standard details or large icons view.
Windows XP Annoyances pp 147-48.
Everything but the last part works in 2k (I have view hidden files and folders and I don't see that thumbs.db anywhere), so all you need to do is find a way to programmatically mimic this and you'll be good to go.
There is also some mention of looking in the registry for HKEY_CLASSES_ROOT\Paint.Pictures\
DefaultIcon and changing the default value to %1. This seems to apply to bitmaps only, but there has to be an iconic reference in the registry for other graphical files as well.
I was thinking that there is a way to filter file views by specific types in VB.NET, if this can be combined with the listview/treeview commands and then the above thumbnail info included, you'd be good to go.
Oh, and Annoyances.org is the Windows Annoyances website, lots of good references and ideas on how to figure out built-in Windows functions and how to access them there.
Still coaxing software out of the can after all these years...
|
|
|
|
|
tanstaafl28 wrote:
Everything but the last part works in 2k
I get the same result that you get.
tanstaafl28 wrote:
so all you need to do is find a way to programmatically mimic this
Do you mean that I need to find a way to create the thumbs.db?
If I understand you, it seems that you think that the key is to generate (on the fly) code that will make thumb nails and display them in place of the default thumbnail image. Is that right?
Brad
|
|
|
|
|
If I understand you, it seems that you think that the key is to generate (on the fly) code that will make thumb nails and display them in place of the default thumbnail image. Is that right?
I'm thinking this might be a solution you can try. The idea is that VB.NET is powerful enough to do just about anything Windows can do, so it should be possible to create a custom Windows form that utilizes the built-in functions of Windows to perform the desired task. Its the "don't try to reinvent the wheel" approach. The problem is that for some reason, the thumbnail option seems to be missing from the view options. All the other ones are there.
What keeps going through my mind is a simple "Image Browser" which would include a dynamic array "stack" that would fill up with all the image file types in that folder and the user would "view" them one at a time by using a "Previous" and "Next" command button and a picture window. Of course this starts to sound just like IrfanView, which is someone else's idea of an image browser.
It might be easier still if you could skip the listview/treeview form all together and just call up the actual explorer dialog that does have the option to view as thumbnails. If that is possible.
Still coaxing software out of the can after all these years...
|
|
|
|
|
tanstaafl28 wrote:
It might be easier still if you could skip the listview/treeview form all together and just call up the actual explorer dialog
That might be the route to take for now. I can perfect it latter on. Do you know if it is possible to run explorer from within another application? Not open independently but as part of the application that I’m creating. Hmmm...maybe I'm getting a bit carried away now.
When I get home tonight, I'm going to see if I can generate the thumbs.db on an XP machine. Maybe the key lies within that little guy.;)
Thanks for all of your help!
|
|
|
|
|
Hey no problem Brad, I learned all sorts of things by just tossing out ideas. The law of averages being what it is, there's a good possibility that one of them will lead to something you can use.
Running Explorer from another application, hmmm...it depends greatly on the application. I can think of about a half dozen programs that use some version of scripting or VBA to provide customization options.
Better stick to one problem at a time. Crack this nut first.
Still coaxing software out of the can after all these years...
|
|
|
|
|
I'm following along with this book and it says to add a reference library to Excel. In the book it has Excel 10, but I have Excel 11, which I suspect is irrelevant, but when I try to add a variable based upon Excel.Application, Visual Studio acts as if I haven't added the reference. Squiggly blue line under Excel.Application. The code below is
the click event where the Excel.Application is called:
Private Sub btnCalculate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim xlApp As Excel.Application
Dim LoanPayment As Single
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
LoanPayment = xlApp.WorksheetFunction.Pmt _
(txtInterest.Text / 12, txtMonths.Text, txtPrincipal.Text)
MsgBox("The monthly payment is " & _
Format(Abs(LoanPayment), "$#.##"), , "Mortgage")
xlApp.Quit()
End Sub
End Class
Not only do I have Office 2003, but I have Visual Studio Tools for the Microsoft Office System 2003 installed. Why isn't my reference working?
Still coaxing software out of the can after all these years...
|
|
|
|
|
I was able to use the book as a reference, but what I had to do to get this interop to work was a bit different:
Private Sub btnCalculate_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalculate.Click
1:
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim LoanPayment As Single
xlApp = CType(CreateObject("Excel.Application"), _
Microsoft.Office.Interop.Excel.Application)
LoanPayment = xlApp.WorksheetFunction.Pmt _
(txtInterest.Text / 12, txtMonths.Text, txtPrincipal.Text)
MsgBox("The Monthly Payment is " & _
Format(Abs(LoanPayment), "$#.##"), , "Mortgage")
xlApp.Quit()
End Sub
End Class
Why did I have to specify more precisely than the book suggested?
|
|
|
|
|
Try putting this at the top of your code:
Imports Microsoft.Office.Interop
You should then be able to make it look just like the book.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave.
The book was set up for use with Excel 2002, is there that big of a difference between Excel 10 and Excel 11?
Still coaxing software out of the can after all these years...
|
|
|
|
|
Yes, there is. Starting with Office XP, Microsoft is putting out Primary Interop Assemblies that allow for easier integration with .NET Framework apps.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Interesting. The book claims the lesson to be based upon using the Excel interop for Office XP. Since I'm in college, I went ahead and got Office Professional 2003 Academic. Skipped right over 2002/XP.
Additionally- I saw Visual Studio Tools for the Microsoft Office System 2003, and it was cheap, so I added that too.
Oh, and I can't thank you enough. I'm learning tons!
Still coaxing software out of the can after all these years...
|
|
|
|
|
The thing is that the book was referring to Office XP (2002). Whereas I was using Office 2003. My desktop is running Windows 2000 though.
I used the object browser to look up the specific Excel interop I was looking for and saw the pathing didn't match the book, so I copied the full path and pasted it in. The "little blue squigglys" went away.
I wonder what caused the discrepancy? Was it the book, or did I miss something somewhere?
Still coaxing software out of the can after all these years...
|
|
|
|
|
I've been working for this problem
when calling shellexeucte to launch outlook I specify hyperlink in
side of body, but when the hyperlink is too long it is not hyperlink
anymore instead just text. any workaround to avoid this problem
str_Body = "click here to there"
str_whole = "mailto:" & strEmailAddress & "?body=" & str_Body
ShellExecute Me.hWnd, "open", str_whole, vbNull, vbNull, SW_SHOWNORMAL
|
|
|
|
|
I have a TreeView and a ListView. My TreeView is used to browse through the computers file system. What I would like to do and just can’t seem to figure out how to make work is:
1-Open a file in the TreeView (I can do this now)
2-Display, in the ListView, any image(jpeg, tiff, etc.),as thumbnails, that are located in the file that is opened in the TreeView.
3-I would then like to be able to click on the thumbnail in the ListView and open the full image in a PictureBox. (I haven’t tried this yet)
Any comments or suggestions?
Thanks
Brad
|
|
|
|
|
You thumbnail view is better done with a grid of PictureBox's. The ListView control doesn't offer the kind of support your looking for, unless you want to write you own control and ownerdraw the ListView with pictures inside it.
Adding the PictureBox's to the form wouldn't be that hard. Even wiring up the Click event is easy enough using AddHandler and RemoveHandler to connect the event to a click method on your form.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
The ListView control doesn't offer the kind of support your looking for
...that is probably why I couldn't find any examples.
I'll see if I can figure out how to use the DataGrid.
As for the PictureBox, I was also thinking that-that part would be easy but I've learned to never say 'easy' until I've tried it.
Thanks Dave!
You have been a great help to me over the past few weeks.
Brad
|
|
|
|
|
Brad Fackrell wrote:
I'll see if I can figure out how to use the DataGrid.
...ooops, not DatGrid ...grid of PictureBoxes.
|
|
|
|
|
I want to take a belt and braces approach to avoiding SQL injection attacks. First step is to obviously used parameterised stored procedures. The second is to write a helper class to check input meets the expected format. To this end I'm thinking of writing a helper class that uses regular expressions.
<br />
Imports System.Text.RegularExpressions<br />
Public Class AntiSQLInjectionHelper<br />
<br />
Private Sub New()<br />
End Sub<br />
<br />
Public Shared Function CheckString(ByVal Value As String, ByVal [CheckType] As CheckType) As Boolean<br />
Dim pattern As String<br />
Select Case [CheckType]<br />
Case CheckType.DateString 'Checks for accepted date format<br />
pattern = "TODO"<br />
Case CheckType.General 'Checks for accepted general format (ie one that doesn't contain any DROP commands etc)<br />
pattern = "TODO"<br />
Case CheckType.NumberString 'Checks for accepted number format<br />
pattern = "TODO"<br />
Case CheckType.PasswordString 'Checks for accepted password format<br />
pattern = "TODO"<br />
Case CheckType.UsernameString 'Checks for accepted username format<br />
pattern = "TODO"<br />
End Select<br />
Return Regex.IsMatch(Value, pattern)<br />
End Function<br />
<br />
Public Enum CheckType<br />
DateString<br />
NumberString<br />
UsernameString<br />
PasswordString<br />
General<br />
End Enum<br />
<br />
End Class<br />
<br />
Has anyone out there got a better way / done anything similar, think its a good idea or know of an alternative? I know there are validation controls that use javascript but a dtermined hacker can circumvent them.
Jim
|
|
|
|
|
I've never written a class for this... I've always used the Validation controls in my UI code.
You might want to check out these two articles, here[^] and here[^], for an idea into using the Validation controls to do what your thinking of.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks very much I will look into the articles
Jim
|
|
|
|
|