how to solve the problem occured due to using setupapi.h and Dbt.h header files in my windows service application.. in windows XP and VC++.Net 2005
-
hello, I created a win32 project(precompiled headers, console application). This was created to create a service( for which i used SERVICE_TABLE_ENTRY, SERVICE_STATUS, SERVICE_STATUS_HANDLE, etc... required structures and methods). Environment used: Windows XP, VC++.Net2005. Should work on: I want to make this exe to run on windows 95,98, XP, 2000 and Vista. my stdafx.h file contains: #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include #include // TODO: reference additional headers your program requires here #pragma warning (disable:4430)//... i added this, since i was getting this error. and in msdn this //was given as its solution. To this project, i have added two more files: 1) USBActivity.h 2) USBActivity.cpp In USBActivity.cpp the hierarchy of headers included is as follows: #include "stdafx.h" #include #include "stdio.h" #include #include #include "afxcmn.h" #include "cfgmgr32.h" #include "Blowfish_Data_FileEncrpt.h" #include "USBActivity.h" The project properties are set as: Use windows Standard libraries, WIN32;_DEBUG;_CONSOLE as preprocessor definitions, Basic Run-TimeChks: Both (/RTC1, equiv. to /RTCsu) , RunTime-Library --> Multi-threaded Debug (/MTd), Use Precompiled Header (/Yu), Linker+AdditionalDependencies-->setupapi.lib. I am getting following build errors: Compiling... stdafx.cpp Compiling... Blowfish_Data_FileEncrpt.cpp DataSentinelService.cpp d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT' d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : fatal error C1903: unable to recover from previous error(s); stopping compilation DoubleBuffering.cpp SHA.cpp USBActivity.cpp d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT' d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier d:\micr
-
hello, I created a win32 project(precompiled headers, console application). This was created to create a service( for which i used SERVICE_TABLE_ENTRY, SERVICE_STATUS, SERVICE_STATUS_HANDLE, etc... required structures and methods). Environment used: Windows XP, VC++.Net2005. Should work on: I want to make this exe to run on windows 95,98, XP, 2000 and Vista. my stdafx.h file contains: #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include #include // TODO: reference additional headers your program requires here #pragma warning (disable:4430)//... i added this, since i was getting this error. and in msdn this //was given as its solution. To this project, i have added two more files: 1) USBActivity.h 2) USBActivity.cpp In USBActivity.cpp the hierarchy of headers included is as follows: #include "stdafx.h" #include #include "stdio.h" #include #include #include "afxcmn.h" #include "cfgmgr32.h" #include "Blowfish_Data_FileEncrpt.h" #include "USBActivity.h" The project properties are set as: Use windows Standard libraries, WIN32;_DEBUG;_CONSOLE as preprocessor definitions, Basic Run-TimeChks: Both (/RTC1, equiv. to /RTCsu) , RunTime-Library --> Multi-threaded Debug (/MTd), Use Precompiled Header (/Yu), Linker+AdditionalDependencies-->setupapi.lib. I am getting following build errors: Compiling... stdafx.cpp Compiling... Blowfish_Data_FileEncrpt.cpp DataSentinelService.cpp d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT' d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : fatal error C1903: unable to recover from previous error(s); stopping compilation DoubleBuffering.cpp SHA.cpp USBActivity.cpp d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT' d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier d:\micr
are you sure setupapi is supported in windows95? don't forget that if you want the same exe to run on all versions of windows you mentioned, WINVER must be set to the oldest version of sdk (in your case, win95). and there may be the origin of your problem. list of correct values for WINVER must be in SDK docs. when i encounter a problem like this i start from taking a look at where compilation error occured and then searching SDK headers for definition of types that seems to be 'undefined', looking for conditional compilation preprocessor directives around their definitions.
-
hello, I created a win32 project(precompiled headers, console application). This was created to create a service( for which i used SERVICE_TABLE_ENTRY, SERVICE_STATUS, SERVICE_STATUS_HANDLE, etc... required structures and methods). Environment used: Windows XP, VC++.Net2005. Should work on: I want to make this exe to run on windows 95,98, XP, 2000 and Vista. my stdafx.h file contains: #pragma once #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include #include // TODO: reference additional headers your program requires here #pragma warning (disable:4430)//... i added this, since i was getting this error. and in msdn this //was given as its solution. To this project, i have added two more files: 1) USBActivity.h 2) USBActivity.cpp In USBActivity.cpp the hierarchy of headers included is as follows: #include "stdafx.h" #include #include "stdio.h" #include #include #include "afxcmn.h" #include "cfgmgr32.h" #include "Blowfish_Data_FileEncrpt.h" #include "USBActivity.h" The project properties are set as: Use windows Standard libraries, WIN32;_DEBUG;_CONSOLE as preprocessor definitions, Basic Run-TimeChks: Both (/RTC1, equiv. to /RTCsu) , RunTime-Library --> Multi-threaded Debug (/MTd), Use Precompiled Header (/Yu), Linker+AdditionalDependencies-->setupapi.lib. I am getting following build errors: Compiling... stdafx.cpp Compiling... Blowfish_Data_FileEncrpt.cpp DataSentinelService.cpp d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT' d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : fatal error C1903: unable to recover from previous error(s); stopping compilation DoubleBuffering.cpp SHA.cpp USBActivity.cpp d:\microsoft visual studio 8\vc\platformsdk\include\commctrl.h(29) : error C2146: syntax error : missing ';' before identifier 'HRESULT' d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'CALLBACK' : undeclared identifier d:\microsoft visual studio 8\vc\platformsdk\include\prsht.h(97) : error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier d:\micr
You're in the wrong forum. This belongs in the Visual C++ forum. Your post has nothing to do with the .NET Framework.
Dave Kreskowiak Microsoft MVP - Visual Basic