|
Good point Eddy
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I would like to know if anyone can give me an example of how to copy text underneath an external program's context menu.
I am playing around with code for basic mouse gestures. When I perform, for example an upwards movement with the right mouse button held in, my program send Ctrl+C to copy whatever is selected when I release the right mouse button. However, lets say I am trying to copy text selected in notepad, If I release the right mouse button over the notepad window, notepad pops up its context menu before my copy command can execute.
You can simulate this by selecting text in notepad, right click and while the contect menu is showing, try pressing ctrl+c.
I am looking for a way to copy what is selected in the foreground window without having to close the context menu. The reason I don't want to close the context menu is that at times you might actually need it, like when you right-click and drag a file in explorer. If my program would esc the context menu then explorer won't pop up a context menu to move or copy the file to where you dragged it.
I hope this makes sense.
Anyone?
|
|
|
|
|
Craig Haywood wrote: selecting text in notepad, right click and while the contect menu is showing,
try pressing ctrl+c
With the context menu open, moving the pointer to "copy" does the same thing ... what is on clipboard ... arghh (brain frozen)
What are you trying to do? Better question, what VB.NET tools do you have available to you to use as a programming platform?
Are you refering to some sort of macro recorder by any chance. Recording mouse movement and behavioral clicks based upon what's on the screen for playback as a mouse behavior repeat in an overlay scenario?
There's this:
Writing a Macro Recorder/Player using Win32 Journal Hooks[^]
|
|
|
|
|
RedDk wrote: With the context menu open, moving the pointer to "copy" does the same thing
I can't programatically move the pointer as not all programs context menus will have the copy command at the same place.
What do you mean what VB.net tools do I have? I use visual studio 2012
|
|
|
|
|
"Underneath"?
What is underneath? Some sort of new technical term for "directly south"? I'm sorry, that was too facetious. Can't help you.
|
|
|
|
|
sorry, english is not my first language. I meant whatever is selected under the context menu
|
|
|
|
|
You cannot capture text just by moving the mouse over a window that belongs to a different application. As soon as you do that all mouse messages will be sent to the owner of that window, which in this case, is Notepad.
Veni, vidi, abiit domum
|
|
|
|
|
thanks to everybody who replied. I found a solution to the problem
|
|
|
|
|
would you share it with us?
|
|
|
|
|
I ended using a global mouse hook to perform (and draw) mouse gestures. That way I can call my own procedures when the right mouse button down/up event is fired
|
|
|
|
|
please help
|
|
|
|
|
Boy, doing this[^] was really hard.
|
|
|
|
|
Hi everyone, I'm in need of a bit of guidance. I'm working on a little weather app and I'm got it all pretty much done. The app gets the local weather by zip code which the user inputs into a textbox. What I would like to do is have the app check the submitted zip code against a list of valid zip codes. Now, I have the list of zip codes and there are honestly more than I thought(approx. 43,180). I tried to hard code a string array with the zip codes but that caused visual studio to get too sluggish to use. Does anyone have any ideas on how I could check the users zip against the list of zip codes, or could you point me in the right direction? Thanks for any and all help.
Oh yeah, I forgot to mention I'm using vb.net.
|
|
|
|
|
|
Database to hold the data and possibly a ComboBox or TextBox, using AutoComplete, depending on your requirements.
|
|
|
|
|
There is something called a HybridDictionary .
Its optimized for performance and could resolve your issue by directly accessing the appropriate zip code.
|
|
|
|
|
|
Thanks guys. It looks like a database is the way to go.
|
|
|
|
|
Hi all,
I have made a datagridview textbox cell autocomplete. Now I want to get the values in the other cell associated with the autocomplete textbox cell from the database.
Like I have 4 Columns in my datagridview.
Col0 is ProductId (Primary Key)
Col1 is ProductName (Autocomplete)
Col2 is AvailableQty
Col3 is Rate
When I select the product from Col1 by Up or Down key, the other column cells would populate the data associated with the productname(Col1) from the database.
My question is how would I do that ?
I tried...
Private Sub DataGridView1_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
If DataGridView1.CurrentCell.Value Is Nothing Then
Else
Try
OpenConnection()
Dim Sb1 As New StringBuilder
Sb1.Append("SELECT * FROM stockitems WHERE ProductName='" & Me.DataGridView1.CurrentRow.Cells(1).Value & "'")
Dim dbcommand As New MySqlCommand
dbcommand.Connection = conn
dbcommand.CommandText = Sb1.ToString
Dim dbread As MySqlDataReader = dbcommand.ExecuteReader
While dbread.Read
DataGridView1.CurrentRow.Cells(0) = dbread("ProductId")
DataGridView1.CurrentRow.Cells(2) = dbread("AvailableQty")
DataGridView1.CurrentRow.Cells(3) = dbread("Rate")
End While
dbread.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
CloseConnection()
End Try
End If
End Sub
But nothing happened.
Then I tried...
Private Sub DataGridView1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles DataGridView1.KeyDown
If e.KeyCode = Keys.Down Then
Try
OpenConnection()
Dim Sb1 As New StringBuilder
Sb1.Append("SELECT * FROM stockitems WHERE ProductName='" & Me.DataGridView1.CurrentRow.Cells(1).Value & "'")
Dim dbcommand As New MySqlCommand
dbcommand.Connection = conn
dbcommand.CommandText = Sb1.ToString
Dim dbread As MySqlDataReader = dbcommand.ExecuteReader
While dbread.Read
DataGridView1.CurrentRow.Cells(0) = dbread("ProductId")
DataGridView1.CurrentRow.Cells(2) = dbread("AvailableQty")
DataGridView1.CurrentRow.Cells(3) = dbread("Rate")
End While
dbread.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
CloseConnection()
End Try
End If
End Sub
But I failed.
Please help...
|
|
|
|
|
Is nobody there to solve me ?
|
|
|
|
|
If anyone knows the answer they will suggest it. In the meantime try running your code through the debugger to see what is happening.
Veni, vidi, abiit domum
|
|
|
|
|
I have an application using an ADODB connection to a DBase database (simple and easy to distribute). I captured the SQL string sent to the connection object using Quickwatch. I pasted the SQL statement into an SQL tool. I executed the SQL and it returned no rows which is correct. However when the same SQL string is passed to the ADODB connection it returns 189 rows.
Here is the code the initializes the ADODB connection:
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\DataStore;Extended Properties=DBASE III"
ConnDBF = New ADODB.Connection
ConnDBF.Open(strConn)
OK = ConnDBF.State
rstGRK = New ADODB.Recordset
rstGRK.CursorType = ADODB.CursorTypeEnum.adOpenStatic
Here is the SQL string being passed:
rstGRK.Open(SQLString, ConnDBF)
ResultCnt = rstGRK.RecordCount
Here is the SQL string:
<pre>SELECT BKL.BkShtName,
SRC.BookNo,
SRC.ChapNo,
SRC.VerseNo,
SRC.VerseText1,
SRC.VerseText2
FROM BIENBVS SRC,
BIBKLST BKL
WHERE SRC.BookNo = BKL.BookNumber
AND (SRC.VerseText1 LIKE '%frank jones%'
OR SRC.VerseText2 LIKE '%frank jones%' )
ORDER BY 2, 3, 4</pre>
The correct results is NO ROWS because the names begin with upper case. The ADODB connection returns 189 rows which is incorrect.
Does anybody have any ideas what could be going on and how to force the connection to be case sensitive?
|
|
|
|
|
The Jet database engine is inherently NOT case sensitive, so you have to force it to be.
I don't use Access (EVER!) but IIRC, you're looking for something like this:
SELECT ... FROM ... WHERE SRC.BookNo = BKL.BookNumber
AND (StrComp(SRC.VerseText1, "frank jones", 0) = 0
OR (StrComp(SRC.VerseText2, "frank jones", 0) = 0)
ORDER BY ...
|
|
|
|
|
The database is actually DBase (good reason to use, but it is a long explanation).
I converted the VB app to use OdbcConnection & OdbcDataReader methods and the ODBC DSN created with driver - "Microsoft dBase Driver (*.dbf)" . The results are the same - the query in VB still refuses to be case-sensitive.
If I put a breakpoint in the code and capture the SQL string and paste the string verbatim into WinSQL (an SQL tool using the same exact ODBC DSN), and execute the query, no results are returned.
The query behaves differently in VB that in an SQL tool using the exact same driver and ODBC definition.
Do not know why it works differently in VB than in WinSQL !!!!!
|
|
|
|
|
I have no idea since I don't have any access to any dBase databases. Thats one I have used since 1986.
I have no idea how to make it case sensitive for dBase.
|
|
|
|