Skip to content
조회 수 45978 추천 수 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
번호 분류 제목 날짜 조회 수
38 AutoHotKey OnMessage() 3 2011.02.05 20497
37 컴퓨터잡담 DllCall() 3 2010.12.22 15333
36 컴퓨터잡담 Autohotkey DllCall() 호출하기 5 2010.12.19 23475
35 컴퓨터잡담 float 문제, Image 밑으로 본문을 새로 줄바꿈해서 출력하려면. file 2010.12.08 5047
34 컴퓨터잡담 북마크 링크 주소모음 2010.10.30 103005
33 컴퓨터잡담 램디스크 숨기는 방법 2 2010.10.02 5676
32 컴퓨터잡담 그림안에 투명텍스트박스 넣기. 2 2010.09.29 9566
31 컴퓨터잡담 동영상 제작프로그램, 파워디렉터(POWER DIRECTOR) 1 2 2010.09.10 20217
30 컴퓨터잡담 이전 버전의 Office로 Office 2007 파일을 여는 방법 1 2010.09.04 11304
29 컴퓨터잡담 Excel에서 틀 고정 방법 2010.09.04 18631
28 컴퓨터잡담 hMailServer - 설치시 주의 핵심사항 1 2010.08.24 103244
27 컴퓨터잡담 [윈도우 웹서버] hmailserver 1 1 2010.08.22 23399
26 컴퓨터잡담 Tips N Tricks Process Listing - Using third party DLL! 2010.08.14 20428
25 컴퓨터잡담 도스 텍스트 TXT 파일에 내용 추가하기 2010.07.23 5955
24 컴퓨터잡담 윈도 로그인하기 전에 배치파일을 실행하는 방법 3 2010.07.23 18267
23 컴퓨터잡담 윈도우 서비스 수동 등록 방법 2010.07.23 9661
22 컴퓨터잡담 Implementation of the MetaWeblog API http://www.xmlrpc.com/metaWeblogApi in php 2010.07.12 12762
21 컴퓨터잡담 악의적 호출 방지용 Referer 체크 2010.07.09 7531
20 컴퓨터잡담 셀에 현재 날짜와 시간 삽입 2010.06.15 10278
19 컴퓨터잡담 MySQL 조율(튜닝)에 대해 2 2010.04.14 15835
Board Pagination Prev 1 ... 5 6 7 8 9 Next
/ 9

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소