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
번호 분류 제목 날짜 조회 수
657 컴퓨터잡담 Microsoft .NET Framework 버전 2.0 재배포 가능 패키지(x86) 1 1 file 2011.12.15 5091
656 컴퓨터잡담 파이썬 IF문 2021.06.16 5094
655 [Docs]스프레드시트 구글 스프레드시트(Google Spreadsheet)를 데이터베이스로 활용하기 file 2015.07.20 5099
654 컴퓨터잡담 XE) 관리자모드 업데이트가 안되는 이유 file 2012.02.28 5142
653 Server 댓글쓰기 - 스케치북 게시판 로그인 사용자만 댓글쓰기 2017.04.05 5159
652 Server [mysql] Created tmp disk tables 디스크 쓰기방지 대안 1 2016.11.26 5162
651 컴퓨터잡담 윈도우 시스템 파일 콘솔복원 2 2011.11.30 5166
650 Server 윈도우용 MEMcached 설치방법 1 file 2016.09.17 5180
649 Server XE 스케치북 게시판 웹진형에서 사진과 요약글 출력방법 file 2016.12.05 5203
648 Server 램드라이브를 이용한 mysql 번개속도로 개선방법 file 2016.11.27 5238
647 컴퓨터잡담 [php] Htmlparser.inc, Htmlparser.php Dom Paser 3 file 2011.09.02 5245
646 파이썬 파이썬 pyautogui 자주쓰는 이미지 서치 def 지정하기 2023.02.12 5253
645 컴퓨터잡담 탐색기 다른 이름으로 저장하기 저장위치 즐겨찾기 폴더 변경하기 2 file 2012.03.02 5294
644 컴퓨터잡담 레지스트리 팁 - 로그오프하지 않고 반영하기 2010.10.25 5297
643 WindowsTip 캐논 프린터 MG2990 드라이버 file 2015.05.03 5300
642 컴퓨터잡담 [크롬OS] 한글 입력방법 2011.07.27 5312
641 [Docs]스프레드시트 스프레드시트 api append & update php 셀 내용 수정 4 2016.08.08 5314
640 컴퓨터잡담 다양한 백신 비교 2 file 2012.08.30 5352
639 AutoHotKey Each enumerated result will be assigned to the ByRef parameter Result. And, introduced a Global variable _hResult_ which will store the hResult of the Invoke. 2011.02.14 5403
638 컴퓨터잡담 토렌트 다운로드한 파일이 실행되지 않을경우 2010.11.11 5406
Board Pagination Prev 1 ... 12 13 14 15 16 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소