I just want to run some sample code in Visual Studio & my dependencies may be incorrect

  • Thread starter Thread starter TragicReindeer
  • Start date Start date
T

TragicReindeer

Guest
I'm not good with C++, but I am trying to learn Windows-based programming. I would like to run some sample code in Visual Studio 2019. The sample code is the first block on this page: Ok great, I can't use links yet. Delete the spaces in this: https: //docs.mi crosoft.com/en-us/windows/deskt op/inputdev/using-mouse-input

Ok, so here's what I have tried:

1) Create a new blank app with C++

2) I get this screen: (NM, can't post images, it's just the default screen when creating a blank app)

3) I am familiar with the Main method in C#, but I do not see it here, so I pasted the code below the App::App() { ... } block.

4) Several errors notify me that my variables are undefined

5) I tried:

a) #include winuser.h, etc (names of relevant headers)

b) Clicking the External Dependencies folder & right-clicking to choose Include in Project

6) Unfortunately, this just balloons into more errors (100+ & counting)

I will keep trying to figure this out, but in the meantime, I'd sure appreciate any help.

Here are some of the errors:

Severity Code Description Project File Line Suppression State
Error C3861 'GetDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 65
Error C3861 'GetTextMetrics': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 66
Error C3861 'ReleaseDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 67
Error C2065 'BUFSIZE': undeclared identifier App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 77
Error C2660 'GlobalAlloc': function does not take 1 arguments App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 76
Error C3861 'MessageBeep': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 87
Error C3861 'SendMessage': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 95
Error C2059 syntax error: '/' App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 108
Error C3861 'HideCaret': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 111
Error C3861 'GetDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 116
Error C3861 'GetCharWidth32': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 117
Error C3861 'TextOut': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 119
Error C3861 'ReleaseDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 121
Error C2065 'dwMaxCharX': undeclared identifier App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 133
Error C3861 'ShowCaret': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 140
Error C3861 'SetCaretPos': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 144
Error C3861 'GetDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 157
Error C3861 'SetTextColor': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 158
Error C3861 'SetBkColor': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 159
Error C3861 'StringCchLength': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 160
Error C3861 'TextOut': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 165
Error C3861 'ReleaseDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 167
Error C3861 'ShowCaret': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 168
Error C3861 'GetDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 211
Warning C4244 '=': conversion from 'WCHAR' to 'char', possible loss of data App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 216
Error C3861 'GetCharWidth32': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 217
Error C3861 'ReleaseDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 221
Error C3861 'SetCaretPos': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 225
Warning C4244 '=': conversion from 'WCHAR' to 'char', possible loss of data App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 235
Error C3861 'HideCaret': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 242
Error C3861 'GetDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 243
Error C3861 'SetTextColor': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 244
Error C3861 'SetBkColor': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 245
Error C3861 'StringCchLength': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 246
Error C3861 'TextOut': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 251
Error C3861 'SetTextColor': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 252
Error C3861 'SetBkColor': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 253
Error C3861 'ReleaseDC': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 254
Error C3861 'DefWindowProc': identifier not found App4 C:\Users\Scott\source\repos\App4\App4\App.xaml.cpp 262

Continue reading...
 
Back
Top