Skip to content
조회 수 45965 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

VBS) PostMessage or SendMessage to external program

 

  vbscript code

  const WM_CUSTOMMSG = 1024

      retval = System.SendMessage(hdl,WM_CUSTOMMSG)  
   or 
      retval = System.PostMessage(hdl,WM_CUSTOMMSG)

 

 

 

 

I wrote a little test program using Visual Studio 2003 in C++ unmanage code (SimpleApp.cpp source supplied below) and tried it against ArcPad to test the SendMessage (test script supplied below too). 
 
// Code fragment 1: SimpleApp.cpp
// (contains a single icon resource IDI_SIMPLEAPP)

#include "stdafx.h"
#include "Resource.h"

const TCHAR szTitle[] = TEXT("SimpleApp");
const TCHAR szWindowClass[] = TEXT("SimpleApp");

LRESULT CALLBACK	WndProc(HWND, UINT, WPARAM, LPARAM);

int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR	lpCmdLine, int nCmdShow)
{
	WNDCLASSEX wcex;
	wcex.cbSize = sizeof(WNDCLASSEX); 
	wcex.style			= CS_HREDRAW | CS_VREDRAW;
	wcex.lpfnWndProc	= (WNDPROC)WndProc;
	wcex.cbClsExtra		= 0;
	wcex.cbWndExtra		= 0;
	wcex.hInstance		= hInstance;
	wcex.hIcon			= LoadIcon(hInstance, (LPCTSTR)IDI_SIMPLEAPP);
	wcex.hCursor		= LoadCursor(NULL, IDC_ARROW);
	wcex.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);
	wcex.lpszMenuName	= NULL;
	wcex.lpszClassName	= szWindowClass;
	wcex.hIconSm		= LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SIMPLEAPP);
	RegisterClassEx(&wcex);
	HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
	if (!hWnd)
		return FALSE;
	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);
	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0)) 
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return (int) msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	PAINTSTRUCT ps;
	HDC hdc;
	switch (message) 
	{
	case WM_PAINT:
		hdc = BeginPaint(hWnd, &ps);
		EndPaint(hWnd, &ps);
		break;
	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case 1024:
		MessageBox(hWnd, TEXT("1024 received"), TEXT("debug"), MB_OK);
		break;
	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}

--------------------------------------------------

REM Code fragment 2: test script

Dim w
w = System.FindWindow("SimpleApp", "SimpleApp")
Call System.SendMessage(w, 1024, 0, 0)

 

 

 

 

로그인 후 댓글쓰기가 가능합니다.

?

List of Articles
번호 분류 제목 날짜 조회 수
777 컴퓨터잡담 크롬에서 플래시 사용하기 2020.11.04 3386
776 컴퓨터잡담 [크롬] 원격 데스크톱 외부접속시 "서버에서 참조를 반환했습니다." 오류 해결법 2019.11.18 11507
775 컴퓨터잡담 [REMIX OS]How to Edit of REMIX OS build.prop? 수정방법 file 2019.11.10 12576
774 컴퓨터잡담 CCTV VIEWEASYV2 file 2019.05.31 4151
773 WindowsTip ISO 파일을 USB에 굽는 방법 [4GB 넘는 ISO 파일 USB에 굽는 방법] 2019.04.13 8091
772 컴퓨터잡담 CPU-Z file 2019.02.23 3904
771 컴퓨터잡담 nVIDIA GTX750Ti 드라이버 file 2019.02.19 6799
770 [Docs]스프레드시트 구글 앱스 스크립트(Google Apps Script) 외부에서 실행하기 2 2019.01.09 7048
769 [Docs]스프레드시트 구글 앱스 스크립트(Google Apps Script) 외부에서 실행하기 2019.01.09 6806
768 컴퓨터잡담 윈도우 PC에서 안드로이드 앱 실행 file 2018.09.25 6189
767 [Docs]스프레드시트 구글캘린더 CSV 파일로 일괄 기록하기 file 2018.08.31 12291
766 컴퓨터잡담 메이플스토리 입력신호범위초과(out of range)에러메세지 해결방법 file 2018.07.26 5817
765 AutoHotKey Autohotkey] 키보드 후킹 테스트 file 2018.07.07 9681
764 컴퓨터잡담 마인크래프트 게임충돌 해결방법 file 2018.07.03 24069
763 AutoHotKey autohotkey command-line 실행시 파라미터 설정 2018.02.14 7223
762 HTMLPHPMSQL 자바스크립트 내가 자주 사용하는 함수모음 2018.02.08 7957
761 HTMLPHPMSQL 자바스크립트 명령어 2018.01.31 12894
760 [Docs]스프레드시트 스프레드시트 autohotkey html gmail 스마트폰 이용하여 핑로스 즉시 알림받기 file 2018.01.25 10576
759 HTMLPHPMSQL javascript만으로 html간 변수값 주고받기 2018.01.25 17336
758 [Docs]스프레드시트 google spreadsheets html form post로 전달받기 file 2018.01.23 6881
Board Pagination Prev 1 ... 6 7 8 9 10 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소