Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i create a commandbutton on a program like notepad...

Status
Not open for further replies.

ncskate

Programmer
Jul 24, 2001
1
US
i want to know how i can create a command button, text box, or any other control on a (compiled vb or not) program like notepad.exe? ive seen it where u can add menus to programs like that from visualbasic but i want to know how to add control please if u can help im me. .... any code starts would be great.thanx
 
I think You're asking about toolbar. Search Help for
"Greating ToolBar"
 
If you got VB6:
Create a new project. Select VB application wizard, select SDI (Single Doucment Interface) and click 'ok' to everything else.
That will create a 'notepad' like project with menus and toolbars.

Sunaj
 
I think i know exactly what you're talking about.

I was able to accomplish this by modifying code from PlanetSourceCode.com in the VB Section called "Real C++ Controls" or "Real C Controls".

THis code will show you how to create a "Real C++" button on a form by passing a function the form's handle.

You can easily modify this by getting the handle to a form or control in another program.. You can do this using Spy++ or by Enumerating windows using EnumWindows() and searching for all child windows until you find a compatible form or control to create it on.

As an example, I successfully added a command button to the formatting toolbar on an AIM chat window, subclassed the buttons WndProc and had it so that one of the forms in my program was toggled visible/invisible by clicking this button.

However, I've had trouble doing this in Win2k as I BELIEVE you cannot grab the window procedure of a control that isn't in your current process thread, or something like that.

---If you need any further help, feel free to e-mail me @ mgerety@snet.net

If you do not understand the Windows API at all, I'd suggest reading up on it and doing some trial-and-error coding with it first, before trying to take on something like this.

--NipsMG
 
hi there,

NipsMg suggested a nice solution. u can subclass the procedures easily but with the help of some new Win32 APIs that r only part of Win2k. so if u want 2 do so, ur working environment should be Win2k and u have to use VB6 for that.

u can contact me for the brief description of Win32 API if u like, at computerjin@yahoo.com

have a nice time,
CJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top