sugi Posted December 23, 2004 Share Posted December 23, 2004 I've got the following call: RUNDLL32 PRINTUI.DLL,PrintUIEntry /? How would I call this using DllCall? DllCall('printui.dll', 'int', 'PrintUIEntry', 'str', '/?') does not seem to work Link to comment Share on other sites More sharing options...
Valik Posted December 23, 2004 Share Posted December 23, 2004 Having a quick look at the DLL on XP Pro SP2, there isn't an entry named "PrintUIEntry", instead, its "PrintUIEntryW". However, running that causes the DLL to give me an error (Not a crash, just an error message) saying the operation couldn't be completed. DllCall('printui.dll', 'int', 'PrintUIEntryW', 'str', '/?') Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 23, 2004 Administrators Share Posted December 23, 2004 Having a quick look at the DLL on XP Pro SP2, there isn't an entry named "PrintUIEntry", instead, its "PrintUIEntryW". However, running that causes the DLL to give me an error (Not a crash, just an error message) saying the operation couldn't be completed.DllCall('printui.dll', 'int', 'PrintUIEntryW', 'str', '/?')W is the wide (unicode) version of the DLL. A is the ANSI version. The DLLCall in autoIt automatically tries FunctionName and FunctionNameA. But if there is only a unicode version then it will fail. Maybe a wstr parameter type is required that does the conversion. 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...
Valik Posted December 23, 2004 Share Posted December 23, 2004 Perhaps so, Jon. I get the same message just running: RUNDLL32 PRINTUI.DLL,PrintUIEntry Link to comment Share on other sites More sharing options...
sugi Posted December 23, 2004 Author Share Posted December 23, 2004 So I guess this wont work unless AutoIt has unicode support or a function to translate the strings? Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 23, 2004 Administrators Share Posted December 23, 2004 So I guess this wont work unless AutoIt has unicode support or a function to translate the strings?Correct. Should be an easy change though, I'll have a quick look at it. 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...
Administrators Jon Posted December 23, 2004 Administrators Share Posted December 23, 2004 Heh, not quite so simple. DLLs that RunDLL can call have to be passed certain parameters. The unicode bit (which I've almost done) is but one part of it:The platform SDK has this to say about rundll32:<quote>The Run DLL utility (Rundll32.exe) included in Windows enables you to call functions exported from a 32-bit DLL. These functions must have the following syntax:void CALLBACK EntryPoint( HWND hwnd, // handle to owner windowHINSTANCE hinst, // instance handle for the DLLLPTSTR lpCmdLine, // string the DLL will parse int nCmdShow // show state);</quote>So the prototype declaration would beProcedure PrintUIEntryW( wnd: HWND; inst: HMODULE; lpCmdLine: PWideChar; nCmdShow: Integer ); stdcall;external 'printUI.dll';Anything you would pass to rundll32 after the procedure name, excluding the first blank, would be passed as a single widestring in lpCmdLine, with parameters that contain blanks themselves enclosed in double quotes.As to *what* to pass for the parameters, well, wnd should be the window handle of your applications main window, or 0 if you don't have a window.inst should probably be the module handle of printUI.DLL (you can get that using GetModuleHandle), but i was unable to find any specific info about that. What to pass for lpCmdLine is of course specific to the function itself. I was unable to find any mention of PrintUI or PrintUIEntry in the latest MSDN library, so no help here. nCmdShow is one of the show states documented for the ShowWindow API, e.g SW_SHOWNORMAL. 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...
Administrators Jon Posted December 23, 2004 Administrators Share Posted December 23, 2004 This brings up the /? dialog at least. I'll upload the code in a while, just have to do the conversion back from unicode to ansi for those functions that return strings. DllCall('printui.dll', 'none', 'PrintUIEntryW', 'hwnd', 0, 'ptr', 0, 'wstr', '/?', 'int', @SW_SHOWNORMAL) 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...
sugi Posted December 23, 2004 Author Share Posted December 23, 2004 Well, take it easy. It's not urgent. I've just used Run('rundll32 ...'). Besides I'm on holidays in a few minutes. Link to comment Share on other sites More sharing options...
Administrators Jon Posted December 23, 2004 Administrators Share Posted December 23, 2004 Well, take it easy. It's not urgent. I've just used Run('rundll32 ...').Besides I'm on holidays in a few minutes.Done and uploaded.I don't intend to do anything either for a few days. Have to make the trip to see the parents tomorrow....... 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...
sugi Posted December 23, 2004 Author Share Posted December 23, 2004 Then have nice holidays and a good new year. Of course to the others, too. I'm off for now. 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