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

@Larry, Help!

9 posts in this topic

I am just trying this. Don't put too much value on whether or not I can finish the project. I know little about DllCall, so I thought I would ask the man most suited for the task.

I have tried to attach a syslistview item to a gui form. Here is my current code:

#include <guiconstants.au3>

$ID_LISTVIEW = 100
$LVS_REPORT = 0x0001
$LVS_EDITLABELS = 0x200

$LOGPIXELSX = 88
$LOGPIXELSY = 90

$DIRECTION_VERTICAL = 1
$DIRECTION_HORIZONTAL = 0

GuiCreate("Test")
$parhwnd = WinGetHandle("Test")
guisetstate()

$listhwnd = DllCall("user32.dll", "hwnd", "CreateWindow" ,"str", "SysListView32", "str", "", "long", BitOr($WS_CHILD, $LVS_REPORT, $LVS_EDITLABELS), "int", 0, "int", 0, "int", 100 * TwipsPerPixelX(), "int", 100 * TwipsPerPixelY(), "hwnd", $parhwnd, "int", $ID_LISTVIEW, "int", 0, "none", 0)
msgbox(0,"",@error)

sleep(5000)


func GetDC($hwnd)
   $ret = DllCall("user32.dll", "long", "GetDC", "long", $hwnd)
   Return $ret[0]
EndFunc

Func ReleaseDC($hwnd, $hdc)
   $ret = DllCall("user32.dll", "long", "ReleaseDC", "long", $hwnd, "long", $hdc)
   Return $ret[0]
EndFunc

Func GetDeviceCaps($hdc, $nindex)
   $ret = DllCall("gdi32.dll", "long", "GetDeviceCaps", "long", $hdc, "long", $nindex)
   Return $ret[0]
EndFunc

func TwipsPerPixelX()
   $dc = GetDC(0)
   $ppi = GetDeviceCaps($dc, $LOGPIXELSX)
   $dc = ReleaseDC(0, $dc)
   return 1 / 1440 * $ppi
EndFunc

func TwipsPerPixelY()
   $dc = GetDC(0)
   $ppi = GetDeviceCaps($dc, $LOGPIXELSY)
   $dc = ReleaseDC(0, $dc)
   return 1 / 1440 * $ppi
EndFunc

Have I missed something?


Who else would I be?

Share this post


Link to post
Share on other sites



Thanks, Larry. I am seeing a small white box for the first time... Kinda exciting.

BTW, What's the main diff between CreateWindow and CreateWindowEx?


Who else would I be?

Share this post


Link to post
Share on other sites

Oh well, thanks. :)


Who else would I be?

Share this post


Link to post
Share on other sites

Thanks a lot Larry, for the $parhwnd, I had it that way at the first, but was wondering (when it didn't work) if the handle returned was not a windows handle, but an Au3 handle. Either way, Can you see any workarounds for any way to add items to the listview that does not require a structure?


Who else would I be?

Share this post


Link to post
Share on other sites
:) Well, At least I got a little bit further in my efforts than I would imagine most would have gome.

Who else would I be?

Share this post


Link to post
Share on other sites

Are you going to put the SysView in Scripts and Scrapts when it's finished?! I want this function, it would be pretty neat, keep up the good work = D


FootbaG

Share this post


Link to post
Share on other sites

It is done, he can't do any more to it, specifically, its not possible to make work, so its just pointless (Aside from some hopefully gained knowledge on how DllCall works for this-is-me).

Share this post


Link to post
Share on other sites

@ Valik,

From this-is-me: Don't put too much value on whether or not I can finish the project.


FootbaG

Share this post


Link to post
Share on other sites

Thats nice. Did you bother to read the rest of the thread? Particuarly the part where Larry said:

Nope, that cute white square is what you get until AutoIt 3 GUI has listview support... sorry...

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