Sir, I have created a list box in Win32 API like this
list1 = CreateWindow(L"LISTBOX", NULL, WS_CHILDWINDOW | WS_VISIBLE | LBS_STANDARD,10,150,330,200, hWnd, (HMENU)ID_LISTBOX,hInst, NULL);
It does created successfully. To avoid confusion I've used several cplusplus files. I have created a class in the separate header file and defined it in a separate cpp file. By using the header file I've called the member functions using objects in my main cpp file.
But the problem is sir one of member function should add strings to the list. I know it can be achieved by SendMessage function when everything is in the same cpp file. Since my class is in the different .cpp file I can't do this.
What I have tried:
1. Made list1 as a global variable by adding my variable before the forward declarations of functions included in my code module.
When I do like this I am getting "uninitialized variable error"
2. Did moved the variable to a new header file and made it accessible to both cpp files
I got "Multiple declarations of variable" error
3. I need of something like the variable to be used and defined somewhere else so I made use of storage classes ("extern" in this case) but when using extern I get a strange error in the object file. I am quiet sure object file can't be read by humans so I did completely stopped researching aboout this error and the usage of extern variables.
Severity Code Description Project File Line
Error LNK2005 "struct HWND__ * list1" (?list1@@3PAUHWND__@@A) already defined in Portable Devices Manager.obj Portable Devices Manager G:\Portable Devices Manager\Portable Devices Manager\ShortCutVirusKiller.obj
Kindly help me with this sir please