| Clearner1 (38) | |
| how to call windows.h functions within a header file (basically i created an app using windows form application...and i need to call windows.h function when hitting certain buttons) | |
|
|
|
| Ogoyant (153) | |
I'm not sure what your question involves -- if you #include <windows.h> in your application, then you can call Windows functions anywhere in your program.
| |
|
Last edited on
|
|
| Clearner1 (38) | |||||
ok i want to do:
| |||||
|
|
|||||
| modoran (1245) | |
|
There is no such thing like RegOpenKeyValue(), maybe you want RegOpenmKeyEx() ? http://msdn.microsoft.com/en-us/library/windows/desktop/ms724897(v=vs.85).aspx | |
|
|
|
| Clearner1 (38) | |||
yes ...thank you i mistook it....how can i call it inside Form1_Load(...) , if i did something like this:
it pops: 1>WindowsFormsApplication1.obj : error LNK2028: unresolved token (0A00000D) "extern "C" long __stdcall RegOpenKeyExW(struct HKEY__ *,wchar_t const *,unsigned long,unsigned long,struct HKEY__ * *)" (?RegOpenKeyExW@@$$J220YGJPAUHKEY__@@PB_WKKPAPAU1@@Z) referenced in function "private: void __clrcall WindowsFormsApplication1::Form1::Form1_Load(class System::Object ^,class System::EventArgs ^)" (?Form1_Load@Form1@WindowsFormsApplication1@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) | |||
|
Last edited on
|
|||
| Ogoyant (153) | ||||
Have you done this? :
Also, make sure that Advapi32.lib is added in your Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies. This .lib is required for using RegOpenmKeyEx(). EDIT: If you look at the bottom of the webpage linked by modoran, you'll see that the MSDN documentation for RegOpenmKeyEx() mentions:
That's how you can determine the requirements for a function to work -- this one needs Advapi32.lib to work (and of course including windows.h). | ||||
|
Last edited on
|
||||
| Clearner1 (38) | |
| yes i considered that .... even if you changed this function to any other function it wont work...i tried GetModuleHandle() and FindWindow() ....the same error pops out....try it you will see....my purpose is to know why the previous function(or Windows.h functions) cannot be invoked?? | |
|
Last edited on
|
|
| Grey Wolf (3232) | ||
You are mixing Managed (.net framework) code with unmanaged (native) code. I would suggest that, you don't know the difference, you spend a little time looking at the two 'ways' of programming windows and make sure you are on the right track for what you want to learn. | ||
|
|
||
| bobdabilder (76) | |||||
|
Grey Wolf has a good suggestion, you have to decide which path you're going down. if you choose managed: this will help This is your namespace directive. I put it last.
No additional includes are necessary
Good luck. | |||||
|
|
|||||
| Clearner1 (38) | |||
|
thanks a lot you all....i didnt know those are totally different ....the last question Ok what is this operator suppose to mean ^...as i know it is supposed to be used in bitwise operation .....in this
| |||
|
Last edited on
|
|||
| modoran (1245) | |
|
You are using an entirely different language then C++, so there are different language syntax and rules. Are sure you want to use Microsoft C++/CLI ? As for your question, read this: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/0a4bdea7-6d86-4e11-85d9-3884907ff962/ That forum is also the right place for that language, as here not much users know it. | |
|
|
|
| Clearner1 (38) | |
| ok thanks a lot | |
|
|
|