Sign in to follow this  
Followers 0
qwert

Seeking guidelines for direct DLL calls

7 posts in this topic

For years, I've made direct DLL calls to DLLs like User32.dll, by following the examples of others ... particularly those in UDFs.

But I've never seen any guidelines for doing so.

Now I've encountered a case where a script statement doesn't work in Win10 and where MSFT offers alternatives (below). 

Run('explorer shell:::{ED7BA470-8E54-465E-825C-99712043E01C}')

So I have these questions:

  • Can I call display.dll directly to bring up the settings panel?
  • Are there general guidelines and instructions for direct calls?

Thanks in advance for any help.

 

DLL Call.png

Share this post


Link to post
Share on other sites



What window do you want to show?

 

Run("control.exe desk.cpl,Settings,@Settings")

 


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

In the instance of display.dll, it's actually the Screen Resolution panel.

Screen Resolution.PNG

Share this post


Link to post
Share on other sites

I found a command the goes directly to the Screen Resolution settings on Win7.  It also works on Win10, although the layout differs.

Run("rundll32.exe shell32.dll,Control_RunDLL desk.cpl,Monitor,@Monitor")

I first saw the desk.cpl,Monitor,@Monitor part in a suggested Win+R entry.  Further searching revealed the rundll32.exe packaging for it.

So, it works, but I don't know why.  Can anyone elaborate on the entire combination?  How is it doing what it's doing?  And is there a simpler way?

Share this post


Link to post
Share on other sites

I tried a lot, but nothing worked for me. Even your last script line does not work. I think it depends on updates of Win10 if this is still available or not.


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Well, I did find this snippet of documentation about one of the other control panels.  I can confirm that sysdm.cpl,,3 works to bring up the Advanced tab on Win7 Pro.  I haven't been able to test, yet, on Win10, but my earlier tests seem to say that at least some tabs are different.  I'll continue to test ... and look for more complete documentation.

Quote

System Properties (Advanced System Settings)

C:\>control sysdm.cpl
C:\>control sysdm.cpl,,2
C:\>control sysdm.cpl,,3
C:\>control sysdm.cpl,,4
C:\>control sysdm.cpl,,5

IOW, add two commas and a number to access the specific tab you want:

1 Computer Name
2 Hardware
3 Advanced
4 System Protection
5 Remote

 

Share this post


Link to post
Share on other sites

I've located another bit of documentation:

Quote

the syntax for a command is:

RUNDLL32.EXE <dllname>,<entrypoint> <optional arguments>

"Because of the large number of commands, there are no simple general rules about which commands exist."—an online source

Here are two more that I've tested and that work with both Win7 and Win10:

Quote

RunDll32.exe shell32.dll,Control_RunDLL   << control panel

RunDll32.exe shell32.dll,Options_RunDLL 7  << view folder options

Overall, things are making a little more sense: calling a DLL with an entry point.  But the designation of a panel's tab seems a little "loose".

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0