Sign in to follow this  
Followers 0
this-is-me

Venturing into the unknown again

12 posts in this topic

I have once again hit a snag (do I never learn?). I am trying to bring up the properties dialog box for a file, and can't seem to get everything straight:

#cs
Type SHELLEXECUTEINFO
       cbSize As Long
       fMask As Long
       hWnd As Long
       lpVerb As String
       lpFile As String
       lpParameters As String
       lpDirectory As String
       nShow As Long
       hInstApp As Long
       lpIDList As Long
       lpClass As String
       hkeyClass As Long
       dwHotKey As Long
       hIcon As Long
       hProcess As Long
End Type

SHELLEXECUTEINFO ShExecInfo ={0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_INVOKEIDLIST;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = "properties";
ShExecInfo.lpFile = "c:\\"; //can be a file as well
ShExecInfo.lpParameters = ""; 
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL; 
ShellExecuteEx(&ShExecInfo);
#ce


$SEE_MASK_INVOKEIDLIST = 0xC
$SHELLEXECUTEINFO = DllStructCreate("long;long;long;str;str;str;str;long;long;long;str;long;long;long;long")
DllStructSetData($SHELLEXECUTEINFO, 1, DllStructGetSize($SHELLEXECUTEINFO))
DllStructSetData($SHELLEXECUTEINFO, 2, $SEE_MASK_INVOKEIDLIST)
DllStructSetData($SHELLEXECUTEINFO, 4, "properties")
DllStructSetData($SHELLEXECUTEINFO, 5, "C:\boot.ini")
DllStructSetData($SHELLEXECUTEINFO, 6, "")
DllStructSetData($SHELLEXECUTEINFO, 8, @SW_SHOW)

;Private Declare Function ShellExecuteEX Lib "shell32.dll" Alias "ShellExecuteEx" (SEI As SHELLEXECUTEINFO) As Long

$ret = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($SHELLEXECUTEINFO))
MsgBox(0,"",@error)
MsgBox(0,"",$ret[0])

$lastError = DllCall("kernel32.dll", "int", "GetLastError")
MsgBox(0,"",$lastError[0])

It seems that the above code actually crashes autoit instead of returning. Can anyone help?


Who else would I be?

Share this post


Link to post
Share on other sites



I have to say, this is a big turnout. Which of these may I attribute this silence to?

1. I haven't waited long enough.

2. Nobody knows what I am talking about.

3. Nobody cares.

4. Nobody knows why this is happening.

5. I have not given enough information.

6. I asked the question the wrong way.

7. I offended someone by asking for help.


Who else would I be?

Share this post


Link to post
Share on other sites

Busy

"long" should be "int", "str" should be "char[" & somelen & "]"

for starters.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanks gafrost. I should have realised that "long" doesn't exist anyway. :whistle:


Who else would I be?

Share this post


Link to post
Share on other sites

I have to say, this is a big turnout. Which of these may I attribute this silence to?

1. I haven't waited long enough.

2. Nobody knows what I am talking about.

3. Nobody cares.

4. Nobody knows why this is happening.

5. I have not given enough information.

6. I asked the question the wrong way.

7. I offended someone by asking for help.

<{POST_SNAPBACK}>

busy at work and kind of too scatterbrained today to debug.... getting new laptop (hopefully) today so i've been checking fed-ex site all morning, and quitting smoking today, so not thinking clearly enough to post too much productive stuff... those are just my excuses though, they don't really apply to others though...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Well thanks to gafrost, I did see my mistake, and everything worked out OK. Thanks everyone.


Who else would I be?

Share this post


Link to post
Share on other sites

Sorry to bump this thread up, but I do need this script to function correctly. I tried to modify these codes but it doesn't works,could 'this-is-me' put your final codes on here or someone else can help?

My modified codes as below

$verb="properties"
$file="c:\boot.ini"

$SEE_MASK_INVOKEIDLIST = 0xc    

$SHELLEXECUTEINFO = DllStructCreate("dword;int;hwnd;char["&StringLen($verb)&"];char["&StringLen($file)&"];char;char;int;ptr;int;char;ptr;int;int;ptr")
if @error Then  MsgBox(0,"","Error in DllStructCreate " & @error)

DllStructSetData($SHELLEXECUTEINFO, 1, DllStructGetSize($SHELLEXECUTEINFO))
DllStructSetData($SHELLEXECUTEINFO, 2, $SEE_MASK_INVOKEIDLIST)
DllStructSetData($SHELLEXECUTEINFO, 3, 0)
DllStructSetData($SHELLEXECUTEINFO, 4, $verb)
DllStructSetData($SHELLEXECUTEINFO, 5, $file)
DllStructSetData($SHELLEXECUTEINFO, 6, 0)
DllStructSetData($SHELLEXECUTEINFO, 7, 0)
DllStructSetData($SHELLEXECUTEINFO, 8, @SW_SHOW)


;Private Declare Function ShellExecuteEX Lib "shell32.dll" Alias "ShellExecuteEx" (SEI As SHELLEXECUTEINFO) As Long

$ret = DllCall("shell32.dll", "int", "ShellExecuteEx", "ptr", DllStructGetPtr($SHELLEXECUTEINFO))
If @error Then
    MsgBox(0,"",@error)
    MsgBox(0,"",$ret[0])
    $lastError = DllCall("kernel32.dll", "int", "GetLastError")
    MsgBox(0,"",$lastError[0])
EndIf
:)

Share this post


Link to post
Share on other sites

Please...could the threadstarter or gafrost bring themselves to complete this thread? gafrost in particular promised to be 'back later with more info' - well, it's as good a time as any right now to follow up on that offer.

Thing is, despite having had all invalid variable definitions replaced the script returns error codes of '0' which I believe means 'none'. However, the script doesn't do anything at all. Probably it's missing something along the lines of 'execute shellexecuteinfo' - no big issue at all for those who have worked with DLL code before. So could you please, please enlighten the newbies and finalize the script so that it actually runs...? I for one would greatly appreciate your help.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Ok by now it's obvious this-is-me and gafrost have all but abandoned this thread for reasons known known to them only. As there is no-one with a basic understandig of autoit dll code who doesn't think it beneath them to answer on this topic, well, we're on our own. Myself, I now use VB6 code to get the task done:

Option Explicit
'
Private Const SW_SHOW = 5
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Type SHELLEXECUTEINFO
    cbSize As Long
    fMask As Long
    hwnd As Long
    lpVerb As String
    lpFile As String
    lpParameters As String
    lpDirectory As String
    nShow As Long
    hInstApp As Long
    ' optional fields
    lpIDList As Long
    lpClass As String
    hkeyClass As Long
    dwHotKey As Long
    hIcon As Long
    hProcess As Long
End Type

Private Declare Function ShellExecuteEx Lib "shell32.dll" (ByRef s As SHELLEXECUTEINFO) As Long

Public Sub DisplayFileProperties(ByVal sFullFileAndPathName As String)
    Dim shInfo As SHELLEXECUTEINFO
    
    With shInfo
        .cbSize = LenB(shInfo)
        .lpFile = sFullFileAndPathName
        .nShow = SW_SHOW
        .fMask = SEE_MASK_INVOKEIDLIST
        .lpVerb = "properties"
    End With
    
    ShellExecuteEx shInfo
End Sub

Private Sub FilePropBox_Change()
    Dim sFileName As String
    
    sFileName = FilePropBox
    If Len(sFileName) = 0 Then
        MsgBox "You must enter a filename"
        Exit Sub
    End If
    
    If Len(Dir(sFileName)) = 0 Then
        MsgBox "File : " & sFileName & " cannot be found"
        Exit Sub
    End If
    
    DisplayFileProperties sFileName
End Sub

I use the following AutoIt code to call the compiled VB6 executable:

Opt("WinTitleMatchMode", 4)
Opt("TrayIconDebug", 1)

Run(@ScriptDir & "\FileProp.exe")
WinWaitActive("classname=ThunderRT6FormDC")
ControlSetText("last", "", "ThunderRT6TextBox1", @ScriptDir & "\FileProp.exe")

Hope this helps a little bit - anyway, it's way more than what we're likely to see from the likes of this-is-me or gafrost in the next couple of years or so.

Edited by husalov

Share this post


Link to post
Share on other sites

Please...could the threadstarter or gafrost bring themselves to complete this thread? gafrost in particular promised to be 'back later with more info' - well, it's as good a time as any right now to follow up on that offer.

Show me where I promised any such thing?????

Reviving a 2 year old thread and then expecting someone to answer right away would be a mistake.

Besides this doesn't even interest me at this time.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Busy

"long" should be "int", "str" should be "char[" & somelen & "]"

for starters.

Now isn't that cute...if you ask nicely and politely you can wait forever for an answer to materialize. On the other hand, add just the slightest bit of offensiveness and whoa! - you get your reaction within a few minutes. I recommend all inquisitive visitors to this forum start off their question with some sort of derisive remark. Thanks anyhow, gafrost, for making that point. Matter of fact, I'm not at all interested in your interests either - my problem is solved and the main reason for my post above was to help others in my situation save themselves of a few hours of exhaustive search.

Share this post


Link to post
Share on other sites

Now isn't that cute...if you ask nicely and politely you can wait forever for an answer to materialize. On the other hand, add just the slightest bit of offensiveness and whoa! - you get your reaction within a few minutes. I recommend all inquisitive visitors to this forum start off their question with some sort of derisive remark. Thanks anyhow, gafrost, for making that point. Matter of fact, I'm not at all interested in your interests either - my problem is solved and the main reason for my post above was to help others in my situation save themselves of a few hours of exhaustive search.

Bear in mind that the post I qouted was your 1st post in this thread, so still waiting for the polite one.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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