Jump to content

Recommended Posts

Posted

Hi,

I know (or i think i know) that window classname should be registered, so the system will recognize the window.

So basicaly my question is how to register that classname, or should i looking into different direction to find the right answer?

I need to create a window using API, i know i can create it with "AutoIt v3 GUI" CLASS, but when i set other class then this, the window isn't created.

The reason i need this is simple - i want to be able set interaction between my application, and some external app, and if i can create a window with custom (unique) classname, then it will be much reliable for other apps to communicate with my app :)

Here is an example of creating window via API:

#include <GUIConstants.au3>

$iXPos = (@DesktopWidth - 300) / 2
$iYPos = (@DesktopHeight - 120) / 2

$iStyle = BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)

$aRet = DllCall("USER32.DLL", "hwnd", "CreateWindowEx", "long", 0, "str", "AutoIt v3 GUI", "str", "My Custom GUI", _
        "long", $iStyle, "int", $iXPos, "int", $iYPos, "int", 300, "int", 120, _
        "hwnd", 0, "hwnd", 0, "long", 0, "ptr", 0)

WinSetState($aRet[0], "", @SW_SHOW)

While WinExists($aRet[0])
    Sleep(10)
WEnd

Original example is by Smoke_N :).

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

CWndClassInfo

http://msdn2.microsoft.com/en-us/library/x...b7b(VS.80).aspx

Once you find a way to register your Window Class, you should update that script above and use _WinAPI_CreateWindowEx() in the helpfile instead.

Edited by Ealric

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Posted

Thanks for repplying.

I found a prety good example on the MSDN, my intuition tells me that this is what i need, i just wish i could translate it to AutoIt... or... maybe someone else can? :)

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

Thanks for repplying.

I found a prety good example on the MSDN, my intuition tells me that this is what i need, i just wish i could translate it to AutoIt... or... maybe someone else can? :)

I just edited my post above. You should be using CWndClassInfo Class instead to register.

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

  • Moderators
Posted (edited)

I just edited my post above. You should be using CWndClassInfo Class instead to register.

Allows you to specify the name of a new window class. Place this macro in an ATL ActiveX control's control class

Requirements

Header: atlwin.h

How do you expect to use that in AutoIt?

Edit:

@MsCreatoR

I assume you got that from here: http://www.autoitscript.com/forum/index.ph...st&p=495405

I'm pretty sure at the bottom of that I gave you the info to look for to register the class.

Edited by SmOke_N

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.

Posted

How do you expect to use that in AutoIt?

Well the formula..

$x = "Too many firefox tabs and reading wrong information"

$y = "No lunch yet"

$z = "Diabetic"

$var = $x+$y+$z

Func _brainsaturation($var)

msgbox(0,"here is your answer","wrong!")

endfunc

That should clear it all up. :)

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Posted

I need someone to show me how to use MSDN info! :)

I spent a last few hours trying to use CallWindowProc, RegisterClass/Ex, CreateWindow/Ex, structures... :)

This not supose to be so difficult, i am feeling that i can solve this puzzle, but i just miss some part here... maybe a part from my brain? :party:

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

Here is a solution (by amel27):

#include <WinAPI.au3>
#include <GUIConstants.au3>

Global Const $CS_VREDRAW = 1
Global Const $CS_HREDRAW = 2
Global Const $IDI_APPLICATION = 32512
Global Const $WHITE_BRUSH = 0
Global Const $CW_USEDEFAULT = 0x80000000

Global $hMsgHelloWndProc

$hWndMain = GUICreate("My GUI")
GUISetState (@SW_SHOW)

; Creating and registring the class
$iRet = MsgHelloReg("HelloMsg", $hMsgHelloWndProc)

; Creating and activating a class example
$hWndHello = _WinAPI_CreateWindowEx(0, "HelloMsg", "Hello Application", _
    $WS_OVERLAPPEDWINDOW, $CW_USEDEFAULT, 0, $CW_USEDEFAULT, 0, $hWndMain, 0, _WinAPI_GetModuleHandle(""), 0)
$iRet = _WinAPI_ShowWindow($hWndHello)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

; Unregistering the class before exit
$iRet = MsgHelloUnReg("HelloMsg", $hMsgHelloWndProc)


; UDF to create and register our class
Func MsgHelloReg($sClassName, ByRef $hWndProc)
    ; selecting icons and cursors (there is many choices)
    Local $aIcon = DllCall("user32.dll", "hwnd", "LoadIcon", "hwnd", 0, "int", $IDI_APPLICATION)
    Local $aCursor = DllCall("user32.dll", "hwnd", "LoadCursor", "hwnd", 0, "int", $IDC_ARROW)
    ; Registering window processing as CallBack-function
    $hWndProc = DLLCallbackRegister ("MsgHelloWndProc", "int", "hwnd;int;wparam;lparam")
    ;Creating and initializing class structures
    Local $tWndClassEx = DllStructCreate("uint cbSize;uint style;ptr lpfnWndProc;int cbClsExtra;int cbWndExtra;hwnd hInstance;hwnd hIcon;hwnd hCursor;hwnd hbrBackground;ptr lpszMenuName;ptr lpszClassName;hwnd hIconSm")
    Local $tClassName = DllStructCreate("char["& StringLen($sClassName)+1 &"]")
    DllStructSetData($tClassName, 1, $sClassName)

    DllStructSetData($tWndClassEx, "cbSize", DllStructGetSize($tWndClassEx) )
    DllStructSetData($tWndClassEx, "style", BitOR($CS_VREDRAW, $CS_HREDRAW) )
    DllStructSetData($tWndClassEx, "lpfnWndProc", DllCallbackGetPtr($hWndProc))
    DllStructSetData($tWndClassEx, "hInstance", _WinAPI_GetModuleHandle(""))
    DllStructSetData($tWndClassEx, "hIcon", $aIcon[0])
    DllStructSetData($tWndClassEx, "hCursor", $aCursor[0])
    DllStructSetData($tWndClassEx, "hbrBackground", _WinAPI_GetStockObject($WHITE_BRUSH))
    DllStructSetData($tWndClassEx, "lpszClassName", DllStructGetPtr($tClassName))
    DllStructSetData($tWndClassEx, "hIconSm", $aIcon[0])
    ; Registering process
    Local $aRet = DllCall("user32.dll", "dword", "RegisterClassExA", "ptr", DllStructGetPtr($tWndClassEx) )
    Return $aRet[0]
EndFunc ; ==> MsgHelloReg

; UDF to unregister the class (there should not be a copy of the class)

Func MsgHelloUnReg($sClassName, ByRef $hWndProc)
    DllCallbackFree($hWndProc)
    Local $aRet = DllCall("user32.dll", "int", "UnregisterClassA", "str", $sClassName, "hwnd", _WinAPI_GetModuleHandle(""))
    Return $aRet[0]
EndFunc ; ==> MsgHelloUnReg

; Window processing of our window class
Func MsgHelloWndProc($hWnd, $uMsg, $wParam, $lParam)
    Local $aRet, $iRet, $hDC, $tRect, $sDrawText = "Hello, World!"
    Switch $uMsg
        Case $WM_PAINT
            $hDC = _WinAPI_GetDC($hWnd) ; Getting context device
            $tRect = _WinAPI_GetClientRect($hWnd) ; Getting client area coords
            $aRet = DllCall("user32.dll", "int", "ValidateRect", "hwnd", $hWnd, "ptr", DllStructGetPtr($tRect) ) ; Make the area "valid"
            ; Here we draw the window
            $aRet = DllCall("user32.dll", "int", "FillRect", "hwnd", $hDC, "ptr", DllStructGetPtr($tRect), "hwnd", _WinAPI_GetStockObject($WHITE_BRUSH) )
            $iRet = _WinAPI_DrawText($hDC, $sDrawText, $tRect, BitOR($DT_SINGLELINE, $DT_CENTER, $DT_VCENTER))
            ; Releasing context device
            _WinAPI_ReleaseDC($hWnd, $hDC)
        Case $WM_CLOSE
            _WinAPI_DestroyWindow($hWnd)
        Case $WM_DESTROY
;           $aRet = DllCall("user32.dll", "none", "PostQuitMessage", "int", 0 )
        Case Else
            Return _WinAPI_DefWindowProc($hWnd, $uMsg, $wParam, $lParam) ; Set default window processing
    EndSwitch
    Return 0
EndFunc ; ==> MsgHelloWndProc

But there is one problem - the WM_PAINT procedure should be done using BeginPaint / EndPaint (not manualy as in this example), but the BeginPaint does not return a device context and not fill the PAINTSTRUCT structure.

Here is the procedure on C/C++, maybe someone could look at it and make it work with AutoIt...

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    HDC hDC;
    PAINTSTRUCT ps;
    RECT rect;

    switch (msg)
    {
    case WM_PAINT:
        hDC = BeginPaint(hWnd, &ps);

        GetClientRect(hWnd, &rect);
        DrawText(hDC, "Hello, World!", -1, &rect,
            DT_SINGLELINE | DT_CENTER | DT_VCENTER );
        
        EndPaint(hWnd, &ps);
        return 0;

    case WM_CLOSE:
        DestroyWindow(hWnd);
        return 0;

    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;

    default:
        return DefWindowProc(hWnd, msg, wParam, lParam);
    }

    return 0;
}

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

Hi,

don't know what you exactly mean ...

In a WM_PAINT-case you have to use BeginPaint and EndPaint.

BeginPaint always returns a handle to the Device Context of the window and you need a tagPAINTSTRUCT, but I don't know how to do it.

typedef struct tagPAINTSTRUCT
 {
 HDC hdc;
 BOOL Erase;
 RECT rcPaint;
 BOOL fRestore;
 BOOL fIncUpdate;
 BYTE rgbReserved[32];
 } PAINTSTRUCT;

GetDC is not used in WM_PAINT !

; No idea how to create this.
$tagPAINTSTRUCT = DllStructCreate('hwnd hDC;int fErase;??? rcPaint;int fRestore;int fIncUpdate;byte rgbReserved[32]', $lpPAINTSTRUCT)oÝ÷ Ù«­¢+Øì]¥¹½ÜÁɽÍÍ¥¹½½ÕÈÝ¥¹½Ü±ÍÌ)Õ¹5Í!±±½]¹Aɽ ÀÌØí¡]¹°ÀÌØíÕ5Í°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤((1½°ÀÌØíÑA%9QMQIU
Pô±±MÑÉÕÑ
ÉÑ Ìäí¡Ý¹¡í¥¹ÐÉÍìüüüÉA¥¹Ðí¥¹ÐIÍѽÉí¥¹Ð%¹UÁÑíåÑÉIÍÉÙlÌÉtÌäì¤(1½°ÀÌØíIаÀÌØí¥IаÀÌØí¡°ÀÌØíÑIаÀÌØíÍÉÝQáÐôÅÕ½Ðí!±±¼°]½É±ÌÌìÅÕ½Ðì(MÝ¥Ñ ÀÌØíÕ5Í(
ÍÀÌØí]5}A%9P(ÀÌØí¡ô  ¥¹A¥¹Ð ÀÌØí¡]¹°ÀÌØí±ÁA¥¹Ð¤ìÑÑ¥¹½¹ÑáÐÙ¥(ÀÌØíÑIÐô}]¥¹A%}Ñ
±¥¹ÑIÐ ÀÌØí¡]¹¤ìÑÑ¥¹±¥¹Ðɽ½ÉÌ(ÀÌØí¥IÐô}]¥¹A%}ÉÝQáÐ ÀÌØí¡°ÀÌØíÍÉÝQáаÀÌØíÑIа  ¥Ñ=H ÀÌØíQ}M%911%9°ÀÌØíQ}
9QH°ÀÌØíQ}Y
9QH¤¤(¹A¥¹Ð ÀÌØí¡]¹°ÀÌØí±ÁA¥¹Ð¤(
ÍÀÌØí]5}
1=M(}]¥¹A%}ÍÑɽå]¥¹½Ü ÀÌØí¡]¹¤(
ÍÀÌØí]5}MQI=d(ÀÌØíIÐô±±
±° ÅÕ½ÐíÕÍÈÌȹ±°ÅÕ½Ðì°ÅÕ½Ðí¹½¹ÅÕ½Ðì°ÅÕ½ÐíA½ÍÑEÕ¥Ñ5ÍÍÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°À¤(
ͱÍ(IÑÕɸ}]¥¹A%}]¥¹½ÝAɽ ÀÌØí¡]¹°ÀÌØíÕ5Í°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤ìMÐÕ±ÐÝ¥¹½ÜÁɽÍÍ¥¹(¹MÝ¥Ñ (IÑÕɸ}]¥¹A%}]¥¹½ÝAɽ ÀÌØí¡]¹°ÀÌØíÕ5Í°ÀÌØíÝAÉ´°ÀÌØí±AÉ´¤ìMÐÕ±ÐÝ¥¹½ÜÁɽÍÍ¥¹()¹Õ¹ìôôÐì5Í!±±½]¹Aɽ((ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ì  ¥¹A¥¹Ð ÀÌØí¡]¹°ÀÌØí±ÁA¥¹Ð¤(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)Õ¹    ¥¹A¥¹Ð ÀÌØí¡]¹°ÀÌØí±ÁA¥¹Ð¤((1½°ÀÌØíIÍÕ±Ðô±±
±° ÌäíÕÍÈÌȹ±°Ìäì°Ìäí¡Ý¹Ìäì°Ìäí   ¥¹A¥¹ÐÌäì°Ìäí¡Ý¹Ìäì°ÀÌØí¡]¹°ÌäíÁÑÈÌäì°ÀÌØí±ÁA¥¹Ð¤(IÑÕɸÀÌØíIÍÕ±ÑlÁt()¹Õ¹(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô(ì¹A¥¹Ð ÀÌØí¡]¹°ÀÌØí±ÁA¥¹Ð¤(ìôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôôô)Õ¹¹A¥¹Ð ÀÌØí¡]¹°ÀÌØí±ÁA¥¹Ð¤((1½°ÀÌØíIÍÕ±Ðô±±
±° ÌäíÕÍÈÌȹ±°Ìäì°Ìäí¡Ý¹Ìäì°Ìäí¹A¥¹ÐÌäì°Ìäí¡Ý¹Ìäì°ÀÌØí¡]¹°ÌäíÁÑÈÌäì°ÀÌØí±ÁA¥¹Ð¤(IÑÕɸÀÌØíIÍÕ±ÑlÁt()¹Õ¹

It would be nice, if somebody could help us to create the tagPAINTSTRUCT ... :)

Greetz

Greenhorn

Edited by Greenhorn
Posted

Here it is:

; Window processing of our window class
Func MsgHelloWndProc($hWnd, $uMsg, $wParam, $lParam)
    Local $aRet, $iRet, $hDC, $tRect, $sDrawText = "Hello, World!"
    Switch $uMsg
        Case $WM_PAINT
            $stPaint = DllStructCreate("int;int;long;long;long;long;int;int;byte[32]")
            $ahDC = DllCall("user32.dll", "int", "BeginPaint", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPaint))

            $tRect = _WinAPI_GetClientRect($hWnd)

            _WinAPI_DrawText($ahDC[0], $sDrawText, $tRect, BitOR($DT_SINGLELINE, $DT_CENTER, $DT_VCENTER))

            DllCall("user32.dll", "int", "EndPaint", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPaint))
        Case $WM_CLOSE
            _WinAPI_DestroyWindow($hWnd)
        Case $WM_DESTROY
;           $aRet = DllCall("user32.dll", "none", "PostQuitMessage", "int", 0 )
        Case Else
            Return _WinAPI_DefWindowProc($hWnd, $uMsg, $wParam, $lParam) ; Set default window processing
    EndSwitch
    Return 0
EndFunc ; ==> MsgHelloWndProc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted (edited)

But it's still a little bit buggy ... :)

I have problems to quit the application. The TrayIcon contextmenu is not always working correctly.

...

And I'm still confused about DllStructCreate ...

Greetz

Greenhorn

Edited by Greenhorn
  • 6 years later...
Posted (edited)

Could you control the codes for AutoIt's last version? I've tried the codes but when I changed "AutoIt v3 GUI", the program was starting not working.

Edited by sanaldosya
Posted

This thread is 6 years old the code in it probably doesn't work with a newer version.

If you have a problem the best thing to do would be to open a new thread explaining what it is you are having a problem with rather than posting in such an old thread with a post that doesn't contain any information that would allow anyone to help you.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...