Jump to content

Autoit GUI functions made in C++


Guest
 Share

Recommended Posts

Hello, I starded to implement Autoit native GUI fanctions in C++

The following functions are implemented:

GUICreate, GUISetState, GUICtrlCreateButton, GUISetBkColor, GUICtrlCreateLabel

You are welcome to improve the codes, report about problems and give suggestions
https://github.com/GilEli1/CU3-Library/blob/master/gui.h

 

known problems:

Quote

 

GUICtrlCreateLabel - does not create the label with the background color of the GUI.
If the background color of the GUI is not normal then the label background color is not the same.

GUICreate:
1) The outcome is not exactly the same. try to create the GUI with iWidth = 0 and iHeight = 0.
in c++ you will not see the GUI because the size is 0. but in Autoit you will see part of title bar.
So the outcome size is not the same. Because it is not a critical bug I did not focus on it but if you want you can. I am not going to fix this.

 


 

 

Edited by Guest
Link to comment
Share on other sites

  • 2 weeks later...

Added:
GUICtrlCreateListView_C  (optimized for c)
GUICtrlCreateListViewItem_C (optimized for c)
GUICtrlCreateListView  (Reimplemented, wrapper for the *_C )
GUICtrlCreateListViewItem (Reimplemented, wrapper for the *_C )

Added:  CU3_CTRL data type. GUICtrl... functions returns CU3_CTRL
CU3_CTRL contains the following members:
       .hwnd The ctrl child window
       .intID1 main ID for the ctrl
       .intID2 second ID for the ctrl (mostly not needed)

Changed/Added:
GUISetDefaultWindowClass
-> GUISetDefaultWindowClass_C(WNDPROC parm_WndProc, char parm_charRootName[] = "CU3L_GUI", HINSTANCE parm_hInstance = NULL)
GUISelectWindowClass_C(WNDCLASSEX* ptr_wndclassexNew,bool bRegisterClass = false)
GUIWait -> GUIWait_C

Macros:
CU3_GUIGetMsg_C
CU3_GUIProcessMsg_C

 

Example of GUICtrlCreateListView  and GUICtrlCreateListViewItem:

In c++
ex1.thumb.png.ed63c17efcb31a412315592c21

 

In Autoit (code almost copied entirely)
ex2.thumb.png.fbc2e5b6766d898ea8cfab4b4c

 

Enjoy!

Edited by Guest
Link to comment
Share on other sites

Added:
GUIScrollbars_ProcessMessages_initialize_C

GUIScrollbars_SetRange_C(HWND hwndGUI,DWORD dwordFlagsSet,int intVSMax = NULL,int intHSMax = NULL, int intVSMin = 0, int intHSMin = 0)
GUIScrollbars_ProcessMessages_C(HWND hwnd, UINT msg, WPARAM wParam)

It was more complicated to implement than I thought

5712c5fa9c38d_scrollbars.thumb.png.e59c7

Example: https://github.com/GilEli1/CU3-Library/blob/master/Examples/main/Example%203.h

Edited by Guest
Link to comment
Share on other sites

Thank you for the comment.
It is still work in progress. Things are going to change.
Changes that are going to cause to big "script breaking changes".
This is because this project has just been born. over time, such changes will be less frequent.


Note that I am focus only on GUI functions (that works on pure Win32 (direct use of WinAPI) not MFC).
for the other stuff look at this project:

 

Also, coming soon: VectorEx  - Extension to the <vector> - vector 2D array, debug functions (Array Display for vector 1D and 2D) .
 

Edited by Guest
Link to comment
Share on other sites

If by design needs, the program need to be written in c++, then for me  It seems more correct that the program will be 100% written in c++.
You can write the GUI in autoit and all the other stuff in c. but I don't like this design. you will end with 2+ exes.
also, in c++ you are less limited.. you can for example run some gui code with it's loop in another thread. you can't do this in autoit (But I don't sure that I recommend it although it is possible).

Assuming that that most of the program is written in c++, it is more native that the gui functions are included directly(not AutoItX ). I didn't found any gui functions in AutoItX

also, if you're used to code in autoit, you may want to do it in the most possible "autoit" way ( make it easier )

Edited by Guest
Link to comment
Share on other sites

Added:
GUICreate_C(char sTitle[] = NULL,int iWidth = CU3_DEFAULT_GUI_WIDTH,int iHeight = CU3_DEFAULT_GUI_HEIGHT,int iLeft = -1, int iTop = -1,WNDPROC GuiProc = NULL,DWORD dwGUICreateFlags = NULL,WNDCLASSEX* ptr_wcGU,WinClass = NULL,DWORD dwStyle = CU3_DEFAULT_GUI_STYLE,DWORD dwExStyle = NULL,HWND hwndParent = NULL) (optimized for c)

Changed/Added:
GUICreate is now bassed on GUICreate_C  (wrapper for the *_C). (Autoit function syntex)


Added features:
GUICreate_C:
GuiProc) Allows you to create the GUI with another WndProc function.   you can create GUI with it's own " WndProc" function easily.
example: https://github.com/GilEli1/CU3-Library/blob/master/Examples/main/Example%205.h
ptr_wcGUIWinClass) You can also pass your own window class to the function. allows you to create GUIs with some preset settings directly.
dwGUICreateFlags) Control how the GUI will be created... read more in gui.h.

Fixed:
GUICreate & GUISetBkColor

GUISetBkColor will now set the color only to the selected GUI and not other GUIs under one of the following conditions:
1) You created the GUI with GUICreate
OR
2) You created the GUI with GUICreate_C with flag CU3_GUI_OWN_WINDOW_CLASS

 

Added & Changed:
GUICtrlCreateListView_C
& GUICtrlCreateButton_C:
 iUniqueID) Set constant ID for the ctrl
example: https://github.com/GilEli1/CU3-Library/blob/master/Examples/main/Example%206.h

 

Added features:

GUICtrlMove_C(CU3_CTRL* cu3Ctrl,int iXpos,int iYpos)
GUICtrlResize_C(CU3_CTRL* cu3Ctrl, int iXsize, int iYsize)

GUICtrlSetPos(CU3_CTRL* cu3Ctrl, int iLeft, int iTop, int iWidth = -1, int iHeight = -1)

 

GUICtrlCreateListViewItem_C(.... dwFlags = NULL)
Flag CU3_GUI_LISTVIEW_AUTO_COL_SIZE - If this flag included then it will resize the column width to match the text size in the column.

 

Edited by Guest
Link to comment
Share on other sites

  • 2 months later...

Thanks gil900 for sharing your functions with us. I did the same thing a few years ago, but I never really finished. But now you inspired me to move on with that project.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...