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
번호 분류 제목 날짜 조회 수
20 WindowsTip Windows 7 인터넷속도 향상시키기 2013.01.25 8992
19 WindowsTip 네트워크 성능 측정(트래픽 대량 발생으로 통신속도 측정) 1 file 2013.01.24 15842
18 WindowsTip 네트워크 부하(Offered Load) 관련 Discard Rate 2 2013.01.24 11632
17 WindowsTip imm32.dll 다운 바이러스 오류 해결법(한글이 잘 안써지는 문제 등) 1 file 2013.01.23 8140
16 WindowsTip 윈도우 DLL 오류 해결방법 2013.01.23 192718
15 WindowsTip 100M Full 속도내기(레지스터리) file 2013.01.11 6528
14 WindowsTip 패킷을 훔치는 ARP Spoofing 공격 탐지 툴과 방어방법 4 2013.01.05 13573
13 WindowsTip windows Arp Spoofing Tool 5 2013.01.05 8091
12 WindowsTip 램디스크 설정시 주의사항(끊킴현상 발생시 해당부분 점검필수) 2 file 2012.11.28 10133
11 WindowsTip 삼성노트북 NT300E5C-A15R 드라이버 2012.11.27 8814
10 WindowsTip 가상메모리 클리어로 빠른 부팅하기 12 file 2012.11.23 14951
9 WindowsTip 강력한 백신 avast file 2012.08.07 6982
8 WindowsTip MS 에센셜 정식한글판 (MSE) 2 3 2012.08.07 6726
7 WindowsTip 장치관리자, 네트워크연결의 아이콘이 사라짐 3 2012.08.01 10557
6 WindowsTip 로컬 영역 연결 없어졌을 때 해결 방법 3 file 2012.08.01 11911
5 WindowsTip 도스모드에서 IP 변경하는 방법 2012.07.05 7325
4 WindowsTip TCP/IP Network Communication without extra Tools(DB, 메신저 등등) 2012.07.03 6773
3 WindowsTip 익스플로러 업데이트 안될때의 패치 file 2012.07.02 6066
2 WindowsTip 윈도우 문제 많을때 (레지스트리 초기화???) 2012.05.23 9634
1 WindowsTip 윈도우 Xp에서 사용자 로그온 제거 방법 1 2012.05.18 6292
Board Pagination Prev 1 ... 3 4 5 Next
/ 5

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소