| View previous topic :: View next topic |
| Author |
Message |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Sun Apr 13, 2008 10:49 am Post subject: [Question] How to use user32.dll |
|
|
Hi, I seem to have trouble loading "user32.dll" in my program . What exactly do I need to make it load successfully? I tried looking through all the auto clicker sources and such, but it contains too much other stuff.
The language is C++
Thanks.
Now im getting the error
| Code: | | Unhandled exception at 0x00000000 in spawntrainer.exe: 0xC0000005: Access violation reading location 0x00000000. |
(IM modifying the sourceode of spawntrainer)
Last edited by kitterz on Sun Apr 13, 2008 11:23 am; edited 2 times in total |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Apr 13, 2008 10:53 am Post subject: |
|
|
Stop making new topics, just post all in the same thread -.-
Make a Module handle for the handle value to be passed onto the call LoadLibrary.
| Code: |
HMODULE hUser32;
hUser32 = LoadLibrary( _T("user32.dll") );
// For Extra check if you want:
if ( hUser32 == NULL ) MessageBox( NULL, _T("Didn\'t load"), _T("Error"), MB_OK );
|
_T is a macro for unicode, if your not using a UNICODE charecter set then remove the _T( ). _________________
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Apr 13, 2008 1:26 pm Post subject: |
|
|
| lurc wrote: | | _T is a macro for unicode, if your not using a UNICODE charecter set then remove the _T( ). |
_T allows it to be either or, L is set in stone however. |
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Apr 13, 2008 3:45 pm Post subject: |
|
|
I know that, but he'll most likely try to compile and say "it says _T is undefined" becuase its located in tchar.h and if hes not using UNICODE then hes most likely not gonna be including that header. _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Apr 13, 2008 6:23 pm Post subject: |
|
|
I look LoadLibrary(Ex) on msdn and whenever they use it in example code they do something like this:
| Code: |
hModule = LoadLibraryEx(
TEXT("netmsg.dll"),
NULL,
LOAD_LIBRARY_AS_DATAFILE
);
|
Just wondering on why they use TEXT instead of _T or L(btw, they use it for LoadLibrary as well. And I have a question, what is the point of using LoadLibrary. Just wondering. Because I would like to know uses of this. _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Apr 13, 2008 6:27 pm Post subject: |
|
|
TEXT is located in WinNT.h which is automatically included when you include Windows.h, thats why they use TEXT.
If they used _T they would have to constantly remark that you must include tchar.h and if they put L then people using ACSII charecter sets would have problems compiling. _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Apr 13, 2008 6:47 pm Post subject: |
|
|
Ok. So I get it now. But what are the uses of LoadLibrary(Ex). I mean, I get it loads the module, but what can you do after that.
Btw, what is a module. I tried looking but couldn't find anything on it. And I know it seems stupid me asking what it is, but we all have to start somewhere, and there was a time when you probably didn't know what a module was either. So what is a module?
Btw, it seems like its synonymous to something that I already know =P _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Apr 13, 2008 7:30 pm Post subject: |
|
|
A Module is... like a contained region of memory. Like when you open any application, they have there own Module.
LoadLibrary gets the handle to that Module and allows you to read, write, etc.
The Reason we have LoadLibrary is obviously to load specific Modules/Dll's we want. Like say you have a Dll you've made with an Export Function.
You load that dll using LoadLibrary and then using that You can use GetProcAddress to get the address of the function you've exported, then you typedef the parameters, define the function, and you have your exported function right in your Project. _________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun Apr 13, 2008 7:48 pm Post subject: |
|
|
Oh. I get it now =). _________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
|