C++ Controls in your app (updated) - now with tutorial
Posted: 2002-06-01
By: ArchiveBot
Viewed: 66
Filed Under:
Title | Uploaded | Size |
---|---|---|
CODE_UPLOAD99959192000.zip | 9/3/2020 3:45:00 PM | 7,799 |
REAL C++ CONTROLS IN YOUR APP!!!
Do you know the code "Real C++ Buttons" by Randy Mcdowell?
It sends a message to a VB Button to make it a "C++ Button". But if you look at this button with
Spy++ you will see that it is still a "ThunderCommandButton", the VB Button.
My code lets you use EVERY C++ control in your app!!! And these controls are REAL C++ controls!!!
Think of the fantastic controls you can have: e.g. the cool hotkey control. Or what about a "real"
RICHEDIT control? The only limitation is your fantasy! Control events are also supported.
Well commented, and easy to use even if you don't understand everything that happens.
The second version of this code, now with tutorial and some new stuff.
Have fun with this code, use it in your app, and if you like it VOTE FOR IT!!!
Original Author: Druid Developing
Code
(best viewed in 1024 x 768) C++ Hi, this is the update to my Now somebody posted that this If there would still be any Important note: This tutorial 1. How to use First you have to include Then goto the menu "Project" In this window set the In the Sub Main which is Call the function like Hwnd of the Thatīs it! No difficult API Calls, not Very easy to use, even 2. How to If you want to use the For every Property You get it from the If you want to get e.g. 'Declare Public TextBoxHwnd as Long 'Create the TextBoxHwnd = Using this Function you Function Dim ControlText = Space(254) 'Use the GetWindowText API to get the actual GetWindowText Get_Text_Of_Control End Function Use this function like TextBoxText = MsgBox To use an Event, e.g. the click Event of 'Declare Public ButtonHwnd as Long 'To save the old WindowProcedure for the button Public gButOldProc as Long 'Create the ButtonHwnd = 'Get the address of the standard button procedure and save it in gButOldProc& = GetWindowLong(ButtonHwnd&, 'Use GWL_WNDPROC to save the adress of the procedure for the 'You have to do this for every control you want to have a procedure Call SetWindowLong(ButtonHwnd&, GWL_WNDPROC, GetAddress(AddressOf ButtonWndProc)) 'This is the procedure that is called when you click the button Public Function ButtonWndProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Select Case uMsg& Case WM_LBUTTONUP: 'Left button is up (user clicked the Button) 'Use MsgBox 'Call the standard window proc ButtonWndProc = CallWindowProc(gButOldProc&, hwnd&, uMsg&, wParam&, lParam&) End Function 3. Final The special thing on this You can also create an Thatīs all for today, Maybe I update this code PS: Please excuse me And PLEASE,
Controls in your app - Now with tutorial
code "Real C++ Controls in your app" which I submitted at the
beginning of September.
code isnīt explained well and so I wrote this tutorial.
problems just E-Mail me at
is also included in the .zip file. You donīt have to read it here.
this code in your app
the modMain.bas in your project.
and click "Properties of ...".
Start Object to "Sub Main".
in the modMain you can now create the controls.
this:
control = CreateControl( "Edit" (Classname) , "This is a TextBox"
(Text) , 3 (Left) , 3 (Top) , 100 (Width) , 50 (Height) , (Optional Style) )
much code, just ONE FUNCTION!
for beginners.
interact with the controls
controls like normal controls, with Events and Properties it is a bit more
difficult.
and Event you firs need the WindowHandle of the control.
CreateControl function (look above).
the Text of a created TextBox control you can do it like this:
Variable to save the WindowHandle
TextBox
CreateControl( "Edit" , "Text to get" , 3 , 3 , 100 ,
40 )
can get the actual Text of the TextBox
Get_Text_Of_Control(ByVal cHwnd as Long) as String
ControlText As String
text of the TextBox control
cHwnd ,
ControlText , 254
= Trim(ControlText)
this:
Get_Text_Of_Control(TextBoxHwnd)
TextBoxText
a Button you can do it like this:
Variable to save the WindowHandle
Button
CreateControl( "Button" , "Click this button" , 3 , 3
, 100 , 40 )
"gButOldProc"
GWL_WNDPROC)
button
"WM_LBUTTONDOWN"
"The button was clicked"
Explanations
code is that you can use every registered Windows class name for a control.
own class name using the API "RegisterWindowClass".
bye.
once more.
for my bad English, Iīm German.
PLEASE, PLEASE VOTE FOR ME!!!
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.