diff --git a/.gitignore b/.gitignore index 09b4952..91634ad 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,7 @@ *.rar *.zip *.7z -*.dll \ No newline at end of file +*.dll +/examples/simple/emptyProject/Debug/emptyProject.tlog/ +*.log +/examples/simple/emptyProject/.vs/ diff --git a/README.md b/README.md index ff43928..421efbe 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Lightweight, high performance and small executable file size Windows GUI library > Visual Studio Resource Editor +> Other dialog box editor + @@ -27,10 +29,57 @@ TDM-GCC http://tdm-gcc.tdragon.net/ +#### windres.exe + +This tool in `TDM-GCC-64/bin/windres.exe`,don't know where in MinGW. + # Usage -TODO +### Simple usage: + +Generate x.syso file from rc or res file use `windres.exe` tool. + +genereate syso: +`windres -i emptyProject/Debug/resource.res -O coff -o vsui.syso` + +or + +`windres -i ui/ui.rc -O coff -o ui.syso` + +main.go +```go +package main + +import "github.com/whtiehack/wingui" + +func main() { + dlg, _ := wingui.NewDialog(101, 0, nil) + dlg.SetIcon(105) + btnok, _ := wingui.BindNewButton(1002, dlg) + btncancel, _ := wingui.BindNewButton(1003, dlg) + btnok.OnClicked = func() { + dlg.Close() + } + btncancel.OnClicked = btnok.OnClicked + dlg.Show() + // This invoke is optional. + wingui.SetCurrentDialog(dlg.Handle()) + wingui.MessageLoop() +} + + +``` + + +run: +`go run .` + +Don't use `go run main.go`, because golang can't load x.syso files. + + + +[More examples](https://github.com/whtiehack/wingui/tree/master/examples) # Examples diff --git a/examples/simple/emptyProject/Debug/Resource.res b/examples/simple/emptyProject/Debug/Resource.res new file mode 100644 index 0000000..01353c5 Binary files /dev/null and b/examples/simple/emptyProject/Debug/Resource.res differ diff --git a/examples/simple/emptyProject/Resource.aps b/examples/simple/emptyProject/Resource.aps new file mode 100644 index 0000000..a179e0d Binary files /dev/null and b/examples/simple/emptyProject/Resource.aps differ diff --git a/examples/simple/emptyProject/Resource.rc b/examples/simple/emptyProject/Resource.rc new file mode 100644 index 0000000..bf49bbe Binary files /dev/null and b/examples/simple/emptyProject/Resource.rc differ diff --git a/examples/simple/emptyProject/emptyProject.sln b/examples/simple/emptyProject/emptyProject.sln new file mode 100644 index 0000000..a51e907 --- /dev/null +++ b/examples/simple/emptyProject/emptyProject.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2047 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emptyProject", "emptyProject.vcxproj", "{A3B40728-4CC8-4051-8D67-8B97A314B696}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Debug|x64.ActiveCfg = Debug|x64 + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Debug|x64.Build.0 = Debug|x64 + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Debug|x86.ActiveCfg = Debug|Win32 + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Debug|x86.Build.0 = Debug|Win32 + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Release|x64.ActiveCfg = Release|x64 + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Release|x64.Build.0 = Release|x64 + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Release|x86.ActiveCfg = Release|Win32 + {A3B40728-4CC8-4051-8D67-8B97A314B696}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {06694693-7882-40DE-8FEF-464F3650809B} + EndGlobalSection +EndGlobal diff --git a/examples/simple/emptyProject/emptyProject.vcxproj b/examples/simple/emptyProject/emptyProject.vcxproj new file mode 100644 index 0000000..3f3976d --- /dev/null +++ b/examples/simple/emptyProject/emptyProject.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {A3B40728-4CC8-4051-8D67-8B97A314B696} + emptyProject + 10.0.17134.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + true + + + + + Level3 + Disabled + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/simple/emptyProject/emptyProject.vcxproj.filters b/examples/simple/emptyProject/emptyProject.vcxproj.filters new file mode 100644 index 0000000..0ca47e1 --- /dev/null +++ b/examples/simple/emptyProject/emptyProject.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 头文件 + + + + + 资源文件 + + + + + + + + 资源文件 + + + \ No newline at end of file diff --git a/examples/simple/emptyProject/emptyProject.vcxproj.user b/examples/simple/emptyProject/emptyProject.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/examples/simple/emptyProject/emptyProject.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/examples/simple/emptyProject/icon1.ico b/examples/simple/emptyProject/icon1.ico new file mode 100644 index 0000000..5d06b9f Binary files /dev/null and b/examples/simple/emptyProject/icon1.ico differ diff --git a/examples/simple/emptyProject/manifest.xml b/examples/simple/emptyProject/manifest.xml new file mode 100644 index 0000000..37e7b71 --- /dev/null +++ b/examples/simple/emptyProject/manifest.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/simple/emptyProject/resource.h b/examples/simple/emptyProject/resource.h new file mode 100644 index 0000000..5ec2c13 --- /dev/null +++ b/examples/simple/emptyProject/resource.h @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ ɵİļ +// Resource.rc ʹ +// +#define IDD_DIALOG1 101 +#define IDI_ICON1 105 +#define ID_OK 1002 +#define ID_CANCEL 1003 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 106 +#define _APS_NEXT_COMMAND_VALUE 40002 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/examples/simple/generate_res.bat b/examples/simple/generate_res.bat new file mode 100644 index 0000000..2613084 --- /dev/null +++ b/examples/simple/generate_res.bat @@ -0,0 +1,2 @@ +windres -i emptyProject/Debug/resource.res -O coff -o vsui.syso + diff --git a/examples/simple/main.go b/examples/simple/main.go new file mode 100644 index 0000000..788d34b --- /dev/null +++ b/examples/simple/main.go @@ -0,0 +1,18 @@ +package main + +import "github.com/whtiehack/wingui" + +func main() { + dlg, _ := wingui.NewDialog(101, 0, nil) + dlg.SetIcon(105) + btnok, _ := wingui.BindNewButton(1002, dlg) + btncancel, _ := wingui.BindNewButton(1003, dlg) + btnok.OnClicked = func() { + dlg.Close() + } + btncancel.OnClicked = btnok.OnClicked + dlg.Show() + // This invoke is optional. + wingui.SetCurrentDialog(dlg.Handle()) + wingui.MessageLoop() +} diff --git a/examples/simple/vsui.syso b/examples/simple/vsui.syso new file mode 100644 index 0000000..cca67fd Binary files /dev/null and b/examples/simple/vsui.syso differ