myredeemerlives Posted August 19, 2005 Share Posted August 19, 2005 *sigh* I am trying to pass a null paramater to a DLL function with DLL call and I don't know how to do it. ARG!!!!!! If I use LONG, and 0. Then I just get a THIS PROGRAM HAS CAUSED AN ILLEGAL OPERATION. What I am trying to do is write a Win32 Console Script using the pure WinAPI. Some HELP! Link to comment Share on other sites More sharing options...
myredeemerlives Posted August 19, 2005 Author Share Posted August 19, 2005 (edited) please show a script example.... please.... pretty please...Lar.<{POST_SNAPBACK}>$STD_OUTPUT = -Dec("11") $Yo = DLLOpen("C:\Windows\System\Kernel32.dll") DLLCall($Yo,"LONG","AllocConsole") $hOutput = DLLCall($Yo,"LONG","GetStdHandle","LONG",$STD_OUTPUT) DLLCall($Yo, "LONG","WriteConsole","LONG",$hOutput,"STRING","Hello","LONG",StringLen("Hello"),"","","","") MsgBox(0,"HMM","WRITE SOMETHING TO THE CONSOLE WINDOW DARN IT!!!!") DLLCALL($Yo,"LONG","FreeConsole") DLLClose($Yo) Edited August 19, 2005 by myredeemerlives Link to comment Share on other sites More sharing options...
therks Posted August 19, 2005 Share Posted August 19, 2005 Just as a guess, but perhaps you need to do it like DllCall($Yo, 'Long', 'FreeConsole', 'void', 0) ?? Have you tried that? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
myredeemerlives Posted August 19, 2005 Author Share Posted August 19, 2005 Just as a guess, but perhaps you need to do it likeDllCall($Yo, 'Long', 'FreeConsole', 'void', 0) ?? Have you tried that?<{POST_SNAPBACK}>FreeConsole has no paramaters Im talking about WriteConsole. Link to comment Share on other sites More sharing options...
myredeemerlives Posted August 19, 2005 Author Share Posted August 19, 2005 DLLCall($Yo, "LONG","WriteConsole","LONG",$hOutput,"STRING","Hello","LONG",StringLen("Hello"),"","","","")i am sure the above is incorrect as it does not describe the last four pams... "","","","" cannot be correct.Lar.<{POST_SNAPBACK}>I already tried using all the possible param types for the last 4 and 0 as the paramaters but it didn't work.The function either fails, or it suceeds and causes and illegal operation.I was doing this type of thing in VB6 just before so I know what Im doing with these functions it is just that I need AutoIt to be able to pass null paramaters. Link to comment Share on other sites More sharing options...
myredeemerlives Posted August 20, 2005 Author Share Posted August 20, 2005 BOOL AllocConsole(void);AllocConsole returns a boolean, not a console handle...maybe you need...HANDLE GetStdHandle(DWORD nStdHandle);<{POST_SNAPBACK}>I thought that GetStdHandle returns a long no?What the.....?Well, I will try it. Link to comment Share on other sites More sharing options...
myredeemerlives Posted August 20, 2005 Author Share Posted August 20, 2005 (edited) I thought that GetStdHandle returns a long no?What the.....?Well, I will try it.<{POST_SNAPBACK}>The functions didn't work at all, and I mean at all, when I changed the types.AllocConsole returns a long, according to my WinAPI viewer.When I used bool, it wouldn't even open a console window.hmmm. This is weird.Edit: The function refuses to work under any circumstances. Edited August 20, 2005 by myredeemerlives Link to comment Share on other sites More sharing options...
myredeemerlives Posted August 27, 2005 Author Share Posted August 27, 2005 So I guess nobody knows the answer? Link to comment Share on other sites More sharing options...
myredeemerlives Posted August 28, 2005 Author Share Posted August 28, 2005 Gee, some support forum. Link to comment Share on other sites More sharing options...
Administrators Jon Posted August 28, 2005 Administrators Share Posted August 28, 2005 From the Sticky post in the Dev forum:Windows Datatype = DllCall TypeBOOL = "int"COLORREF = "int"DWORD = "int"HANDLE = "ptr"HDC = "ptr"HFILE = "int"HFONT = "ptr"HICON = "ptr"HINSTANCE = "ptr"HKEY = "ptr"HMENU = "ptr"HMODILE = "ptr"HWND = "hwnd"INT = "int"LONG = "long"LPARAM = "long"LPCTSTR = "str" ("wstr" if a UNICODE function)LPINT = "int_ptr"LPLONG = "long_ptr"UINT = "int"ULONG = "long"WPARAM = "int"HANDLE and BOOL are listed. Try that. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ 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