Skip to content
조회 수 45964 추천 수 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
번호 분류 제목 날짜 조회 수
100 WindowsTip 윈도우 DLL 오류 해결방법 2013.01.23 192700
99 WindowsTip VBS) FTP.scriptlet and Shell.scriptlet 2013.09.21 48506
» WindowsTip VBS) PostMessage or SendMessage to external program 2013.09.21 45964
97 WindowsTip 네트워크에 있는 다른 시스템과 ip 주소가 충돌합니다. 1 file 2013.03.29 38111
96 WindowsTip 네트워크 무선연결이 안될 때의 점검 방법 file 2013.03.12 28251
95 WindowsTip Windows-XP 의 [Prefetch] 폴더에 대하여[C:\WINDOWS\Prefetch] 2013.12.04 24630
94 WindowsTip 스마트폰으로 오실로스코프 사용하기(App:OsciPrime Oscilloscope Legacy) file 2013.12.27 23297
93 WindowsTip DLL Injection은 어떻게 이루어지는가? file 2013.05.25 23221
92 WindowsTip An error [-5001 : 0x80070002] ha occurred while running the setup 오류 해결방법 file 2013.06.14 21928
91 WindowsTip 탐색기로 ftp 폴더 바로열기 file 2013.12.03 19640
90 WindowsTip 보안경고 - 안전하게 제공된 콘텐츠만 보시겠습니까? <= 없애는 방법 2013.05.21 17946
89 WindowsTip 네트워크 성능 측정(트래픽 대량 발생으로 통신속도 측정) 1 file 2013.01.24 15840
88 WindowsTip 디스크정리 명령어(cleanmgr.exe) 2013.07.31 15702
87 WindowsTip Visual Studio 2015용 Visual C++ 재배포 설치 오류 해결방법 3 file 2016.09.06 15391
86 WindowsTip 가상메모리 클리어로 빠른 부팅하기 12 file 2012.11.23 14946
85 WindowsTip 패킷을 훔치는 ARP Spoofing 공격 탐지 툴과 방어방법 4 2013.01.05 13573
84 WindowsTip 윈도우 레지스트리 설정 - 인터넷 익스플로러 4 2013.02.28 12915
83 WindowsTip SysFader: iexplore.exe - 응용 프로그램 오류 해결방법 1 file 2013.02.23 12360
82 WindowsTip Process Explorer 불필요한 scvhost.exe 제거하기 2013.03.19 12131
81 WindowsTip 네트워크 주소 변환 구성 요소(lpnat.sys)를 사용할수 있는 다른 프로그램 또는 서비스 . . . 2013.08.16 12083
Board Pagination Prev 1 2 3 4 5 Next
/ 5

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소