Strange Onscreen Keyboard problem

Hello gurus ;)
i'm working on an application that needs onscreen keyboard for reasons that
i will not mention here.
I have found some interresting code at the following location:

The keyboard found there builds well and run fine (no problem for notepad).

But when i try to use in my application where it is used for entering
username and password on a prompted dialog box, then it does not seem to
work properly.

My dialog box is system modal.

What is does is that it displays only the latest character entered in the
edit field of the dialog box.
And when i set the cursor on the password field ,the character entered is
still displayed  in the username field
and only the latest character enered is displayed.

What can cause this?

Many thanks in advance

bredal (20)
9/24/2004 7:55:00 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 18

I have't really analysed that sample code. But here's some code using a 
method which shouldn't flash and which hopefully will work with your app. 
Its just sample code, you click on the window and it sends the keypress 

// Requires Windows 2000

#define _WIN32_WINNT 0x500

// Application Includes
//#include "stdafx.h"
#include <windows.h>
#include <winuser.h>
#include <stdio.h>

// Forward declarations

LRESULT CALLBACK JournalProc(int code, WPARAM wParam, LPARAM lParam);
LRESULT OnMouseMove(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnMouseActivate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT OnLButtonDown(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

// Globals (bad..bad..bad)
HWND   g_hwnd  = NULL;
HHOOK  g_hHook = NULL;
POINTS g_pt;

// Windows entry point

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR 
lpCmdLine, int nShowCmd)
	WNDCLASS wndclass;
	MSG msg;

// Set up the journal hook

	g_hHook = SetWindowsHookEx(WH_JOURNALRECORD, JournalProc, hInstance, 0);

// Register our window

	memset(&wndclass, 0, sizeof(WNDCLASS));         = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc   = WindowProc;
	wndclass.hInstance     = hInstance;
	wndclass.hIcon         = LoadIcon(NULL, IDI_WINLOGO);
	wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
	wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	wndclass.lpszClassName = "VKey32";


// Create the window

	g_hwnd = CreateWindow(
		"Virtual Key",

		ShowWindow(g_hwnd, SW_SHOW);

// Start the message pump

		while(GetMessage(&msg, NULL, 0, 0) > 0)

// Clean up the hook on exit


	return 0;

// Windows procedure

	LRESULT result = 0;

		result = OnMouseMove(hwnd, uMsg, wParam, lParam);

		result = OnMouseActivate(hwnd, uMsg, wParam, lParam);

		result = OnLButtonDown(hwnd, uMsg, wParam, lParam);

	case WM_CLOSE:

		result = DefWindowProc(hwnd, uMsg, wParam, lParam);

	return result;

// Keep track of the mouse cursor's position (there's probably a better way)
LRESULT OnMouseMove(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
	g_pt = MAKEPOINTS(lParam);

	return 0;

// Keeps the focus on the target app whenever the user clicks on our client 

LRESULT OnMouseActivate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
	LRESULT result;
	RECT rect;
	POINT pt;

// Check to see if the click was in our client area

	GetClientRect(g_hwnd, &rect);

	pt.x = g_pt.x;
	pt.y = g_pt.y;

	if(PtInRect(&rect, pt))

// Return keyboard focus to the previously active app

		result = MA_NOACTIVATE;
		result = MA_ACTIVATE;

	return result;

// Send a VK_RETURN keystroke to the target app

LRESULT OnLButtonDown(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)

	memset(&i, 0, sizeof(INPUT));
	i.type   = INPUT_KEYBOARD; = 0x41;//this is an a
	SendInput(1, &i, sizeof(INPUT)); 

	return 0;

// Hook procedure (just do default processing)

LRESULT CALLBACK JournalProc(int code, WPARAM wParam, LPARAM lParam)
	return CallNextHookEx(g_hHook, code, wParam, lParam);

// End of file

andmort (67)
9/27/2004 8:38:20 AM

Similar Artilces:

Connection Manager API problem
1) Connection Manager API establish the connection and connection handle is returned which is implemented on 'Connect' button. 2) The connection handle returned by the API to establish connection is the input for the API to check the connection status which we have implemented on the 'ConnStatus' button click.The status is returned successfully till the connection is there through Connection Manager API. If click on 'Disconnect' button and Connection is Released then on click of 'ConnStatus' returns E_Fail. but actual device connection is still there. Why this...

very weird problem in windows xp
I have this very weird issue on windows xp. Even after I formatted, and reinstalled everything, it eventually comes back. Now this doesnt always happen. My current guess is when i use around 2GB/4GB of my memory and have alot of apps running, it starts. The problem is, sometimes for a period of time (could be up to a few hours), the following happen in any combination (sometimes all): - I cant open a folder, if i double click, it just doesnt load. - If any folders including My computer does open, all the contents inside are not displayed. - Applications dont load. When I tried t...

Re: Word 2001 for Mac and Color Stylewriter 1500 problem
Discussion ongoing on, which gets more traffic anyhow. "Peter Gurney" wrote: > Dear Expert, > > There seems to be an incompatibility between MS Word 2001 for Mac (for which > I have run the latest updater) and the Color Stylewriter 1500 printer driver > vZ2-2.2.1 which is part of the Mac OS 9.1 software. > > Unlike other components of Office 2001 and other applications such as MS > Works 4.0, Claris Works etc which have A4 as an option in the pop-up menu > for page size, with Word 2001 this is not available and so I hav...

Page Number Problem
Hi there, hope you are fine... I'm new in this forum, and I have a doubt (a big doubt) about page number... Here is the problem: I have a long spreadsheet (about 320 pages), and I need to show the the current page number, in a sigle cell (A1, for example)... So, if a cell in page 1 is selected, in A1 we'll have "Page 1 of 320", otherwise if the selected cell is in page 20, now A1 will be showing "Page 20 of 320", and so on... I've tried use the PageBreaks.Count, but I get always the same result: "*Page 1 of 320*", it doesn't change to "15 o...

There is a problem with your printer settings. #3
Can anybody please help??? Please?? -- kirks What is the problem? -- Don Vancouver, USA "kirks" <> wrote in message > > Can anybody please help??? Please?? > > > -- > kirks ...

Archiving problems with Outlook 2002
I had users in Exchange 2000 using outlook 2002 with 12=20 GB mailboxes. We don't want to bring the old mail to the=20 new server... We are archiving by year. The PST files=20 are less then 1 GB each. How large can a PST file be=20 with outlook 2003? How do I archive these files that=20 will no longer archive? I am doing a File>Archive not=20 automatic archiving... Scott >-----Original Message----- >4 gig mailboxes are only supported in Outlook 2003. Why=20 did you archive it? > >Also, archiving works on the modified date, so if you=20 have played with your=20 >it...

Problem referencing multiple closed .xls files
Hi there. I have an Excel file [MAIN] that references multiple other Excel files [SUB]. For example, if I put the following into a cell in MAIN and have the SUB files closed, this works: ='C:\Documents and Settings\Scott\My Documents\MAIN DIR\SUB DIR\[SUB.xls]Sheet25'!$D$11 The above returns the value [not #REF!] even when SUB is not open. But if I try relative addressing: =SUB DIR\[SUB.xls]Sheet25'!$D$11 or, INDIRECT, or CELL, or VLOOKUP, nothing can return the value from a closed file. Any ideas without having to resort to either UDFs or Macros. My client is unwilling to...

Import problem #2
In trying to import an old .pst backup into Outlook 2003 from a CD I get an error that denies me access to those files. I'm pretty sure I specified no encryption (and no compression) when I created the backup, and I didn't set a password. The backup may have been created using Office 2000, but I don't see what difference that should make. So why can't I get into my own files? TIA for any help. Tom S In news:Q_O2g.4927$, Tom S <> typed: > In trying to import an old .pst backup into Outlook 2003 from a CD ...

Problem after migrating from Exhange 5.5 to 2003 !!!!!!
we have successfully migrated from EX 5.5 to Ex 2003, but have encoutered a small issue, some users that get migrated accross to the new server cannot delete emails using outlook 2002 Sp1.. the Deleted items Icon is not shown as a recycle bin icon but comes up as a normal folder... you cannot move anything into this folder nor can you right click and empty the folder.... any ideas? the weirdest thing of it is i we moved 2 users and one was ok the other had the above problem. both moved at the same time to the same server all help is greatly appreciteded Have you tried running outlo...

Problems getting Sysvol to replicate on new Domain Controllers
When adding a new domain controller to the domain, the Sysvol will not replicate. This error has occurred on three Servers I promoted to test. Sysvol is replicating fine between the other 8 dc’s (4 in 1 site, each of the other 4 in their own site). I have done the following. Run dcdiag /v Issues that came up in the log are the failed advertising and sysvol tests (since no sysvol, this is to be expected). Under the FSMOCheck I noticed the PDC emulater is not the primary time server…..may not be anything since the tests passed. tarting test: FsmoCheck GC Name: \...

OWA SSL problem... please help
Hi, We have an Exchange Server with OWA on SSL. 2 Days ago something happened to the SSL on IIS. On accessing the https://mailserveraddress/exchange website the certificate or login prompts do not appear. Instead I get a "page cannot be displayed" error. When SSL is disabled (http://mailserveraddress/exchange) OWA works just fine. I have tried everything I could find on MS KB with little success. Does somebody know how to resolve this problem and get Certificate Services back up on IIS ? Thank you for your help Sai Krishnakumar ...

Outlook 2002 Spell check problem
I got a new pc with XP and Outlook 2002. Outlook had word selected as my email editor. When I complete the spell check outlook won't allow me to hit the send key. If I do another fuction or go between windows the send key will work again. I have duplicated the problem on a couple other PC's. Any ideas what causes this? Have you tried Detect and Repair? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the SWEN virus, all mail sent to my personal account will be deleted without reading. After searching ...

Problem with termination of a console app within an MFC app while console is working
Hi, I have a mfc application. It executes a console application with CreateProcess which is a lenghtly process. I will hide the console app from the user. My problem is this: I want to close MFC app AND console application While hidden console app. is still active. How can I do this? Code is below: void CCPSDoc::OnAnalyseRun() { // TODO: Add your command handler code here CString str ; str = "cmd /c waitdlg.exe" ; //an app can work 15 minutes STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); si.dwFlags = STARTF_USESHOWWI...

I have set up several hyperlinks in a workbook to other workbooks on our work network When I press these links they put me in the correct workbooks but close the book that the links were in - I want it to stay open. Anyone any ideas? Jason Try changing something in that workbook before you click on the link. If excel thinks the file is dirty (changed since last save), then it won't close. jason wrote: > > I have set up several hyperlinks in a workbook to other workbooks on > our work network > When I press these links they put me in the correct workbooks but > close ...

Strange email prompt
I've inherited responsibility for running several programs that, among other things, email the results of the same programs. These programs run on several PCs and I've just added them to another PC so they can run there. The problem is, on this new PC, a prompt comes up saying something like "A program is trying to access email addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose "No." Allow acces for " and there's a drop down window and I click yes and it continues and then another wind...

Move Mailbox problem
Hello All, We just migrated from 5.5 to 2k3 and for the most part all went well. However, I have one user who's mailbox resides on both servers. The mailbox move reported successfully with no errors and was transported (with all of its content) to the Exchange 2k3 server. However, their is still a "residual" mailbox on the 5.5 server with 1KB of data in it. When I do properties (from the 5.5 server) it claims the object is not in the directory. Also, when I right click on the mailbox (from 2k3 server) to do the Exchange Tasks.... it will only give me a menu context of ...

Problem using calculated item for grouping
I have a pivot table showing counts of grades achieved by students. I can group some of these grades by adding a calculated item that just adds together the number of, say, grade As and grade Bs. This seems more elegant than the outline and grouping feature. So far so good. However I have another table where I have the data field added twice: one formatted as a percentage of the column. That works nicely too; I drag the 'data' field into the main body of the table and then label one column "Num" and the other "per cent". The problem is I can't now do my gro...

some strange profile corruption
Dear group, I've run into something quite strange, that I would share with you and ask you whether you know any solution to it without having to use the installation CD of to reinstall Outlook. The problem I will describe has occured OL2000. It's driving me nuts. Description: User (OL2000, CW) calls and says that he is not able to compose mails. My first idea was of course that this will be again some connectivity issue again. However after I've looked at his screen, the error message referred to the error that there is no delivery location set and I would have to set a va...

Problem w/ Historical AR Trial Balance
I'm getting for following error when running a receivables historical aged trial balance in Dynamics GP: "Unspecified error occurred on SQL server. Connection may have been terminated by the server. The stored procedure rmHistoricalAgedTrialBalance returned the following results: DBMS -127, GP: 0." I've tried everything, but can not get the report to run. HELP!! Dear Warren, I guess you need to do more investigations on this issue, please check DEXLOG file or do a trace using SQL Server profile to get the exact technical problem, this will identify your problem. ...

Rule problem in Outlook 2003
I just upgraded to Outlook 2003 on my Win2000 Pro machine. I am having a major problem with my Rules. I have a rule created that automatically CC's someone on every email I send. I've been using this rule for a long time in both Outlook 2000 and 2002 without a problem. Now, with Outlook 2003, the rule does not work when I am working in Offline Mode. This was NEVER a problem with the other versions of Outlook. Does anybody have any suggestions on how to fix this? Is this a bug in Outlook 2003? Please help! Thank you. Robert Shaw Have you tried to recreate this rule? ...

Excel got problems with many controls?
Hello. I have an excel file with 20 pages including textboxes, checkboxes and buttons. Each page contains around 100 of these controls; mostly textboxes. Starting this excel file I got many display errors: - some regions of the screen are not always updated correctly - textboxes are not shown instead a right cross is displayed - font style and size is changing sometimes Has excel a problem with such a number of controls? Does anybody know a possible workaround? Any comments and help is welcome. Thanks a lot in advance! Greetings. Tim. I've read posts that say too many controls from...

Installation problem (Unknown error 80040E07)
I've tried to install MSCRM on a windows 2003 system. At the end of the installation process I received a message box - Failed to install MS CRM Server - Failed to provision your initial business - Failed to create organization - Unknown error (80040E07) Has anybody an advice for me ? Thanks Uwe I do not believe that CRM is supported yet on 2003. "Uwe Kuhne" <> wrote in message news:OYfQt$iSDHA.2148@TK2MSFTNGP11.phx.gbl... > I've tried to install MSCRM on a windows 2003 system. > At the end of the installation process I received a message box &...

problems with VC# 2008 express, after instralling dot net framewor
hi, recently i've upgraded the dot net framework to v4 , and then i noticed some annoying bugs on VC# . from some reason, i can't see anything in the properties menu anymore(no matter what i select with the mouse , unless it's a file) ,and the toolbox is always's a picture: i've also noticed that some menus on the options window are empty . here's a picture: i've decided to re-install VC# , but i always get the same errors , and i cannot succeed with it. here's...

Strange Problem with Time Zones
I went through a period couple months ago on my main PC now running XP-SP3, where I installed a bunch of MS Updates because wife and I had neglected to "keep up" with the updates over the past year. I had to struggle to get SP3 on that box, then I could get the rest of them on there. However, after I finally got all "caught up", I noticed my Time Zone setting was GMT-8 (which is correct) but said "Tijuana/Baha CA" rather than U.S. Pacific Time. :) System thinks I live in Mexico and this new time zone update has not fixed it! OK now, I hope y...

Inventory value problem
How do I display the current value of my inventory? The balance sheet only gives one word, "Assets". For tax purposes I need to know the inventory value as a separate item. the Help file doesn't say anything about where to find inventory values. Bob ...