Sign in to follow this  
Followers 0
oren

A question about dll

3 posts in this topic

#1 ·  Posted (edited)

I want to understand something...

I'm learning about dll's and this example really help

; *******************************************************
; Example 1 - calling the MessageBox API directly
; *******************************************************

$result = DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)

The one thing that i dont really understand is the "int" , 0 , Because when i look at msdn ,i see that the last thing that you need to enter is the option of the massagebox

http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

uType
    [in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.

        To indicate the buttons displayed in the message box, specify one of the following values.

        MB_ABORTRETRYIGNORE
            The message box contains three push buttons: Abort, Retry, and Ignore.
        MB_CANCELTRYCONTINUE
            Microsoft Windows 2000/XP: The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
        MB_HELP
            Windows 95/98/Me, Windows NT 4.0 and later: Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
        MB_OK
            The message box contains one push button: OK. This is the default.
        MB_OKCANCEL
            The message box contains two push buttons: OK and Cancel.
        MB_RETRYCANCEL
            The message box contains two push buttons: Retry and Cancel.
        MB_YESNO
            The message box contains two push buttons: Yes and No.
        MB_YESNOCANCEL
            The message box contains three push buttons: Yes, No, and Cancel.

Now i know that the dll request a uint

UINT uType

The question is how do i convert the command to UINT ?

Thanks.

Edited by oren

Share this post


Link to post
Share on other sites



I want to understand something...

I'm learning about dll's and this example really help

; *******************************************************
; Example 1 - calling the MessageBox API directly
; *******************************************************

$result = DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0)

The one thing that i dont really understand is the "int" , 0 , Because when i look at msdn ,i see that the last thing that you need to enter is the option of the massagebox

http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx

uType
    [in] Specifies the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.

        To indicate the buttons displayed in the message box, specify one of the following values.

        MB_ABORTRETRYIGNORE
            The message box contains three push buttons: Abort, Retry, and Ignore.
        MB_CANCELTRYCONTINUE
            Microsoft Windows 2000/XP: The message box contains three push buttons: Cancel, Try Again, Continue. Use this message box type instead of MB_ABORTRETRYIGNORE.
        MB_HELP
            Windows 95/98/Me, Windows NT 4.0 and later: Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
        MB_OK
            The message box contains one push button: OK. This is the default.
        MB_OKCANCEL
            The message box contains two push buttons: OK and Cancel.
        MB_RETRYCANCEL
            The message box contains two push buttons: Retry and Cancel.
        MB_YESNO
            The message box contains two push buttons: Yes and No.
        MB_YESNOCANCEL
            The message box contains three push buttons: Yes, No, and Cancel.

Now i know that the dll request a uint

UINT uType

The question is how do i convert the command to UINT ?

Thanks.

The "int",0 is "int",$MB_OK

at the end of the page for which you gave a link there is a link to winuser.h where the constants are defined.

You will also find them defined in the include file constants.au3 under ; Message Box Constants so you could write

#include <constants.au3>

$result = DllCall("user32.dll", "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "uint", $MB_OK)

These value are also given in the help for MsgBox.

I think you are correct that it should be "uint" not "int" but it won't make any difference for the values needed.

The variable types are listed in the help for DllCall and you will see uint is there so there nothing magical about it.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Woow thanks i wonder why i didnt look down...

A and i should have thought about looking in MsgBox

Thank you.

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