|
-
Apr 13th, 2001, 12:28 PM
#1
I'm writing a program that will run on Windows 95 and up without an install package.
It will run off of a floppy to collect system info and user info.
I need command buttons, labels, and text box.
I've created a form in a module with CreateWindowEx but can someone point me to the correct api's for
creating the labels, buttons, and text box?
Last edited by RobDog888; Apr 16th, 2001 at 01:07 AM.
-
Apr 13th, 2001, 12:43 PM
#2
Monday Morning Lunatic
Button -- class "BUTTON"
Text Box -- class "EDIT"
Label -- class "STATIC"
Check the Platform SDK for the exact details on the extra window styles for each of these classes.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 13th, 2001, 01:17 PM
#3
Code:
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const WS_CHILD = &H40000000
Private Const WS_VISIBLE = &H10000000
Private Const WS_EX_CLIENTEDGE = &H200&
Private hWndBtn As Long
Private hWndEdit As Long
Private hWndLabel As LongPrivate Sub Form_Load()
' Now add this code to the create them. Usually you
' would do this when the WM_CREATE message is
' triggered
hWndBtn = CreateWindowEx(0, "Button", "MyButton", WS_CHILD Or WS_VISIBLE, 32, 32, 64, 64, hwnd, 0, App.hInstance, 0)
hWndEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "MyEdit", WS_CHILD Or WS_VISIBLE, 200, 10, 100, 100, hwnd, 0, App.hInstance, 0)
hWndBtn = CreateWindowEx(WS_EX_CLIENTEDGE, "Static", "MyLabel", WS_CHILD Or WS_VISIBLE, 10, 100, 100, 40, hwnd, 0, App.hInstance, 0)
-
Apr 15th, 2001, 09:55 PM
#4
Thanks for the code, but what else will I need to capture the button click and shell out a exe, and capture the info from the textbox?
By the way, if there is no standard form, just the one created by the api call, is there still the Form_Load event in your code you posted?
-
Apr 16th, 2001, 10:46 AM
#5
Well, I assume you have your "Formless window" already made and the code as well. For this, you must also have a WindowProc function, which is specified in the lpfnWndProc variable of the WNDCLASEX structure.
To capture the click of a button, you need to handle the WM_COMMAND message. If the handle (stored in the lParam argument) is the same as the button, then it was clicked. Here is a small example:
Code:
Public Function WindProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If wMsg = WM_COMMAND Then
If lParam = hWnd_Btn Then MsgBox "Button was clicked!"
End If
WindProc = CallWindowProc(WndProcOld&, hwnd&, wMsg&, wParam&, lParam&)
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|