Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / A simple DLL for some Win-Dialogs.

Author
Message
daniel_ch
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 22nd Mar 2007 17:56 Edited at: 15th Apr 2007 00:57
####################
Update: April 14/07
- you can set now default value for input box
####################
Update: April 05/07
- simple standard window menu (File, Session and Help)
####################
Update: March 23/07
- choose color dialog
####################

Hello @All,

I programmed a dll with some functions to create a simple standard window menu and to use a some common dialogs (for example MessageBox, InputBox ...).

PS: For simpler games it will be sufficient.

================================================================
Instructions

This DLL creates a simple standard window menu and allows to use some common dialogs. To use this DLL:
- Put the DLL DBProWinDlg.dll into .../3d games creator/Compiler/plugins-user, than you can call the DLL directly from you code using dll function name.
- At the moment the DLL provide following 9 functions:
1) GetActiveWindow() //This function get the DBPro window handle. The handle is needed for most window functions.
2) GetOpenDirectoryName(DBPro window handle) // This function displays a dialog box enabling the user to select a folder.
3) InputBox( Window handle, Message, Default value, Title) // The InputBox function displays a dialog box, where the user can write some input and/or click on a button.
4) GetSaveFileName(Window handle, Title, Filter description, Filte extension) //This function creates a dialog box that lets the user specify the drive, directory, and name of a file to save.
5) GetOpenFileName(Window handle, Title, Filter description, Filte extension) //This function creates a dialog box that lets the user specify the drive, directory, and name of a file to open.
6) MsgBox(Message, Title , Icon, Buttons) //This function shows a simple message box and returns a button value.
Note: For Icondescription you can use all win-api icons (MB_ICONHAND, MB_ICONQUESTION, MB_ICONEXCLAMATION and MB_ICONINFO). For buttons you can use MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNO or MB_RETRYCANCEL. Return value are IDOK, IDCANCEL, IDYES, IDNO, IDABORT, IDRETRY or IDIGNORE.
7) CreateDBProMenu(Window handle) //This function creates a simple standard window menu with following items: File => (Open, Save, Exit), Session => (New) and Help => (Index, About).
8) GetMessage() //This function gives a selected menu item ID. Following items ID are existing: IDM_OPEN, IDM_SAVE, IDM_EXIT, IDM_NEW, IDM_INDEX and IDM_ABOUT.
9) DestroyDBProMenu // The function destroys the specified menu and frees any memory that the menu occupies.



DBPro Sample for simple standard window menu





DBPro Sample for common dialogs




Documentation

Function: GetActiveWindow
Parameters: no
Parameter descriptions: no
Return value: Window handle As DWORD



Function: GetOpenDirectoryName
Parameters: current window handle As DWORD
Parameter description:
Return value: Selected Path As STRING



Function: InputBox
Parameters: Window handle As DWORD, Message As String, Default Value As String, Title As String
Parameter description: no
Return value: User input As STRING



Function: GetSaveFileName
Parameters: Window handle As DWORD, Title As String , Filter description As String , Filter extension As String
Parameter description: no
Return value: File path As STRING



Function: GetOpenFileName
Parameters: Window handle As DWORD, Title As String , Filter description As String , Filter extension As String
Parameter description: no
Return value: File path As STRING



Function: MsgBox
Parameters: Message As String, Title As String, Icon As String, Buttons As String
Parameter description: For Icons use: MB_ICONHAND, MB_ICONQUESTION, MB_ICONEXCLAMATION or MB_ICONINFO. For
Buttons use MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNO or MB_RETRYCANCEL
Return value: IDOK, IDCANCEL, IDYES, IDNO, IDABORT, IDRETRY or IDIGNORE As String



Function: CreateDBProMenu
Parameters: : Window handle As DWORD
Parameter description: no
Return value: Window standard menu



Function: GetMessage
Parameters: : no
Parameter description: no
Return value: Window message ID: : IDM_OPEN, IDM_SAVE, IDM_EXIT, IDM_NEW, IDM_INDEX and IDM_ABOUT.



Function: DestroyDBProMenu
Parameters: : no
Parameter description: no
Return value: Destroy window standard menu



Last update April 05


Daniel_ch

Attachments

Login to view attachments
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 22nd Mar 2007 18:03
If it does what you say it does, excellent work, this'll be an extremely useful tool for those that dont have the money to buy Blue GUI / skill to access windows dlls themselves.

Really good job for just starting out on the forums here.

daniel_ch
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 22nd Mar 2007 18:08
Thanks RUCCUS

But you cannot compare this with Blue GUI. Blue GUI support many more as my DLL.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 23rd Mar 2007 04:33
Nice work, I agree.
Your point is well taken, as BlueGUI differs in many respects from what you are doing so far in this code. However, I still agree with RUCCUS' assessment. Many people only need access to the common dialogs and BlueGUI is overkill for that, imo. (Still, as you pointed out, it is an outstanding product.)
Happy coding!
daniel_ch
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 23rd Mar 2007 12:25 Edited at: 23rd Mar 2007 12:25
Thanks jinzai

I also implement the choose color dialog into my DLL.
daniel_ch
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location:
Posted: 5th Apr 2007 19:17
Hello @All,

I programmed some new function into my DLL. For example you can create a simple standard window menu with following items:
- File: Open, Save and Exit
- Session: New
- Help: Index and About.

I think, it is a good help for small projects.

daniel
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 5th Apr 2007 20:15
Yes, it is a good project. I only have the one observation, which is those can be used without a plug-in. Write a function to create a window class, and a window. That is what alot of people want.

Does your menu function allow loading a menu resource? THAT WOULD BE USEFUL.

Another thing that you might want to pursue is using the .rc2 file. It is a way that UNICODE strings could be brought in, and also...try to add general UNICODE support. That is sorely needed by Easetern European and Asian coders.
Xenocythe
18
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 21st Jul 2007 22:23
Daniel, this is very good and useful! Great job!

My only concern is that I want the Open File Dialog and Save File Dialog to be able to open and save multiple file types.

Do you think you can do this?

Xolatron
18
Years of Service
User Offline
Joined: 12th Mar 2006
Location: The Star Forge Language: DBpro
Posted: 21st Jul 2007 23:27 Edited at: 21st Jul 2007 23:41
Nice . BlueGUI has no inputbox function, and I'm glad I won't have to figure out how to call it from the Windows API. I've been planning to add an inputbox in my latest project, and this could save a lot of work.

Is there any chance you could add the "Make New Folder" button on the 'GetOpenDirectoryName(DBPro window handle)' box?

Thanks!

Edit: Er... why is the cancel button (on 'inputBox()') not in English for me (it says "Abbrechen")?

-Xol

CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Jul 2007 00:49
Quote: "Many people only need access to the common dialogs and BlueGUI is overkill for that, imo."

have any of you checked out DBP_NETLIB? It's been around since 2004. Click the link in sig

My DBP plugins page is now hosted [href]here[/href]
Xolatron
18
Years of Service
User Offline
Joined: 12th Mar 2006
Location: The Star Forge Language: DBpro
Posted: 22nd Jul 2007 04:10
I found a great inputBox in your dbp_vb6lib.dll, CattleRustler .
Thanks.

-Xol

CattleRustler
Retired Moderator
20
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Jul 2007 05:03 Edited at: 22nd Jul 2007 05:04
no prob, thanks. the netlib plugin is way better tho, tons of functions for files, strings, dialogs, variable watching, all sorts of

My DBP plugins page is now hosted [href]here[/href]
vibe runner
17
Years of Service
User Offline
Joined: 7th Aug 2006
Location: The Future
Posted: 22nd Jul 2007 13:38
The GOGAS plug-in has all sorts of common GUI functions too, including message boxes, input boxes, colour boxes, etc.
Xolatron
18
Years of Service
User Offline
Joined: 12th Mar 2006
Location: The Star Forge Language: DBpro
Posted: 22nd Jul 2007 22:47
I've got netlib too, I just have trouble figuring out what commands are in what dlls . I've downloaded a few too many, I think. Gogas looks nice too.

-Xol

Login to post a reply

Server time is: 2024-05-03 23:26:37
Your offset time is: 2024-05-03 23:26:37