블로그 이미지
Every unexpected event is a path to learning for you. blueasa

카테고리

분류 전체보기 (2809)
Unity3D (865)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (234)
협업 (61)
3DS Max (3)
Game (12)
Utility (140)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
Android (16)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

Introducing the Leap

Interest / 2012. 5. 22. 11:37



헐!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


일정영역에 들어간 손가락이 세밀하게 다 나오는거보니 손가락을 확실히 인식 하는 것 같은데..

멋지다~!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

어떻게 하는거지~!!

반응형

'Interest' 카테고리의 다른 글

선물 받은 컵!!  (2) 2012.06.12
일본 다이하츠 코펜 경차사진  (3) 2012.06.05
디아블로3 한정판 집에서 뜯고 한 컷..  (0) 2012.05.16
디아블로3 한정판 도착~  (0) 2012.05.16
디아블로3 한정판 구매 성공!!  (0) 2012.05.15
Posted by blueasa
, |


Diablo III AutoLogin.exe


Diablo III AutoLogin.zip









친절한티스님이 WPF로 디아블로3 자동 로그인 프로그램(http://gamedevforever.com/189) 만든 걸 올려주셨길래 공부할 겸 따라 만들어 봤는데..


C#이랑 별반 다를 게 없을 줄 알았는데, 생각외로 다른게 너무 많은 것 같다.. =_=


이런저런 삽질 끝에 이틀만에 마구 때려 넣어서 만들어서 올려 봄..

(혹시나 실행파일 안받아 지는 분을 위해 압축해서도 올려놓습니다. 둘 중 하나만 받으면 되요.)


기본적으로 친절한티스님의 형식대로 따라 만들었고,


WPF 공부할 겸 만든거라 딜레이는 슬라이드바로 만들었으며, 패스워드는 보이면 안될 것 같아서 PasswordBox로 만들었다.


나중엔 Blend도 배워서 이쁘게 꾸며보고 싶다.



P.s. 친절한티스님 감사합니다. 덕분에 WPF 맛을 좀 본 것 같아요. :)



추가 : 해상도마다 위치가 약간씩 틀려서 해상도 추가했습니다.


다른 넣고 싶은건 다음기회에..

반응형

'잉여 프로젝트' 카테고리의 다른 글

W.O.W(World Of Warcraft) 접속유지 프로그램  (0) 2011.05.03
Posted by blueasa
, |

WPF 속성은 왜이럴까..


창 크기 고정하기 위해서 옵션을 찾아봤지만 별달리 C# 비슷한게 안보여서..


최소/최대 크기를 같게 해줘보니 고정된다..;;





아직은 WPF 초보라..


우선 되는 방법으로 해놔야지..


나중에 다른 좋은방법 찾으면 바꿔야겠다.



[추가]

지나가는 나그네      

xaml 코드에서 ResizeMode="NoResize" 를 추가하시면 간단하게 됩니다.


반응형
Posted by blueasa
, |




WPF로 이리저리 만들고 이벤트를 추가하려고 C#에서 하듯이 '속성-이벤트' 에서 더블클릭을 했는데,


위 창과같은 팝업창이 뜨면서 이벤트 생성이 실패 했다고 떴다.


처음 보는 황당한 에러에 좀 당황하다가..


자세히 읽어보니 [파일의 첫 번째 클래스여야 합니다.] 라는 글귀가 눈에 들어왔다.


간단히 만들어본다고 한 파일에 클래스를 여러개 넣으면서


버릇대로 메인 클래스에 들어갈 클래스를 메인 클래스의 위에 넣었더니 저런 에러가 떠버렸다.


그래서 메인 클래스의 아래로 모든 클래스를 옮겼더니 이벤트 생성이 잘 된다.


WPF는 이런것도 신경 써야되는구나..


(C#도 같은 에러가 나는데 내가 못겪은걸까..? 나중에 테스트 해봐야지..)

반응형

'Programming > WPF' 카테고리의 다른 글

창크기 고정(조절 막기)  (2) 2012.05.22
DispatcherTimer in WPF  (0) 2012.05.21
using 추가해야 될 것 들..  (0) 2012.05.21
WPF 강좌 링크  (0) 2012.03.07
Posted by blueasa
, |

mouse_event (user32)

Programming/C# / 2012. 5. 21. 17:12

Summary
The mouse_event API

C# Signature:

[DllImport("user32.dll")]
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
   UIntPtr dwExtraInfo);

or

[DllImport("user32.dll")]
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
  int dwExtraInfo);

Note that for non-relative mouse movement (i.e. if MOUSEEVENTF_ABSOLUTE is not specified as part of dwFlags), negative values for dx and dy are desirable. As such, the "uint" type specification for C# can be safely replaced with Int32.

User-Defined Types:

  [Flags]
  public enum MouseEventFlags : uint
  {
    LEFTDOWN   = 0x00000002,
    LEFTUP     = 0x00000004,
    MIDDLEDOWN = 0x00000020,
    MIDDLEUP   = 0x00000040,
    MOVE       = 0x00000001,
    ABSOLUTE   = 0x00008000,
    RIGHTDOWN  = 0x00000008,
    RIGHTUP    = 0x00000010,
    WHEEL      = 0x00000800,
    XDOWN      = 0x00000080,
    XUP    = 0x00000100
  }

  //Use the values of this enum for the 'dwData' parameter
  //to specify an X button when using MouseEventFlags.XDOWN or
  //MouseEventFlags.XUP for the dwFlags parameter.
  public enum MouseEventDataXButtons : uint
  {
    XBUTTON1   = 0x00000001,
    XBUTTON2   = 0x00000002
  }

VB.Net Signature:

This function does indeed return a value, just as the keybd_event API does.

If there is a real error, it will in fact return a value of false, or zero.

The dwExtraInfo appears to be a ULONG_PTR in C++ (IntPtr in VB.NET)

Declare Function apimouse_event Lib "user32.dll" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dX As Int32, ByVal dY As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32) As Boolean

Notes:

FYI, Microsoft tells us for "Windows NT/2000/XP: This function has been superseded. Use SendInput instead."

The C# code below works fine. However you have to keep in mind to add the namespace "System.Runtime.InteropServices" and keep in mind to write the code into a class.

Original contributor tells us:aa

I wanted to emulate the scroll. Searching for this information wasn't easy ... but here is how you do the mouse scroll button

dim ScrollValue as Integer

ScrollValue = 120 'or -120 for up or down scrolling

mouse_event(&H800, 0, 0, ScrollValue, 0)

Tips & Tricks:

Another contributor tells us:

The scroll value can actually be any value larger than 1, if used within a loop.

This allows you to smoothly increment the scrollbar, instead of relying on the inconsistent wheel delta,

which is a variable limited by the user, for mouse wheel. Start-Control Panel-Mouse-Wheel-Scrolling

VB.NET Sample Code:

    Const MOUSEEVENTF_WHEEL As Int32 = 2048
    Const MOUSEEVENTF_WHEEL_DELTA As Int32 = 120

    Private Declare Function apimouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dX As Int32, ByVal dY As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32) As Boolean
    Private Declare Function apiGetMessageExtraInfo Lib "user32" Alias "GetMessageExtraInfo" () As Int32

    Private Sub PlayScroll(ByVal number As Int32, Optional ByVal increment As Int32 = 2)
    On Error Resume Next
    For i As Int32 = 1 To number
        apimouse_event(MOUSEEVENTF_WHEEL, 0, 0, increment, apiGetMessageExtraInfo)
    Next
    End Sub

C# Sample Code:

    [DllImport("user32.dll")]
    static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo);

    [Flags]
    public enum MouseEventFlags
    {
        LEFTDOWN = 0x00000002,
        LEFTUP = 0x00000004,
        MIDDLEDOWN = 0x00000020,
        MIDDLEUP = 0x00000040,
        MOVE = 0x00000001,
        ABSOLUTE = 0x00008000,
        RIGHTDOWN = 0x00000008,
        RIGHTUP = 0x00000010
    }

    public static void LeftClick(int x, int y)
    {
        Cursor.Position = new System.Drawing.Point(x, y);
        mouse_event((int)(MouseEventFlags.LEFTDOWN), 0, 0, 0, 0);
        mouse_event((int)(MouseEventFlags.LEFTUP), 0, 0, 0, 0);
    }

VB.NET 2005 Sample Code:

Based on http://vb-helper.com/howto_move_click_mouse.html

This code assumes a form called frmMain with a command button called cmdClick a picture box called picClicker and a text box called txtResults

Note Twips are no more. Also, I stripped the FOR loop of delta moves from the command button click to the middle of the picture box.

Option Explicit On

Friend Class frmMain

    Inherits System.Windows.Forms.Form

    Declare Auto Sub mouse_event Lib "user32" (ByVal dwFlags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As IntPtr)

    Const MOUSEEVENTF_MOVE As Int32 = &H1 '  mouse move
    Const MOUSEEVENTF_LEFTDOWN As Int32 = &H2 '  left button down
    Const MOUSEEVENTF_LEFTUP As Int32 = &H4 '  left button up
    Const MOUSEEVENTF_RIGHTDOWN As Int32 = &H8 '  right button down
    Const MOUSEEVENTF_RIGHTUP As Int32 = &H10 '  right button up
    Const MOUSEEVENTF_MIDDLEDOWN As Int32 = &H20 '  middle button down
    Const MOUSEEVENTF_MIDDLEUP As Int32 = &H40 '  middle button up
    Const MOUSEEVENTF_ABSOLUTE As Int32 = &H8000 '  absolute move
    Const MOUSEEVENTF_WHEEL As Int32 = &H800 ' wheel button rolled

    ' Simulate moving the mouse to the center of the
    ' PictureBox and clicking.
    Private Sub cmdClick_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdClick.Click
    Dim cur_x As Single
    Dim cur_y As Single
    Dim dest_x As Single
    Dim dest_y As Single

    ' mouse_event moves in a coordinate system where
    ' (0, 0) is in the upper left corner and
    ' (65535,65535) is in the lower right corner.

    ' Get the current mouse coordinates and convert
    ' them into this new system.
    cur_x = System.Windows.Forms.Cursor.Position.X * 65535 / System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
    cur_y = System.Windows.Forms.Cursor.Position.Y * 65535 / System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height

    ' Convert the coordinates of the center of the
    ' picClicker PictureBox into this new system.
    Dim pt As Point = picClicker.PointToScreen(New Point(picClicker.ClientRectangle.Width / 2, picClicker.ClientRectangle.Height / 2))

    dest_x = pt.X * 65535 / System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
    dest_y = pt.Y * 65535 / System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height

    txtResults.Text = txtResults.Text & "From " & System.Windows.Forms.Cursor.Position.X & " " & System.Windows.Forms.Cursor.Position.Y & " to " & pt.X & " " & pt.Y & vbCrLf
    txtResults.Text = txtResults.Text & "From " & cur_x & " " & cur_y & " to " & dest_x & " " & dest_y & vbCrLf

    ' Move the mouse to its final destination and click it.
    mouse_event(MOUSEEVENTF_ABSOLUTE + MOUSEEVENTF_MOVE + MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, dest_x, dest_y, 0, 0)
    End Sub

    Private Sub picClicker_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles picClicker.Click
    txtResults.Text = txtResults.Text & "MouseClick" & vbCrLf
    End Sub

    Private Sub picClicker_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picClicker.MouseDown
    txtResults.Text = txtResults.Text & "MouseDown (" & e.X & ", " & e.Y & ")" & vbCrLf
    End Sub

    Private Sub picClicker_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles picClicker.MouseUp
    txtResults.Text = txtResults.Text & "MouseUp (" & e.X & ", " & e.Y & ")" & vbCrLf
    End Sub

End Class

Alternative Managed API:

Per http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/win32map.asp , mouse_event is supposed to be replaced by .NET Framework API System.Windows.Forms.MouseEventArgs but this is not the case. MouseEventArgs is just a data structure w/out event capability. I tried to get:

Dim eMouse As New System.Windows.Forms.MouseEventArgs(Windows.Forms.MouseButtons.Left, 1, pt.X, pt.Y, 0)

Me.OnMouseDown(eMouse)

Me.OnMouseMove(eMouse)

Me.OnMouseUp(eMouse)

to work as desired. Although it did trigger mouse events in the form showing the movement and click action desired, it didn't move the mouse pointer on the screen nor did it trigger events in the picture box located at pt.X, pt.Y

Thus I have resigned myself to unmanaged code for now. I will post the SendInput version shortly as mouse_event has been deprecated by Bill in favor ofSendInput.

As the original contributor noted:

You can use the System.Windows.Forms.Cursor.Position property to set the position of the mouse, if you would like.

You will note I have replaced the GetCursorPos calls in the original VB source with this as suggested in the MSDN URL I mention above.

Documentation
mouse_event on MSDN




반응형
Posted by blueasa
, |

http://rosettacode.org/wiki/Category:Programming_Tasks

예를 들어, c++에서 자주 쓰던 함수가 있는데, MaxScript에서는 어떻게 해야 될지 모르겠다.
그럴 때 유용한 사이트입니다.


출처 : 
http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&page_num=35&select_arrange=last_comment&desc=desc&sn=off&ss=on&sc=on&keyword=&no=253&category=

반응형
Posted by blueasa
, |

keybd_event (user32)

Programming/C# / 2012. 5. 21. 11:48

KEYEVENTF_KEYUP 상수 찾다가 발견..


도움 될 것 같아서 퍼옴..



Summary
This function is useful to simulate Key presses to the window with focus.

It will return a value of false, if there is an error simulating the key press.

C# Signature:

[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags,
   UIntPtr dwExtraInfo);

or

[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags,
   int dwExtraInfo);

VB Signature:

<DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall, _
           CharSet:=CharSet.Unicode, EntryPoint:="keybd_event", _
           ExactSpelling:=True, SetLastError:=True)> _
Public Shared Function keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, _
                              ByVal dwFlags As Int32, ByVal dwExtraInfo As Int32) As Boolean
End Function

User-Defined Types:

None

Notes:

None.

Tips & Tricks:

This function is useful to simulate Key presses (for input use the virtual keycodes from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp or windows CE universal core virtual key code compact charthttp://msdn2.microsoft.com/en-us/library/ms927178.aspx ).

Use FindWindow and SetForegroundWindow to direct input to the desired window.

Note
WaitForInputIdle (Warning this will only wait once! See Raymond Chen's Blog Post http://blogs.msdn.com/b/oldnewthing/archive/2010/03/25/9984720.aspx ), or a Sleep may be required to assure Window is ready for input:

  RUN('NOTEPAD.EXE')
  Sleep(2000,0)
  SetForegroundWindow (FindWindow('Untitled - Notepad'))

(see also VkKeyScan):

    void PressKey( byte keyCode )
    {
        const int KEYEVENTF_EXTENDEDKEY = 0x1;
        const int KEYEVENTF_KEYUP       = 0x2;
        keybd_event( keyCode, 0x45, KEYEVENTF_EXTENDEDKEY, 0 );
        keybd_event( keyCode, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
    }

Sample Code:

VB Sample:

This sample will generate a 'Scroll Lock' key press event when the user clicks 'Button1'.

  • Create a new Windows Application project;
  • Drop a button control in the recently created form;
  • Add the following code to the form class:

Imports System.Runtime.InteropServices

Public Class Form1

    <DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall, _
           CharSet:=CharSet.Unicode, EntryPoint:="keybd_event", _
           ExactSpelling:=True, SetLastError:=True)> _
    Public Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, _
                                  ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer) As Boolean
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Const VK_SCROLL As Byte = &H91
        Const KEYEVENTF_KEYUP As Byte = &H2

        keybd_event(VK_SCROLL, 0, 0, 0)               ' Generates a KEY_DOWN
        keybd_event(VK_SCROLL, 0, KEYEVENTF_KEYUP, 0) ' Generates a KEY_UP

    End Sub

End Class

Please add some more!

Alternative Managed API: System.Windows.Forms.SendKeys

Documentation
keybd_event on MSDN

PROBLEM: How do i use combination of shift and tab keys at the same time ?

Answer:posted by dokks http://www.ravensmyst.com

define the shift key as a const

    public const byte VK_LSHIFT= 0xA0; // left shift key
    public const byte VK_TAB = 0x09;
    public const int KEYEVENTF_EXTENDEDKEY = 0x01;
    public const int KEYEVENTF_KEYUP = 0x02;

    //press the shift key
    keybd_event(VK_LSHIFT, 0x45, 0, 0);

    //press the tab key
    keybd_event(VK_TAB, 0x45, 0, 0);

    //release the tab key
    keybd_event(VK_TAB, 0x45, KEYEVENTF_KEYUP, 0);

    //release the shift key
    keybd_event(VK_LSHIFT, 0x45, KEYEVENTF_KEYUP, 0);

I'm using this to create automated UI testing for a custom Textbox control. After a lot of trial and error the following code worked well for me.

    public partial class Form2 : Form
    {
    [DllImport("user32.dll", SetLastError = true)]
    static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);

    Keys[] numberKeys = new Keys[10] { Keys.D0, Keys.D1, Keys.D2, Keys.D3, Keys.D4, Keys.D5, Keys.D6, Keys.D7, Keys.D8, Keys.D9 };

    void PressKey(Keys key)
    {
        const int KEYEVENTF_EXTENDEDKEY = 0x1;
        const int KEYEVENTF_KEYUP = 0x2;
        // I had some Compile errors until I Casted the final 0 to UIntPtr like this...
        keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0);
        keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0);
    }

    void PressKeyArray(Keys[] keys)
    {
        foreach (Keys key in keys)
        {
        PressKey(key);
        }
    }

    private void Compare(object sender, string expected, string actual)
    {
        Button ClickedButton = (Button)sender;

        if (expected == actual)
        ClickedButton.Text = "Pass";
        else
        ClickedButton.Text = "Fail";
    }

    private void buttonNumericAccept_Click(object sender, EventArgs e)
    {
        string expected = "0123456789";

        NumericTextbox.AcceptNumeric = true;

        //
        // Send Appropriate Key Presses
        //
        NumericTextbox.Focus();
        PressKeyArray(numberKeys);
        Application.DoEvents();

        // Process Results        
        Compare(sender, expected, NumericTextbox.Text);        
    }
    }



출처 : http://www.pinvoke.net/default.aspx/user32.keybd_event

반응형
Posted by blueasa
, |

When you want to set a timer working with GUI, you always come across threading problem. In such scenario, .Net indeed makes programmers life easier. It only matters that you choose the right timer to use.


In Win Form, you need to use System.Windows.Forms.Timer.


In WPF, the one is System.Windows.Threading.DispatcherTimer.


Here is a simple sample code for DispatcherTimer.


{

DispatcherTimer timer = new DispatcherTimer();

timer.Interval = TimeSpan.FromMilliseconds(someInterval);

timer.Tick += new EventHandler(someEventHandler);

timer.Start();

}


{

private void someEventHandler(Object sender, EventArgs args)

{

some operations

//if you want this event handler executed for just once

// DispatcherTimer thisTimer = (DispatcherTimer)sender;

// thisTimer.Stop();

}


P.S.


For general purpose, you can use System.Threading.Timer.


For server-based purpose, System.Timers.Timer can be the right choice.



출처 : http://wangmo.wordpress.com/2007/09/07/dispatchertimer-in-wpf/

반응형
Posted by blueasa
, |

WPF가 C#이랑은 참조하는 게 약간 달라서 적어놔야겠다.


간단하게 리스트로 계속 추가해 나가야겠음.


- DllImport

using System.Runtime.InteropServices;


- ArrayList

using System.Collections;


- DispatcherTimer

using System.Windows.Threading;

반응형
Posted by blueasa
, |

게임 컨텐츠란..?

Etc / 2012. 5. 19. 18:01


GAME_INDUSTRY.ppt



게임에서 말하는 컨텐츠(Contents)라는 단어의 대략적인 의미는 이해하겠는데..


정확한 정의가 무엇인지 궁금해서 이리저리 검색하고 돌아다니다가 [GAME INDUSTRY] 자료를 하나 찾았다.

(링크 : cc.kangwon.ac.kr/~kimoon/ce/ce-052/p-07.ppt)


ppt 자료에 게임컨텐츠에 대한 정의가 있길래 옮겨 적고 링크 남겨봄..



1) 게임컨텐츠란?

     컴퓨터 프로그램을 이용하여 움직이는 영상이나 지정된 텍스트로 양방향 커뮤니케이션을 통해 미리 정해진 스토리의 게임을 사용자가 해결해 나가며, 그에 따른 오락적 감흥을 느끼게 하는 대중문화 상품을 의미한다.

반응형
Posted by blueasa
, |