Kip Posted May 31, 2008 Posted May 31, 2008 (edited) Hi,As long as I use AutoIt I never got a DLL working.Now I'm trying to use CreateWindow() from user32.dll (which is almost the same as CreateWindowEx() from WinAPI.au3)MSDN: http://msdn.microsoft.com/en-us/library/ms632679(VS.85).aspxScript I'm trying to get working:expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> $Gui = GUICreate("bla",400,400) GUISetState() $Gui = HWnd($Gui) $Class = _WinAPI_GetClassName($Gui) $Hwnd = _WinAPI_CreateWindow($Class, "Title", 0, 10, 10, 100, 100, $Gui) MsgBox(0,"sdsd",$Hwnd) _WinAPI_ShowWindow($Hwnd, @SW_SHOW) While 1 WEnd #CS HWND CreateWindow( LPCTSTR lpClassName, str LPCTSTR lpWindowName, str DWORD dwStyle, int int x, int int y, int int nWidth, int int nHeight, int HWND hWndParent, hwnd HMENU hMenu, hwnd HINSTANCE hInstance, hwnd LPVOID lpParam ptr ); #CE Func _WinAPI_CreateWindow($sClass, $sName, $iStyle, $iX, $iY, $iWidth, $iHeight, $hParent, $hMenu = 0, $hInstance = 0, $pParam = 0) Local $aResult If $hInstance = 0 Then $hInstance = _WinAPI_GetModuleHandle("") $aResult = DllCall("User32.dll", "hwnd", "CreateWindow", _ "str", $sClass, _ "str", $sName, _ "int", $iStyle, _ "int", $iX, _ "int", $iY, _ "int", $iWidth, _ "int", $iHeight, _ "hwnd", $hParent, _ "hwnd", $hMenu, _ "hwnd", $hInstance, _ "ptr", $pParam) Return $aResult[0] EndFunc;==>_WinAPI_CreateWindowEx@Error keeps saying that the function doesn't exist.Does anyone know how I can get this working? Thanks. Edited May 31, 2008 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Siao Posted May 31, 2008 Posted May 31, 2008 (edited) @Error keeps saying that the function doesn't exist.Does anyone know how I can get this working?If it says the function doesn't exist, it means the function doesn't exist. There's nothing to get working. Simple as that.Examining user32.dll with any PE editor capable of showing DLL exports would confirm this. Edited May 31, 2008 by Siao "be smart, drink your wine"
ProgAndy Posted May 31, 2008 Posted May 31, 2008 Just use CreateWindowEx and set ExStyle to 0 (zero) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Kip Posted May 31, 2008 Author Posted May 31, 2008 Just use CreateWindowEx and set ExStyle to 0 (zero)That was just an example, what if i want other functions. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Kip Posted May 31, 2008 Author Posted May 31, 2008 This is the same, the function does exist. But the return value is 0x00000000: expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> $Gui = GUICreate("bla",400,400,-1,-1,$WS_CLIPCHILDREN) GUISetState() $Gui = HWnd($Gui) $Class = _WinAPI_GetClassName($Gui) $Hwnd = CreateMDIWindow($Class, "Title", 0, 10, 10, 100, 100, $Gui) MsgBox(0,"sdsd",$Hwnd) _WinAPI_ShowWindow($Hwnd, @SW_SHOW) While 1 WEnd #CS HWND CreateMDIWindow( LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HINSTANCE hInstance, LPARAM lParam ); #CE Func CreateMDIWindow($sClass, $sName, $iStyle, $iX, $iY, $iWidth, $iHeight, $hParent, $hInstance = 0, $pParam = 0) Local $aResult If $hInstance = 0 Then $hInstance = _WinAPI_GetModuleHandle("") $aResult = DllCall("User32.dll", "hwnd", "CreateMDIWindow", _ "str", $sClass, _ "str", $sName, _ "int", $iStyle, _ "int", $iX, _ "int", $iY, _ "int", $iWidth, _ "int", $iHeight, _ "hwnd", $hParent, _ "hwnd", $hInstance, _ "ptr", $pParam) Return $aResult[0] EndFunc;==>_WinAPI_CreateWindowEx MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 Did you register the class before making the MDI (Or at least use a standard class)? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Kip Posted May 31, 2008 Author Posted May 31, 2008 I take the class from the standard gui. That also works with CreateWindowEx(). MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 I take the class from the standard gui. That also works with CreateWindowEx().I'm familiar with how it works for standard windows... but I know whenever I do this in other languages, I register a class and an event function before I create it.If you check kernel32's GetLastError after you call the dll, you may be able to help yourself there. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Kip Posted May 31, 2008 Author Posted May 31, 2008 then i get an error code... I don't know what that code means. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 then i get an error code... I don't know what that code means.There's a link there on msdn System Error Codes that would show you what it means.http://msdn.microsoft.com/en-us/library/ms681382(VS.85).aspx Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Kip Posted May 31, 2008 Author Posted May 31, 2008 Ok, thanx. I'll try that. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Greenhorn Posted May 31, 2008 Posted May 31, 2008 It's not so easy to create MDI Child Windows in AutoIt ...Please take a look at here -> http://msdn.microsoft.com/en-us/library/ms644909(VS.85).aspxFor an example how to create and register window classes in AutoIt take a look at here -> http://www.autoitscript.com/forum/index.ph...hl=window+classhttp://www.autoit.de/index.php?page=Thread&threadID=6339GreetzGreenhorn
Kip Posted June 4, 2008 Author Posted June 4, 2008 I got a very simple function working $Ret = _MessageBox("hi",0,0,4) _MessageBox($Ret) Func _MessageBox($Text, $Title="", $Hwnd=0, $Style=0) $iRet = DllCall("User32.dll","int","MessageBox","hwnd",$Hwnd,"str",$Text,"str",$Title,"uint",$Style) if not @error Then Return $iRet[0] EndFunc MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
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