|
Well, yeah...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Weel, first you have to find out HOW it was encrypted, then you have to know if the password was encrypted using a symmetric algo or if it was a one-way hash. Usually, it's a one-way hash, in which case, there's no way to decrypt it. You have to use a dictionary attack method to "guess" what the password is, hashing millions of letter combinations and comparing those hashes to the stored hashed password. This could take a year or two for the more complex passwords.
|
|
|
|
|
I know minimal VBA (one online class that took an hour) and now I need to complete a project in Excel that queries an Oracle database. They would like the user to input a search criteria and then push a button to populate the sheet. For example, the user inputs "shoes" and pushes a macro button that says, "Refresh" and the database then returns the current database "Sizes, Colors and Styles, etc."
So far I have been able to make a connection to the database:
Sub OpenDatabase()
Dim strConnection As String
Dim wrkSheet As Worksheet
Application.StatusBar = "Opening Database"
strConnection = "Driver={Microsoft ODBC for Oracle};" & _
"Server=X;uid=Y;pwd=Z;"
Set g_conDB = New ADODB.Connection
g_conDB.Open strConnection
End Sub
Can anyone help me with what to do next?
thanks
|
|
|
|
|
Hello,
How can I use vb.net to get the creation date of an access table? I'd like to be able to know when the tables where last created in an application that drops and adds tables each time it is run.
Thanks
|
|
|
|
|
Use the DateCreated property - search for Debug.Print cat.Tables("tblCompanies").DateCreated on this page[^].
|
|
|
|
|
Thanks for your reply. I ended up using this code to get the information about the access tables. It looks at the "TABLE" in the schema. Information about the tables is stored in "TABLE"
' open connection to mdb
objConn.Open()
Dim SchemaTable As DataTable=objConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
For Each dr As DataRow In SchemaTable.Rows
Debug.Print(dr!TABLE_NAME.ToString())
Debug.Print(dr!DATE_CREATED.ToString())
Next
|
|
|
|
|
Ah! I'll try to commit that one to memory.
|
|
|
|
|
I am new with progress bars. I am getting help from the great help information in Visual Studios 2005. But, I am not understanding what is wrong. Here is my code so far. I am trying to display a progress bar on a .net compact framework form because when I launch the program I am trying to get a file on the network and it take 30 seconds the first launch of the program.
ProgressBar1.Visible = True
ProgressBar1.Minimum = 1
ProgressBar1.Maximum = 3
ProgressBar1.Value = 1
This is ok. But, when I try to use the STEP (progressbar1.step) it does not give me the option. I imported windows.forms. What else do I need. the help says .net compact will work.
|
|
|
|
|
If it doesn't show up it may not be supported, but I could be wrong. You can always do ProgressBar1.Value += 1 or try the Increment[^] method, if it's supported.
|
|
|
|
|
How do I set File I/O permission in my application which is devioping in Vb2003 for Win CE platform. I get IOException on opening a file.
Thanks
Terry
|
|
|
|
|
Scenerio: predecessor built a screencapture VB applet to call from a shortcut in third-party app...but I need to modify it to maximize the app before snapshot.
Hints? how do I maximaize an already open app?
Another option wwould be to capture just the active window instead of full screen...
Public Class Form1
Dim memoryImage As Bitmap 'The bitmap of the screen
Dim srcWidth As Int16 'The width of the usable screen
Dim srcHeight As Int16 'The height of the usable screen
Dim tmr As New System.Windows.Forms.Timer
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim dstWidth As Int16 'Destination width
Dim dstRect As Rectangle 'Destination height
Dim srcRect As New Rectangle(0, 0, srcWidth, srcHeight) 'Source Rectangle
'Set the dstWidth to the printable height of the document. The height is used
'because the document is printed in landscape
dstWidth = PrintDocument1.DefaultPageSettings.PrintableArea.Height
dstRect.Width = dstWidth ' Set the width of the destination rectangle
'Scale the height in relation to the width and the source rectangle
dstRect.Height = (dstWidth / srcWidth * srcHeight)
'Draw the image scaling from the srcRect to the dstRect
e.Graphics.DrawImage(memoryImage, dstRect, srcRect, GraphicsUnit.Pixel)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintDocument1.DocumentName = "Screen Print" 'Name the document
PrintDocument1.DefaultPageSettings.Landscape = True 'Swith to landscape
PrintPreviewDialog1.ShowDialog() 'Show the print preview dialog
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Visible = False 'Hide the form
tmr.Enabled = True
tmr.Interval = 1500
AddHandler tmr.Tick, AddressOf Me.TimerTick
tmr.Start()
End Sub
Private Sub TimerTick(ByVal Sender As Object, ByVal e As EventArgs)
Dim myGraphics As Graphics
Dim s As Size
tmr.Enabled = False
tmr.Stop()
'Set the srcWidth and srcHeight to the working dimensions of the screen
srcWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width
srcHeight = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height
s.Width = srcWidth 'Set the width of the size object
s.Height = srcHeight 'Set the height of the size object
myGraphics = Me.CreateGraphics
'Create a bitmap based on the size of the screen
memoryImage = New Bitmap(srcWidth, srcHeight, myGraphics)
'Create a graphics object to paint the bitmap
Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
'Get a capture of the screen
memoryGraphics.CopyFromScreen(200, 0, 0, 0, s)
'PictureBox1.Image() = memoryImage
Button1_Click(Sender, e)
Application.Exit()
End Sub
End Class
modified on Tuesday, July 1, 2008 9:33 AM
|
|
|
|
|
If I understand your question correctly, get the HWND of the window you want to take a screen capture of and then call the ShowWindow()[^] API passing SW_SHOWMAXIMIZED.
|
|
|
|
|
That sounds like what I've seen on Technet/Help....problem is I'm not a programmer & dont know the syntax or where in my vb app it should go(ie form1_load)....how would you script that, given the app name of "CDA"?
This is great OJT....I'll keep digging in Help documents, but your help is great to get me putting the pieces together. Thanks!
|
|
|
|
|
Disclaimer: This code may not be 100% syntax-correct but it should get you started (particularly the call to FindWindowEx, my memory is unsure.)
In declarations:
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindowEx(ByVal parentHandle As IntPtr, _
ByVal childAfter As IntPtr, _
ByVal lclassName As String, _
ByVal windowTitle As String) As IntPtr
Private Declare Auto Function GetDesktopWindow Lib "user32.dll" () As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Boolean
End Function
In code, before where the screen shot is taken:
' Get the window's handle
Dim WindowTitle as String = "Notepad"
Dim WindowToMax as IntPtr = FindWindowEx(GetDesktopWindow(), IntPtr.Zero, IntPtr.Zero, "WindowTitle")
' Maximize it
ShowWindow(WindowToMax, 3) ' 3 is for ShowMaximized
I use FindWindowEx to find the window to maximize (the window with "Notepad" as the title). Then pass the window's handle to ShowWindow(). There's a lot of examples out there for FindWindowEx and ShowWindow in case you need more.
|
|
|
|
|
Arrgh...so close...
I got a .Net security error
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The Zone of the assembly that failed was:
MyComputer
Heres my modifications:
<Runtime.InteropServices.DllImport("user32.dll")> _
Private Shared Function FindWindowEx(ByVal parentHandle As IntPtr, _
ByVal childAfter As IntPtr, _
ByVal lclassName As String, _
ByVal windowTitle As String)
End Function
Declare Auto Function GetDesktopWindow Lib "user32.dll" () As IntPtr
<Runtime.InteropServices.DllImport("user32.dll")> _
Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Boolean
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim WindowTitle As String = "QuadraMed CPR - Saint Francis Hospital Ulticare System"
Dim WindowToMax As IntPtr = FindWindowEx(GetDesktopWindow(), IntPtr.Zero, IntPtr.Zero, "WindowTitle")
ShowWindow(WindowToMax, 3) ' 3 is for ShowMaximized
End Sub
|
|
|
|
|
Try this one:
Imports System.Runtime.InteropServices
Public Class Form1
<Runtime.InteropServices.DllImport("user32.dll")> _
Private Shared Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Boolean
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Shared Function FindWindow( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As IntPtr
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim NotepadHwnd As System.IntPtr = FindWindow(Nothing, "Untitled - Notepad")
MsgBox(NotepadHwnd.ToString)
ShowWindow(NotepadHwnd, 3)
End Sub
End Class
FindWindowEx is probably overkill, and I should have mentioned FindWindow instead. The window title "Untitled - Notepad" has to match exactly. If you don't know what the window title will be, you can enumerate all desktop windows and then call GetWindowText for each one until you find the window that you want to maximize.
|
|
|
|
|
Almost there. My security error was due to not having published(could not run from VS CTRL-F5)
It works great on Notepad, but not on the 3rd party app....how do I "enumerate all desktop windows and then call GetWindowText for each one "?
Appreciate your patience & walking me thru this!
|
|
|
|
|
Sure, now this isn't the prettiest code - it's darn ugly, in fact. But it does work. I threw it into a Module but it's probably best suited for a class.
Imports System.Runtime.InteropServices
Module Module1
Public Delegate Function EnumWindowsProc(ByVal hWnd As IntPtr, ByVal lParam As Integer) As Boolean
<DllImport("user32")> Public Function EnumWindows( _
ByVal lpFunc As EnumWindowsProc, ByVal lParam As Integer) As Integer
End Function
Private Declare Auto Function GetWindowText Lib "user32" _
(ByVal hWnd As System.IntPtr, ByVal lpString As System.Text.StringBuilder, _
ByVal nMaxCount As Integer) As Integer
Private Declare Auto Function FindWindowEx Lib "user32" _
(ByVal hWnd1 As IntPtr, ByVal hWnd2 As IntPtr, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As System.IntPtr
<Runtime.InteropServices.DllImport("user32.dll")> _
Private Function ShowWindow(ByVal hwnd As IntPtr, ByVal nCmdShow As Int32) As Boolean
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Private Function FindWindow( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As IntPtr
End Function
Public Function EnumWindowCBK(ByVal hWnd As IntPtr, ByVal lparam As Integer) As Boolean
Static WindowText As New System.Text.StringBuilder(100)
Static nRet As Long
nRet = GetWindowText(hWnd, WindowText, WindowText.Capacity)
If nRet <> vbNull Then
If InStr(WindowText.ToString, "Notepad") <> 0 Then
' maximize it
MsgBox(hWnd.ToString)
ShowWindow(hWnd, 3)
End If
End If
EnumWindowCBK = True
End Function
End Module
Then whenever you want to maximize the window, call:
Module1.EnumWindows(New Module1.EnumWindowsProc(AddressOf EnumWindowCBK), 0)
It's pretty self-explanatory. EnumWindows gets all the desktop windows, and in the callback function EnumWindowCBK I compare the window's title with what we are looking for - it's up to you to decide if you only want the window text to match exactly or not. In this one, as long as it contains "Notepad" somewhere in there it will be maximized.
Sorry for not cleaning up that code better.
|
|
|
|
|
Hooooray!
Your help is greatly appreciated. I'm not a programmer, but with your help I accomplished building a screenPrint applet to call in one of our major apps.
I'm sure its not clean. but it does the job....
maximizes the host app,
then takes the snapshot,
puts it in a viewer for printing(with left edge cropped).
|
|
|
|
|
Awesome! Glad I could help. Careful, or you'll become a programmer!
|
|
|
|
|
i hav a table wit one record i write the following code to retieve it and write to a file it works. but when i run as window service it does not write anything to the file. is there a better approach to i should use
Dim con As New SqlConnection("server=PRGLAP11;database = Diamond ;uid=sa;pwd=rr")
Dim con As New SqlConnection(connectionString)
Dim com1 As New SqlCommand(ins, con)
com1.CommandType = CommandType.StoredProcedure
con.Open()
Dim dr1 As SqlDataReader
dr1 = com1.ExecuteReader()
con.Close()
dr1.Read()
s1 = dr1.Item(1)
s2 = dr1.Item(2)
s3 = dr1.Item(3)
Dim f As New StreamWriter("c:\test2.txt")
f.Close()
|
|
|
|
|
Did you check the event viewer on the system where the app is running as a service to see if any errors are being generated when it tries to create and write to a file?
When you set up the service, you must have had to set up a log on account for that service. I am wondering if maybe that log on does not have write permission to the drive or directory where you are writing the file. I don't think that would prevent the service from running, but I would expect it to generate some errors that are likely viewable via the event viewer.
|
|
|
|
|
actually the service is running my aim is to extract the information from database. it seems the reader does not retrn anyting. am using the file as my dubug technic. is ther a better way to debug
|
|
|
|
|
Yes there is a better debug method for windows services. Check out the MSDN article at the following link, that should help...
How-to Debug Windows Service[^]
|
|
|
|
|
thanks i appreciate. will contact u if i hav more issue on that
|
|
|
|
|