WINAPI 프로그래밍시 초기화가 'case' 레이블에 의해 생략되었습니다 오류 관련

알아두자/Windows 2013. 5. 19. 18:11

간단하다, CASE문을 {}로 묶어서 처리하면 에러가 안난다...


case WM_LBUTTONDOWN :

MessageBox(hWnd,"2윈도우의 제목을 바꿉니다.","알림",MB_OK);

SetWindowText(_hWnd2,"Change the world");

break;

case WM_RBUTTONDOWN :

{

MessageBox(hWnd,"우측 클릭해쪄, 메모장에 텍스트 쓴당","알림",MB_OK);

// HWND : 이벤트 발생 윈도우 확인 위한 식별자, 여기선 메모장을 위해서 새로 정의함

HWND hNote;

char textbox[80];

char string1[] = "야! 내가 메모장 안으로 침투한다";

// SPY++를 이용해 매번 바뀌는 메모장의 핸들값을 입력해 준다.

hNote=(HWND)0x000D0604;

HDC hdc;

hdc=GetDC(hNote);

sprintf(textbox,"%s",string1);

TextOut(hdc,0,0,string1,strlen(string1));

ReleaseDC(hNote,hdc);

break;

}


위는 예시 ~_~/

130513

학교 실습/HCI 2013. 5. 13. 14:41

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package point4dtest;

/**
 *
 * @author User
 */
class Circle {
    final double pi;
    double area_result;
    int x, y, r;

    /*Circle() {
        this(0, 0, 0);
    }*/
    Circle(int x, int y, int r,double pi) {
        //this 하면 위의 r을 사용 (맴버변수)
        this.r = r;
        this.x = x;
        this.y = y;
        this.pi=3.14;//this.pi=pi로 하면 인자로 쓰게되고, 3.14로 잡아주면 인자 뭐로오던 간에 3.14로 박힘
    }
    double area()
    { 
        r=3;
        area_result=r*r*pi;
        return area_result;
    }
    //생성자에서 초기화 하는 방법

}

class CircleC {

    Point center = new Point();
    int r;
    CircleC()
    {
        this(0,0,0);
    }
    CircleC(int x,int y, int z)
    {
        center.x=x;
        center.y=y;
        this.r=r;
    }
}

class CircleI extends Point {

    int r;
    CircleI() {
        this(0, 0, 0);
    }
    CircleI(int x, int y, int r) {
        this.r = r;
        this.x = x;
        this.y = y;
    }
}

class Point {

    int x, y;

    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    Point() {
        this(0, 0);
    }
    /*
    String getLocation() {
        return "x :" + x + ", y :" + y;
    }
    */
}

class Point3D extends Point {

    int z;

    Point3D(int x, int y, int z) {
        super(x,y);
        //this.x = x;
        //this.y = y;
        this.z = z;
    }

    Point3D() {
        this(0, 0, 0);

    }
    String getLocation()
     {
     return "x :" + x + ", y :"+ y+"z :"+z;
     }
}

class Point4D extends Point3D {

    int t;

    Point4D(int x, int y, int z, int t) {
        super(x,y,z);
        /*this.x = x;
        this.y = y;
        this.z = z;
        */
        this.t = t;
    }

    Point4D() {
        this(0, 0, 0, 0);
    }

    String getLocation() {
        return super.getLocation() + " t : " + t;
    }
}

public class Point4DTest {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Point p = new Point(0, 0);
        Point p2 = new Point();
        Point3D p3 = new Point3D(1, 2, 3);
        Point4D p4 = new Point4D(1, 2, 3, 4);
        CircleC c2 = new CircleC();
        Circle cc = new Circle(1,2,3,4);
        Point4D  p4d = new Point4D();
        System.out.println("p.x : " + p.x + " p.y :" + p.y + " p2.x : " + p2.x + " p2.y : " + p2.y + " p3.z : " + p3.z + " p4.x : " + p4.x + " p4.y : " + p4.y + " p4.z : " + p4.z + " p4.t : " + p4.t + " c2.center.x : "
                +c2.center.x);
        System.out.println(p4d.getLocation());
        System.out.println("circle area : "+cc.area());
    }
}

'학교 실습 > HCI' 카테고리의 다른 글

20130522 HCI 과제 완료  (0) 2013.05.22
20130522 HCI  (0) 2013.05.22
20130508  (0) 2013.05.08
20130507  (0) 2013.05.07
HCI 20130501  (0) 2013.05.01

20130508

학교 실습/HCI 2013. 5. 8. 14:38

/*

 * To change this template, choose Tools | Templates

 * and open the template in the editor.

 */

package point4dtest;


/**

 *

 * @author User

 */

class Circle {


    int x, y, r;


    Circle() {

        this(0, 0, 0);

    }


    Circle(int x, int y, int r) {

        this.r = r;

        this.x = x;

        this.y = y;

    }

}


class CircleC {


    Point center = new Point();

    int r;

    CircleC()

    {

        this(0,0,0);

    }

    CircleC(int x,int y, int z)

    {

        center.x=x;

        center.y=y;

        this.r=r;

    }

}


class CircleI extends Point {


    int r;

    CircleI() {

        this(0, 0, 0);

    }

    CircleI(int x, int y, int r) {

        this.r = r;

        this.x = x;

        this.y = y;

    }

}


class Point {


    int x, y;


    Point(int x, int y) {

        this.x = x;

        this.y = y;

    }


    Point() {

        this(0, 0);

    }

    /*

    String getLocation() {

        return "x :" + x + ", y :" + y;

    }

    */

}


class Point3D extends Point {


    int z;


    Point3D(int x, int y, int z) {

        super(x,y);

        //this.x = x;

        //this.y = y;

        this.z = z;

    }


    Point3D() {

        this(0, 0, 0);


    }

    String getLocation()

     {

     return "x :" + x + ", y :"+ y+"z :"+z;

     }

}


class Point4D extends Point3D {


    int t;


    Point4D(int x, int y, int z, int t) {

        super(x,y,z);

        /*this.x = x;

        this.y = y;

        this.z = z;

        */

        this.t = t;

    }


    Point4D() {

        this(0, 0, 0, 0);

    }


    String getLocation() {

        return super.getLocation() + " t : " + t;

    }

}


public class Point4DTest {


    /**

     * @param args the command line arguments

     */

    public static void main(String[] args) {

        // TODO code application logic here

        Point p = new Point(0, 0);

        Point p2 = new Point();

        Point3D p3 = new Point3D(1, 2, 3);

        Point4D p4 = new Point4D(1, 2, 3, 4);

        CircleC c2 = new CircleC();

        Point4D  p4d = new Point4D();

        System.out.println("p.x : " + p.x + " p.y :" + p.y + " p2.x : " + p2.x + " p2.y : " + p2.y + " p3.z : " + p3.z + " p4.x : " + p4.x + " p4.y : " + p4.y + " p4.z : " + p4.z + " p4.t : " + p4.t + " c2.center.x : "

                +c2.center.x);

        System.out.println(p4d.getLocation());

    }

}

'학교 실습 > HCI' 카테고리의 다른 글

20130522 HCI  (0) 2013.05.22
130513  (0) 2013.05.13
20130507  (0) 2013.05.07
HCI 20130501  (0) 2013.05.01
HCI 20130429  (0) 2013.04.29