JohnOne Posted October 3, 2010 Author Share Posted October 3, 2010 I can add a ptototype before DllMain Richard ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ProgAndy Posted October 3, 2010 Share Posted October 3, 2010 Why would you have to do this? Just create a function that the user of your DLL has to call directly after DLLOpen. *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
jaberwacky Posted October 3, 2010 Share Posted October 3, 2010 Becuase then you're relying on people like me to actually remember to do something! Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
jaberwacky Posted October 3, 2010 Share Posted October 3, 2010 I can add a ptototype before DllMain Richard ?Why not? You can add prototypes before int main(). Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
JohnOne Posted October 3, 2010 Author Share Posted October 3, 2010 (edited) Yes, and the function works, but im having a problem telling when its executing because I'm not getting any console output until the dll is closed. I'm in way over my head here now, I dont want to be wasting anyones time. Edited October 3, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
ProgAndy Posted October 3, 2010 Share Posted October 3, 2010 (edited) Well, if you want it for AutoIt, create a function that loads the DLL and executes the function at once. Such wrappers for DLLOpen are included in most libraries using dlls like GDI+, MySQL, ... This means, the users do not have to call DLLOpen, only xour custom func. Additional parameters for DLLOpen wouldn't be easier I bet. Edited October 3, 2010 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
JohnOne Posted October 3, 2010 Author Share Posted October 3, 2010 Thanks, I'll take a look at that. And thanks to everyone for the schooling. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 4, 2010 Share Posted October 4, 2010 And yes, you can put function prototypes wherever you want. Link to comment Share on other sites More sharing options...
trancexx Posted October 4, 2010 Share Posted October 4, 2010 Yes, and the function works, but im having a problem telling when its executing because I'm not getting any console output until the dll is closed.I'm in way over my head here now, I dont want to be wasting anyones time.You should flush. Just like when peeing. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
jaberwacky Posted October 4, 2010 Share Posted October 4, 2010 You should flush. Just like when peeing.Riddle me this riddle me that, Riddler.That should keep 'em busy. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
JohnOne Posted October 4, 2010 Author Share Posted October 4, 2010 (edited) You should flush. Just like when peeing. I've got a feeling that you gave me a hint there, its just a little to cryptic for a numpty like me. I'm feeling like bit of a dullard regarding dlls at the moment, a 'dllard' if you will. But I'm still looking into my problems. EDIT: In the end I wound up adding a flag in the dll code, so the function I wanted to run upon DllOpen runs before the first function call, then the flag is set so it dosent run again. For reference, the function called here case DLL_PROCESS_ATTACH: function(); break; Only seems to execute wnen the dll is closed/closing. Edited October 4, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
trancexx Posted October 4, 2010 Share Posted October 4, 2010 That function is executed when it should be executed, you can be sure of that. Question is what is function()? I could speculate the content of that function and probably wouldn't be too wrong; and not because I'm smart, but because you are too obvious . Show me yours and I'll show you... what I meant up there. Don't be shy. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
JohnOne Posted October 4, 2010 Author Share Posted October 4, 2010 I'l take you at your word, but I still dont get it, all the indication tell me the code isnt being executed until DllMain returns. But as always I'm up for a bit of education. expandcollapse popupint mainrtn(void); BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: mainrtn(); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } //Function declaration extern "C" LPSTR __stdcall retstr(double s); //Functions LPSTR __stdcall retstr(double s) { if (s == 100000) { std::cout<<"Sweet"; return "Sweet"; } std::cout<<"Sour"; return "Sour"; } int mainrtn() { std::cout<<"Called"<<"\n"; return 0; } $dllopen = DllOpen("TestDll.dll") $call = DllCall($dllopen, "str", "retstr", "double", 100000) If @error Then ConsoleWrite(@error & @CRLF) Exit Else ConsoleWrite($call[0] & @CRLF) EndIf $call = DllCall($dllopen, "str", "retstr", "double", 100000) ConsoleWrite($call[0] & @CRLF) $call = DllCall($dllopen, "str", "retstr", "double", 100000) ConsoleWrite($call[0] & @CRLF) DllClose($dllopen) Sweet Sweet Sweet Sweet Sweet Sweet Called AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Valik Posted October 4, 2010 Share Posted October 4, 2010 std::endl is your friend. Link to comment Share on other sites More sharing options...
JohnOne Posted October 4, 2010 Author Share Posted October 4, 2010 http://www.cplusplus.com/reference/iostream/manipulators/endl/Insert newline and flushCheers Valik.trancexx is just a tease AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Valik Posted October 4, 2010 Share Posted October 4, 2010 She's not a tease. She told you exactly what to do. You were just distracted by sentence 2 and ignored sentence 1. Link to comment Share on other sites More sharing options...
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