• 0

Passing a window some text?


Question

Is there anyway to do this, I was thinking with VB (I have been out of the programming scene for about 2 years now) but I was most comfortable with VB.

We run Domino Server at work on a few systems, What I want to be able to do is write a program or script that will shutdown the service, Copy some files (Backup) and restart the service. That sounds easy right . . . However when the service starts it opens the console and prompts for a password which at the moment we have to manually type in (Which is a nightmare to schedule). Is there a way I can write the program to it grabs the window effectively and passes it the password, i.e it emulates a person typing in the password????

Link to comment
https://www.neowin.net/forum/topic/844948-passing-a-window-some-text/
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Is there anyway to do this, I was thinking with VB (I have been out of the programming scene for about 2 years now) but I was most comfortable with VB.

We run Domino Server at work on a few systems, What I want to be able to do is write a program or script that will shutdown the service, Copy some files (Backup) and restart the service. That sounds easy right . . . However when the service starts it opens the console and prompts for a password which at the moment we have to manually type in (Which is a nightmare to schedule). Is there a way I can write the program to it grabs the window effectively and passes it the password, i.e it emulates a person typing in the password????

Hello, you want to allow your application to send "Window Messages". As I recall, you must write your code so it can interact with "user32.dll" which exports the send messages function. There are a lot of examples online, such as this Window Messages in VB.NET. That should be enough to get you started.

  • 0

Are you using VB.NET or VB6? In VB.NET you can use the SendKeys.Send method. Here is some documentation on how to use it. You'd have to first use the FindWindow API to grab the window handle from the window in question (the one with the password) and then use the SetForegroundWindow API to set focus on that window (make it active/in front) so when the SendKeys.Send method is invoked, all the data will be sent to that window.

All of these APIs are well documented so that should be enough to get you started.

Alternatively, you could use something like AutoHotKey to do the same thing if you find figuring all that out to be too difficult.

Other useful info: You can also use the SetWindowText API for specific apps to change the text of text boxes, labels, and other GUI-oriented objects if you've got the window handle (aka hWnd). You can use Spy++ to see how different windows have different handles/class names (use FindWindow to get the handle by the window's title). You can also get handles by enumerating processes and getting a list of child windows and such too. It's a lot of fun learning to be honest -- messed with all these APIs when I was 16-17 when I still used VB6 a lot.

You can use Message.Create in VB.NET and C# to send messages to windows (given you know the handle) to terminate them, set window styles, change visibility, force form events to occur, etc.. as well.

Edited by Se7enVII
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Salesforce to acquire Fin, formerly Intercom, for over $3 billion by David Uzondu Image via DepositPhotos.com Salesforce today announced that it has reached an agreement with customer support software company Fin to buy the company for around $3.6 billion. Salesforce expects the transaction to close in the fourth quarter of its fiscal year 2027, and the acquisition will not change its financial guidance previously announced on May 27. Marc Benioff, CEO of Salesforce, in its press release, claimed that acquiring the startup gives Salesforce an immediate AI agent that resolves support tickets across email, WhatsApp, SMS, and Slack: You might know Fin by its former name, Intercom. If you have ever been on a website or inside a mobile app and noticed a little chat bubble widget floating in the bottom right corner of your screen, often featuring a friendly face and a message like, "Hi! How can we help you today?" you were almost certainly looking at Intercom. Intercom became Fin just last month, transforming itself into an "AI-first" platform that handles customer issues with little need for humans to intervene. The new name originates from the company's highly successful AI customer service agent, which it launched way back in 2023. This digital assistant supposedly resolves about 76% of customer service volume end-to-end on its own, so the business rebranded to match its primary software tool. Fin's new owners, Salesforce, went on an acquisition spree over the last few years, and some of them you might recognize, like its 2020 $27.7 Billion acquisition of Slack. The last few months saw the enterprise giant buy several startups, including m3ter, Momentum, Cimulate, and Contentful. Salesforce said that when the Fin deal pulls through, customers will "deploy AI agents across" various service operations, which will complement Agentforce, the platform that enables businesses to deploy customizable autonomous digital workers.
  • Recent Achievements

    • Week One Done
      Jeroen Wilms earned a badge
      Week One Done
    • Week One Done
      rolfus earned a badge
      Week One Done
    • One Month Later
      Leroy Jethro Gibbs earned a badge
      One Month Later
    • Conversation Starter
      flexorcist earned a badge
      Conversation Starter
    • One Month Later
      AndreaB earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      503
    2. 2
      +Edouard
      201
    3. 3
      PsYcHoKiLLa
      127
    4. 4
      Steven P.
      82
    5. 5
      ATLien_0
      76
  • Tell a friend

    Love Neowin? Tell a friend!