Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > API > send enter key or chr(13) to the external form or messagebox

Thread Tools Display Modes
Old 06-19-2003, 01:20 AM
shweta shweta is offline
Join Date: May 2003
Posts: 4
Default send enter key or chr(13) to the external form or messagebox

i am using third party control in my application. that is a .ocx file. when i run the application everytime it shows messagebox / form, when i press enter then it goes ahead with the application.

how can i send enter key through code. so that i dont need to press enter every time.

is it clear ??
Reply With Quote
Old 06-19-2003, 03:15 AM
anomaly's Avatar
anomaly anomaly is offline
Join Date: Sep 2001
Location: Florida
Posts: 517

PopupHwnd will be the handle of the button

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Const WM_CHAR = &H102 Call SendMessage(PopupHwnd,WM_CHAR,13,0&)
So let it be written. So let it be run.
Reply With Quote
Old 06-19-2003, 04:23 AM
shweta shweta is offline
Join Date: May 2003
Posts: 4
Default Sending enter key

thx ! but its not working.

Where should i call the the function sendmessage. becaz even if i call it in form_initialize event it fires the message box.
do i need to mention the command button name. because i dont know the name of the button or the message box

please help me yaar !!
Reply With Quote
Old 06-19-2003, 07:35 AM
Csharp's Avatar
Csharp Csharp is offline
Senior Contributor

* Expert *
Join Date: Jul 2003
Location: Ashby, Leicestershire.
Posts: 967

Private Declare Function BringWindowToTop Lib "user32.dll" (ByVal hwnd As Long) As Long Private Sub Command1_Click() BringWindowToTop hWnd '/// THE OTHER APPLICATIONS HANDLE. SendKeys "{ENTER}"'/// send the enter key to that window to close the messagebox. End Sub
in that instance i had a seperate application open with a messagebox saying "loaded!" , then from my vb project i clicked Command1 and closed the messagebox.
hope that helps.
~~ please don't PM me regarding code, I only reply to personnal messages ~~
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multi connections, one port? burningodzilla Communications 5 08-02-2005 05:04 PM
how to put enter key in an external messagebox shweta API 1 06-19-2003 12:19 AM
MDI Form and dimensions kkonkle Interface and Graphics 6 03-26-2003 10:50 AM
WinSock vbsupernewbie Communications 1 09-12-2001 10:20 PM
Create a new form similar to an existing form ric General 6 07-17-2001 12:47 AM


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..