Skip to content
조회 수 45966 추천 수 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)

 

 

 

 

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

?

  1. 21
    Mar 2015
    11:41

    윈도우 8.1 종료버튼 만들기

    CategoryWindowsTip Views3852
    Read More
  2. 21
    Mar 2015
    12:56

    인터넷 익스플로러 기본검색 공급자 설정해제

    CategoryWindowsTip Views4294
    Read More
  3. 21
    Mar 2015
    14:42

    윈도우 8.1 업데이트 하지 않기

    CategoryWindowsTip Views3780
    Read More
  4. 01
    Apr 2015
    23:29

    윈도우8.1 암호 입력없이 자동로그인 하기

    CategoryWindowsTip Views4362
    Read More
  5. 02
    Apr 2015
    06:45

    윈도우 8.1 시작화면 아닌 바탕화면(데스크톱 모드)를 기본으로 설정하는 방법

    CategoryWindowsTip Views7584
    Read More
  6. 13
    Apr 2015
    12:32

    윈도우 8.1 부팅속도 개선방법

    CategoryWindowsTip Views4817
    Read More
  7. 13
    Apr 2015
    12:37

    UEFI 부팅+윈도우 8.1

    CategoryWindowsTip Views6219
    Read More
  8. 13
    Apr 2015
    16:43

    Fasoo DRM 삭제하기(fph)

    CategoryWindowsTip Views10831
    Read More
  9. 03
    May 2015
    19:15

    캐논 프린터 MG2990 드라이버

    CategoryWindowsTip Views5309
    Read More
  10. 03
    May 2015
    22:39

    캐논 MG 2990 스캔 드라이버

    CategoryWindowsTip Views4719
    Read More
  11. 11
    May 2015
    10:14

    윈도우 ip helper ipv6 도데체 무엇인가?

    CategoryWindowsTip Views4918
    Read More
  12. 12
    Nov 2015
    02:53

    DOS Batch - FTP Scripts 배치파일

    CategoryWindowsTip Views5707
    Read More
  13. 11
    Jan 2016
    23:14

    Diskless Boot Software for Windows(윈도우용 노하드 시스템)

    CategoryWindowsTip Views8584
    Read More
  14. 26
    Mar 2016
    09:44

    예약된 작업(작업 스케줄러 시작)

    CategoryWindowsTip Views4118
    Read More
  15. 19
    Jul 2016
    19:29

    도스에서 텍스트 파일 치환

    CategoryWindowsTip Views4646
    Read More
  16. 24
    Aug 2016
    15:41

    윈도우 CPU 사용률 확인, 실시간 저장하기

    CategoryWindowsTip Views5687
    Read More
  17. 06
    Sep 2016
    11:29

    Visual Studio 2015용 Visual C++ 재배포 설치 오류 해결방법

    CategoryWindowsTip Views15462
    Read More
  18. 06
    Sep 2016
    11:38

    vcruntime140.dll / vcomp140.dll / vcamp140.dll 오류해결법

    CategoryWindowsTip Views6858
    Read More
  19. 13
    Apr 2019
    21:21

    ISO 파일을 USB에 굽는 방법 [4GB 넘는 ISO 파일 USB에 굽는 방법]

    CategoryWindowsTip Views8115
    Read More
  20. 09
    Mar 2022
    22:39

    윈도우10 ALT + TAB 창 전환이 안될 때 대처방법

    CategoryWindowsTip Views9256
    Read More
Board Pagination Prev 1 ... 3 4 5 Next
/ 5

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소