inamozov / DisplayTest

Windows 10 Change Brightness
18 stars 9 forks source link

Build/running difficulties #1

Open mattreecebentley opened 4 years ago

mattreecebentley commented 4 years ago

Running this with the latest x86 visual studio redistributables: https://support.microsoft.com/en-nz/help/2977003/the-latest-supported-visual-c-downloads

Results in the following error code: CreateFiles failed with error 2

Wont work with just the x64 redistributables installed, I take it this is a x86 build?

Trying to build this with Visual Studio 2019, gives a bunch of errors centered around 'not able to convert from LPCSTR to LPWCSTR' in the function calls.

inamozov commented 4 years ago

Yeah its x86 to run both on Win10x64 and Win10x86. I assume you build it using Debug compiler mode. Try to compile it using Release and x86. It also should compile as x64.

mattreecebentley commented 4 years ago

Unfortunately no - Full error list: Severity Code Description Project File Line Suppression State Warning C4018 '<': signed/unsigned mismatch Project1 D:\programming\Workspaces\displaytest\Project1\DisplayTest.cpp 85 Error C2664 'LSTATUS RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY)': cannot convert argument 2 from 'LPCSTR' to 'LPCWSTR' Project1 D:\programming\Workspaces\displaytest\Project1\DisplayTest.cpp 42 Error C2664 'LSTATUS RegSetValueExW(HKEY,LPCWSTR,DWORD,DWORD,const BYTE *,DWORD)': cannot convert argument 2 from 'const char [5]' to 'LPCWSTR' Project1 D:\programming\Workspaces\displaytest\Project1\DisplayTest.cpp 52 Error C2664 'LSTATUS RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY)': cannot convert argument 2 from 'LPCSTR' to 'LPCWSTR' Project1 D:\programming\Workspaces\displaytest\Project1\DisplayTest.cpp 124 Error C2664 'LSTATUS RegGetValueW(HKEY,LPCWSTR,LPCWSTR,DWORD,LPDWORD,PVOID,LPDWORD)': cannot convert argument 3 from 'LPCSTR' to 'LPCWSTR' Project1 D:\programming\Workspaces\displaytest\Project1\DisplayTest.cpp 129 Error C2664 'HANDLE CreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE)': cannot convert argument 1 from 'const char [8]' to 'LPCWSTR' Project1 D:\programming\Workspaces\displaytest\Project1\DisplayTest.cpp 146

This is the same in release mode for both x86 and x64. Do you know what the error from the pre-built one you made relates to?

inamozov commented 4 years ago

Do you use Unicode in your project? Try setting multi byte character set

mattreecebentley commented 4 years ago

That makes it build in both x86 and x64 modes, but still get the same error when running.

inamozov commented 4 years ago

Idk what you are talking about. Provide more info please or google it.

mattreecebentley commented 4 years ago

As I said in the first post: Running this with the latest x86 visual studio redistributables: https://support.microsoft.com/en-nz/help/2977003/the-latest-supported-visual-c-downloads

Results in the following error code: CreateFiles failed with error 2

No different for the rebuilds I've done. Code doesn't work.