layer Posted April 28, 2005 Posted April 28, 2005 Hey guys, just thre together a quick little Dll that gets the mili seconds your system has been running since startup... It's pretty neat. Source of the Dll is in the zip, the Dll is in the zip, and an example is in the zip FootbaG
Valik Posted April 28, 2005 Posted April 28, 2005 Errr... what's the point of your DLL? All you do is return the value of GetTickCount(). Don't you think it'd be smarter to maybe... not use your DLL and call the function directly?
layer Posted April 28, 2005 Author Posted April 28, 2005 Well, I'm at my friends house, but yea, you're right. But when you have nothing to do, you get reallllly bored :"> FootbaG
therks Posted April 28, 2005 Posted April 28, 2005 Well, I'm at my friends house, but yea, you're right. But when you have nothing to do, you get reallllly bored :"><{POST_SNAPBACK}>Is that your subtle way of telling us you have "reallllly" boring friends? My AutoIt Stuff | My Github
layer Posted April 29, 2005 Author Posted April 29, 2005 No no no, lol, I was at home when I coded the Dll, but when I was at home, I was realllly bored, and I didn't have anything better to do and I just wanted to burn some time But when I wrote that post, I was at my friends house checking the status of my posts My friends are hella fun, trust me FootbaG
jftuga Posted April 29, 2005 Posted April 29, 2005 Since the code is so small, it does make for a good example on how to make a DLL for autoit. -John Admin_Popup, show computer info or launch shellRemote Manager, facilitates connecting to RDP / VNCProc_Watch, reprioritize cpu intensive processesUDF: _ini_to_dict, transforms ini file entries into variablesUDF: monitor_resolutions, returns resolutions of multiple monitorsReport Computer Problem, for your IT help deskProfile Fixer, fixes a 'missing' AD user profile
Valik Posted April 29, 2005 Posted April 29, 2005 Its actually a poor example. 95% of the code is not necessary; its virtually all wizard-generated. The exported class is never used, so its a waste. The header isn't necessary unless you intend to link statically against the DLL; AutoIt can't, so that's a waste as well. The code should look more like: #include <windows.h> BOOL APIENTRY DllMain(HINSTANCE, DWORD, LPVOID) { return TRUE; } extern "C" DWORD WINAPI GetSysTicks() { return GetTickCount(); } Thats all that's really needed. Writing a paper thin wrapper around an API function that can be called directly isn't a very good example. A small function that does something useful would be a good example. But all this example showed was that layer can spend 30 seconds creating a new DLL project and adding a thin wrapper around a function. And, unless I'm mistaken, any function that AutoIt calls needs to be declared as using the __stdcall calling convention. I think the default is __cdecl, so running under a debugger, I expect to see some esp (stack pointer) errors*. Although this won't introduce a crash, it may leak some resources. In layer's defense, I don't expect him to know about the calling convention as its not documented anywhere (Not documented in AutoIt that it needs to be __stdcall). However, still, his example does more wrong than it does right, so it is not a good source for reference. * There may be no errors since no parameters are pushed onto the stack.
layer Posted April 29, 2005 Author Posted April 29, 2005 Yea, I didn't intend for it to be an example... And lol, yea, it's all wizard generated except for this: extern "C"__declspec(dllexport) int GetSysTicks(){ return GetTickCount(); } Actually, not really wizard generated, more of a default template FootbaG
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now