|
Hi Everyone,
I'm writing an application that implements an on-screen keyboard (because the Windows on-screen keyboard is extremely small and hard to use) and I'm having problems setting focus to the desired window in which the user wishes to type.
I'm using a few User32 API calls to get the active window handle number and then set the active window once I know what the handle is. This seems to be working OK. However, the window which has focus (the one receiving the typing) flickers as the user clicks on a key.
This is because as the user touches a key to type, it gives the keyboard focus and then immediately sends focus back to the window in which the user is typing, hence the flickering. So...
Question #1:
How can I eliminate the change of focus and always give focus to the desired window so that there is no flickering back and forth between my keyboard application and the window receiving the typing?
Question #2:
This is not just a standalone keyboard, but is a small part of a larger piece of software. Consequently, there are occasions when the user must use this on-screen keyboard to type into a window within it's parent application or into different forms within the app. One form contains a browser control to a company website. When they keyboard is used to type into any text field on a webpage displayed in the browser control, only every other word is sent to that text box. Two key strokes are required to output one letter. What could be a possible cause of this and how might I go about fixing it?
ANY suggestions or help is much appreciated. Code examples in VB.NET, VB 2005, and C# are fine. C++ OK too but only if it's immediately applicable and can be converted easily to VB.NET.
Thanks in advance to anyone who contributes!!!!
Patrick
|
|
|
|
|
Hi,
I'm using MAPISession and MAPIMessage components to access MS Outlook emails but the "Fetch" does not retrieve any read emails.
The code I have is as follows:
...
MAPISession1.Username = "Outlook"
MAPIMessage1.DownloadMail = True
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Fetch
iNumOfMsgs = MAPIMEssages1.MsgCount 'iNumOfMsgs declared as a local var
...
iNumOfMsgs returns 0 when there are 100 read emails
Any help with this is very much appreciated
|
|
|
|
|
Hi,
If I have text like:
VariantDisplayMode
How do I break it up so that it displays as:
Variant Display Mode?
Basically it is a seperation at the capital letters.
Regards
ma se
|
|
|
|
|
Use the Regex class with a regular expression pattern like "([a-z])([A-Z])" to find the changes from lower case to upper case. Put a space between them by replacing the occurances using the pattern "$1 $2".
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa, I think that regular expression would fail to properly parse something like "ThisIsATest" because it wouldn't pick up on two capital letters next to one another. I think something like this would be required to find the word boundaries "([A-Z]|[a-z])(?=[A-Z])". Using a replace of "$1 ".
|
|
|
|
|
That's a good point. I didn't think of the special case of single letter words.
---
single minded; short sighted; long gone;
|
|
|
|
|
Another way would be to :
-Create a character Array of your text using ToCharArray()
-Test each character , if Caps add space before the character and add it to the resulting string otherwise add the character to the resulting string:
<code>
Private Function TransFormText(ByVal oText As String) As String
Dim oResult As String = ""
Dim oArray() As Char = oText.ToCharArray()
For Each oItem As Char In oArray
If oItem. = oItem Then
oResult = oResult & " " & oItem
Else
oResult = oResult & oItem
End If
Next
Return Trim(oResult)
End Function
</code>
|
|
|
|
|
You should however mention that the method scales very badly, so it's only suitable for very short strings.
For a string with 20 characters, it creates 40 string objects to produce the result. Also, for every additional character the memory usage doubles.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: You should however mention that the method scales very badly, so it's only suitable for very short strings.
For a string with 20 characters, it creates 40 string objects to produce the result. Also, for every additional character the memory usage doubles.
sure, But its a good starter.Obviously the poster is a beginner and in such cases its better to provide a solution that is easy to understand and that build up logic...
|
|
|
|
|
Well, at least it increases the traffic to the site when he comes back wondering why the code is getting so f... ehm... extremely slow.
---
single minded; short sighted; long gone;
|
|
|
|
|
There was an error in my previous post:
<code>
Private Function TransFormText(ByVal oText As String) As String
Dim oResult As String = ""
Dim oArray() As Char = oText.ToCharArray()
For Each oItem As Char In oArray
If Char.ToUpper(oItem) = oItem Then
oResult = oResult & " " & oItem
Else
oResult = oResult & oItem
End If
Next
Return Trim(oResult)
End Function
</code>
|
|
|
|
|
I have a couple questions about writing a text file (Most of it know as I've been writing files in this application for quite some time now) but the real question I have is this: I am changing my error log text file to a comma delimited file. The first line with be my headers (Error, Message, Stack Trace, Date/Time) how do I go about only writing this line a single time, then go about adding any errors that may happen below it
"Well yes, it is an Integer, but it's a metrosexual Integer. For all we know, under all that hair gel it could be a Boolean."
Tom Welch
|
|
|
|
|
Write the headers when you create the file :
If Not File exists Then
' Create Log File
'Write Header
Else
' Write Log Row
End If
|
|
|
|
|
Hi, to all.
Mine question is : can i use SQL commands about selecting, sorting and filtering data in VB.Net on DataTables...and which of them can i use
Especially CASE...WHEN...ELSE..END
|
|
|
|
|
Not reall sure what you are wanting to know...You can use ADO.NET to select table from a database using SQL commands if that is what you are talking about?
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
You can not use select insert update statements on datatables, rather you can filter your datatable with DataTable.Select(filterexpression as String) method, where filterexpression is like Dept='Administration'.
These filter expression is just like Where clause of Select statements.
Be a part of solution, rather then be a part of problem
|
|
|
|
|
Yes, i was trying to use case.. then .. else .. end statment like in sql in where clause, but i did not make it. Just filtering.
I have some information that there is driver, i guess,thru it is possible to use most of sql statments in vb on datatables. Thank you anyway
|
|
|
|
|
i want to open form2 from menu strip button
Menustrip buttons name is "Preference"
Other button is Exit by which i want to close the application
i want to know its coding plz help me ( (
|
|
|
|
|
to open new form:
dim frmTemp as new Form2
frmTemp.show
to close the application:
Application.Exit()
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
thanx
now i want to make FTP browser
there is no such a option in toolbox
plz help me
|
|
|
|
|
|
|
but where i have to copy & paste these codes??
i had already created design (
|
|
|
|
|
Hello,
i've found a code on this page :http://weblogs.asp.net/kennykerr/archive/2006/08/10/Windows-Vista-for-Developers-_1320_-Part-3-_1320_-The-Desktop-Window-Manager.aspx[^] there's described how to make glass effect, without the known problems with the black controls in the window. But the problem is, the code is written in VC++ and i can't VC++ =(.
How can i do the same in VB.NET?? I've tested a lot, but it doesn't work easyly.
Here's my Code:
Public Class Form1<br />
<Runtime.InteropServices.DllImport("dwmapi.dll", CharSet:=CharSet.Auto)> _<br />
Public Shared Sub DwmExtendFrameIntoClientArea(ByVal hWnd As System.IntPtr, ByRef pMargins As Margins)<br />
End Sub<br />
<br />
<Runtime.InteropServices.DllImport("dwmapi.dll", CharSet:=CharSet.Auto)> _<br />
Public Shared Sub DwmIsCompositionEnabled(ByRef IsIt As Boolean)<br />
End Sub<br />
<System.Runtime.InteropServices.DllImport("user32.dll")> _<br />
Private Shared Function SetLayeredWindowAttributes(ByVal hWnd As IntPtr, ByVal crKey As Int32, ByVal bAlpha As Byte, ByVal dwFlags As Int32) As Boolean<br />
End Function<br />
<br />
Const COLORREF As Int32 = -65281<br />
Const LWA_COLORKEY As Int32 = 1<br />
<br />
Public Structure Margins<br />
Public Left As Integer<br />
Public Right As Integer<br />
Public Top As Integer<br />
Public Bottom As Integer<br />
End Structure<br />
Private inset As Margins = New Margins<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
Me.BackColor = Color.FromArgb(COLORREF)<br />
'Me.TransparencyKey = Color.FromArgb(COLORREF)<br />
<br />
SetLayeredWindowAttributes(Me.Handle, COLORREF, 80, LWA_COLORKEY)<br />
Dim marg As New Margins<br />
marg.Bottom = -1<br />
marg.Left = -1<br />
marg.Top = -1<br />
marg.Right = -1<br />
<br />
DwmExtendFrameIntoClientArea(Me.Handle, marg)<br />
<br />
End Sub<br />
End Class
Another code, which do the same and is written in C# i've found on this site: http://weblogs.asp.net/kennykerr/archive/2007/01/23/controls-and-the-desktop-window-manager.aspx[^]
Has somebody any ideas how to do this???
Thanks for your help =)
|
|
|
|
|
Are you still having trouble with this?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|