|
-
Dec 6th, 2001, 05:25 PM
#1
Thread Starter
Addicted Member
DialogBox
Anyone know the VB declaration of DialogBox?
here it is in C++
INT_PTR DialogBox(
HINSTANCE hInstance, // handle to module
LPCTSTR lpTemplate, // dialog box template
HWND hWndParent, // handle to owner window
DLGPROC lpDialogFunc // dialog box procedure
);
Always looking for a better and faster way!
-
Dec 7th, 2001, 04:17 AM
#2
Depends on which one:
- Declare Function ChooseColor Lib "comdlg32.dll" alias "ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long
- Declare Function ChooseFont Lib "comdlg32.dll" Alias "ChooseFontA" (pChoosefont As CHOOSEFONT) As Long
- Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
- Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
- Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
- Declare Function PrintDialog Lib "comdlg32.dll" Alias "PrintDlgA" (pPrintdlg As PRINTDLG_TYPE) As Long
Last edited by alex_read; Dec 7th, 2001 at 04:21 AM.
-
Dec 7th, 2001, 09:03 AM
#3
In addition to the ones Alex mentioned, there is
VB Code:
Private Declare Function CreateMenu Lib "user32" Alias "CreateMenu" () As Long
Private Declare Function CreatePopupMenu Lib "user32" Alias "CreatePopupMenu" () As Long
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Private Declare Function PrinterProperties Lib "winspool.drv" Alias "PrinterProperties" (ByVal hwnd As Long, ByVal hPrinter As Long) As Long
Private Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
to name just a few. As Alex said, "Depends on which one"
-
Dec 7th, 2001, 10:26 AM
#4
Thread Starter
Addicted Member
Thats not quite what i was looking for I am trying to create a Modal window on top of another window and reactivate the old window when the modal window is detroyed. Here is how i do that:
mlngMain is the main window
VB Code:
Option Explicit
Private mlngSetup As Long
Public Sub ShowSetup()
Dim typClass As WNDCLASSEX
Dim typMessage As MSG
With typClass
.cbSize = Len(typClass)
.lpfnWndProc = GetWndProc(AddressOf SetupProc)
.hInstance = glngApp
.hIcon = LoadIcon(0&, IDI_APPLICATION)
.hCursor = LoadCursor(0, IDC_ARROW)
.hbrBackground = COLOR_BTNFACE + 1
.lpszMenuName = ""
.lpszClassName = "Setup"
.hIconSm = LoadImage(glngApp, "", IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), _
GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR)
End With
RegisterClassEx typClass
mlngSetup = CreateWindowEx(0, "Setup", "Setup", WS_VISIBLE Or WS_OVERLAPPEDWINDOW Or DS_MODALFRAME Or WS_CLIPCHILDREN _
Or WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, glngMain, _
0&, glngApp, 0&)
Do While GetMessage(typMessage, 0, 0, 0) <> 0
TranslateMessage typMessage
DispatchMessage typMessage
Loop
End Sub
Private Function SetupProc(ByVal hwnd As Long, ByVal message As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Select Case message
Case WM_CREATE
EnableWindow glngMain, False
Case WM_CLOSE
EnableWindow glngMain, True
Case WM_DESTROY
DestroyWindow mlngSetup
PostQuitMessage 0
End Select
SetupProc = DefWindowProc(hwnd, message, wParam, lParam)
End Function
I know there is a function that does all of this called DialogBox. I just am not sure of the declaration.
Thanks
Always looking for a better and faster way!
-
Dec 7th, 2001, 10:43 AM
#5
Some of the paramters to DialogBox are not exactly easy to come by in VB.
Do you know about:
Private Declare Function DialogBoxIndirectParam Lib "user32" Alias "DialogBoxIndirectParamA" (ByVal hInstance As Long, _
hDialogTemplate As DLGTEMPLATE, ByVal hWndParent As Long, _
ByVal lpDialogFunc As Long, ByVal dwInitParam As Long) As Long
Private Declare Sub DialogBoxParam Lib "user32.dll" Alias "DialogBoxParamA" (ByVal hInstance As Long, ByVal _
lpTemplateName As String, ByVal hWndParent As Long, ByVal _
lpDialogFunc As Long, ByVal dwInitParam As Long)
-
Dec 7th, 2001, 10:48 AM
#6
Thread Starter
Addicted Member
Oh ya, now we are getting somewhere. Do you have any examples of how to use those functions?
Always looking for a better and faster way!
-
Dec 7th, 2001, 10:49 AM
#7
PS: VB scripting (includes FSO) provides the InputBox function - a modal dialog box.
-
Dec 7th, 2001, 10:51 AM
#8
Jim: I found DialogBoxIndirectParam in the VB Api Viewer (neither of the ones you mentioned are in the API Viewer from http://www.allapi.net), but DialogBoxParam isn't there. Where did you dig these bad boys up? They sound interesting.
-
Dec 7th, 2001, 11:00 AM
#9
Thread Starter
Addicted Member
Always looking for a better and faster way!
-
Dec 7th, 2001, 11:02 AM
#10
I have a CD with 5400+ api's on it. I code in C with them all the time. About 900 are translated into VB.
I went to www.allapi.net - got their viewer. Guess what? The newest version has those functions. The ultimate viewer is MSDN.
www.planetsourcecode.com has code that translates C++ declarations into VB. Might be useful.
All I MAY have somewhere is C++ versions of those calls.
Here is a translation of DialogBox, I don't know the library off the top of my head, probably COMCTL32.dll.
INT_PTR DialogBox(
pointer to an integer (long) -- why VB cannot deal with this, VB expects functions to return ByVal in a register --EAX.
HINSTANCE hInstance, // handle to module
ByVal hInstance as long
LPCTSTR lpTemplate, // dialog box template
ByRef LPCSTR as String
HWND hWndParent, // handle to owner window
ByVal HWND as Long
DLGPROC lpDialogFunc // dialog box procedure
ByVal lpDialogFunc as Function Pointer (addressof) - really as Long
);
-
Dec 7th, 2001, 11:07 AM
#11
Thanks miben, I will definately check those links.
Jim: Where did you get a CD with 900 VB declarations on it. I do nothing with C, but I'd like to check out those 900 VB declares. Got a website I can order that from?
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
|