473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

SendKeys cannot run inside this application

Hi,
We are launching .net window from vb6 form. In .net form tabbing(tab out
from one control to another control) was not working. for that i have written
a code like Sendkeys.send("{TAB}") in the textbox keypress event. I got the
following error msg:
{"SendKeys cannot run inside this application because the application is not
handling Windows messages. Either change the application to handle messages,
or use the SendKeys.SendWait method."}

Any help would be appreciated.

Regards,
Sriman.
Oct 8 '07 #1
5 12946
I've never had the problem, so this is just a guess:

Try setting the Form's KeyPreview property to true?!?!?!

Cheers,
Johnny J.


"Sriman" <Sr****@discussions.microsoft.comwrote in message
news:EC**********************************@microsof t.com...
Hi,
We are launching .net window from vb6 form. In .net form tabbing(tab out
from one control to another control) was not working. for that i have
written
a code like Sendkeys.send("{TAB}") in the textbox keypress event. I got
the
following error msg:
{"SendKeys cannot run inside this application because the application is
not
handling Windows messages. Either change the application to handle
messages,
or use the SendKeys.SendWait method."}

Any help would be appreciated.

Regards,
Sriman.

Oct 9 '07 #2
Sriman wrote:
We are launching .net window from vb6 form. In .net form tabbing(tab out
from one control to another control) was not working.
This is pretty basic to a Forms application so, if it's not working,
there's something very, /very/ wrong that needs fixing first.

How are you launching the .Net Form? .ShowDialog? Application.Run()?
For that i have written a code like Sendkeys.send("{TAB}") in the
textbox keypress event.
SendKeys is going to give you ever-increasing problems, especially under
Vista; Id suggest using the TextBox's SelectNextControl method instead.
I got the following error msg:
{"SendKeys cannot run inside this application because the application is not
handling Windows messages. Either change the application to handle messages,
or use the SendKeys.SendWait method."}
There's no Windows Message pump running so your .Net app doesn't think
it's a Forms application.

HTH,
Phill W.
Oct 9 '07 #3
Hi,
We are launching .net window from vb6 form. In .net form tabbing(tab out
from one control to another control) was not working. for that i have written
a code like Sendkeys.send("{TAB}") in the textbox keypress event. I got the
following error msg:
{"SendKeys cannot run inside this application because the application is not
handling Windows messages. Either change the application to handle messages,
or use the SendKeys.SendWait method."}
Sendkeys is always a hack.. I would avoid it.

I have not touched VB6 in 5 years, so, take this for what it is worth.

1) Sounds like you have 2 forms? This seems wrong.
Make your .Net form a control, then host that in the vb6 form.

It sounds like you have 2 message loops running, one in each version of VB,
and that they are not coordinating the messages correctly.

2) If you already are using a control then step back and think what sendkeys is.
It basically puts a windows message in a given progs message queue.

In this case the VB6 parent form is handling the msg Q and is delegating a subset of
the events to your control. Also consider that all of this is happening in one
thread. So you have vb6, a BIG wall, then .NET.

With sendkeys, you are trying to throw a message over the wall.
But there is only one thread. 2 seperate apps would be no prob, should work fine.
With one thread, you are throwing the message, and waiting for a response, but
you are halting the thread waiting, so there can be no response.

So, like the error message says, DONT DO THAT. Use SendWait..

Further, I suspect this will not work :)

After all, vb6 ALREADY GOT the tab message, and then nicely delegated it to you..
Sending the same message back is not going to help. You will just go into a ping pong state.

On your control, you may want to expose a public property called NextControl.
whether a vb6 control is a valid .Net "control" with numerous interfaces, I dunno.

Maybe you have to pass an hWnd. But vb6 made it hard to get to hWnds, didnt it?!?

Anyway, inside your .Net code, if you are on the last control, then set focus to NextControl..
Set NextControl in your VB6 form load event..
Hope that helps.

Oct 9 '07 #4
Thanks for the responses.
We are launching the windows as modeless i.e .show() .. if i use
showdialog() no problem to me(able to tab out). but we should launch the
form as modeless form only(this is the requirement).

"Phill W." wrote:
Sriman wrote:
We are launching .net window from vb6 form. In .net form tabbing(tab out
from one control to another control) was not working.

This is pretty basic to a Forms application so, if it's not working,
there's something very, /very/ wrong that needs fixing first.

How are you launching the .Net Form? .ShowDialog? Application.Run()?
For that i have written a code like Sendkeys.send("{TAB}") in the
textbox keypress event.

SendKeys is going to give you ever-increasing problems, especially under
Vista; Id suggest using the TextBox's SelectNextControl method instead.
I got the following error msg:
{"SendKeys cannot run inside this application because the application is not
handling Windows messages. Either change the application to handle messages,
or use the SendKeys.SendWait method."}

There's no Windows Message pump running so your .Net app doesn't think
it's a Forms application.

HTH,
Phill W.
Oct 9 '07 #5
I got the solution

http://support.microsoft.com/kb/839076/
"Johnny J." wrote:
I've never had the problem, so this is just a guess:

Try setting the Form's KeyPreview property to true?!?!?!

Cheers,
Johnny J.


"Sriman" <Sr****@discussions.microsoft.comwrote in message
news:EC**********************************@microsof t.com...
Hi,
We are launching .net window from vb6 form. In .net form tabbing(tab out
from one control to another control) was not working. for that i have
written
a code like Sendkeys.send("{TAB}") in the textbox keypress event. I got
the
following error msg:
{"SendKeys cannot run inside this application because the application is
not
handling Windows messages. Either change the application to handle
messages,
or use the SendKeys.SendWait method."}

Any help would be appreciated.

Regards,
Sriman.


Oct 9 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JohnD | last post by:
I am using XP Pro and when I try and run an ASP.NET page on my own server I recieve the following error messag Server cannot access application directory ..(web directory here)... The directory...
1
by: Socrat | last post by:
HI! Need to have command window inside main frame of application, something like Command Window in MATLAB Is any example for Visual C++ available in I-net? Any help will be appretiated! ...
1
by: Kevin | last post by:
Hi All, When I try to run my very first .net App on the server, I got the error saying that "Server cannot access application directory 'D:\Inetpub\myApp\'. The directory does not exist or is...
0
by: M | last post by:
I installed the Visual Basic .NET Resource Kit. When I click 'Visual Basic .NET Resource Kit' the page at 'http://localhost/VB.NETResourceKit/Welcome.aspx' show: Server Error in...
12
by: Charles Law | last post by:
A client has just reported that when they run a VB.NET application on Windows 2000 an error is reported "Cannot find Application Configuration File". It runs fine on Windows XP Pro. Does anyone...
2
by: Matthias Wohlmann | last post by:
Hi, I'm getting the following error when trying to start my application using Internet Explorer: "Server cannot access application directory D:\xxx. The directory does not exist or is not...
1
by: rajalingam | last post by:
Server Error in '/library' Application. -------------------------------------------------------------------------------- Server cannot access application directory 'F:\Library Latest Code\'. The...
4
by: =?Utf-8?B?R3JhbmRtYSBDYXJvbA==?= | last post by:
Can anyone tell me what the following message mean? "cannot initialize application, unable to open file {15034:1:8] I am getting this message when I try to open a video software from my desktop....
1
by: mac521 | last post by:
I would like use access to update another application by using the sendkeys method. What I'm looking for is how to set the focus to the other application window and then use sendkeys to type in...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.