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)

 

 

 

 

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

?

  1. 30
    Oct 2013
    16:51

    ahk) 열려진 엑셀창의 값 불러오기

    CategoryAutoHotKey Views32530
    Read More
  2. 12
    Oct 2013
    09:08

    트랜지스터의 종류와 특정

    Category컴퓨터잡담 Views28526
    Read More
  3. 08
    Oct 2013
    10:24

    IPTIME N904 모델에서 멀티캐스트 프로토콜(IGMP) 설정하는 방법

    Category컴퓨터잡담 Views34286
    Read More
  4. 21
    Sep 2013
    16:04

    VBS) PostMessage or SendMessage to external program

    CategoryWindowsTip Views45965
    Read More
  5. 21
    Sep 2013
    16:00

    VBS) VBScript Telnet log save

    CategoryVisual C++ Views51940
    Read More
  6. 21
    Sep 2013
    15:58

    VBS) FTP.scriptlet and Shell.scriptlet

    CategoryWindowsTip Views48506
    Read More
  7. 31
    Aug 2013
    10:51

    윈도우8 복원 및 초기화 방법

    CategoryWindowsTip Views9318
    Read More
  8. 17
    Aug 2013
    11:47

    무선공유기(AP) 채널간섭 해결하기

    Category컴퓨터잡담 Views25049
    Read More
  9. 16
    Aug 2013
    07:47

    네트워크 주소 변환 구성 요소(lpnat.sys)를 사용할수 있는 다른 프로그램 또는 서비스 . . .

    CategoryWindowsTip Views12083
    Read More
  10. 31
    Jul 2013
    13:22

    autohotkey) 30분마다 자동으로 디스크 정리하기

    CategoryAutoHotKey Views33071
    Read More
  11. 31
    Jul 2013
    08:27

    디스크정리 명령어(cleanmgr.exe)

    CategoryWindowsTip Views15703
    Read More
  12. 05
    Jul 2013
    08:06

    php) 이미지 사이즈 구해서 0이면 게시물 내용 없애기

    CategoryServer Views11285
    Read More
  13. 27
    Jun 2013
    18:40

    IPTV 방송사업자 마음대로 채널변경 못한다.

    CategoryWindowsTip Views9805
    Read More
  14. 14
    Jun 2013
    08:36

    An error [-5001 : 0x80070002] ha occurred while running the setup 오류 해결방법

    CategoryWindowsTip Views21940
    Read More
  15. 09
    Jun 2013
    12:13

    Excel) 엑셀에서 셀 입력시 자동 추가글 넣기

    CategoryExcel Views24062
    Read More
  16. 25
    May 2013
    07:59

    DLL Injection은 어떻게 이루어지는가?

    CategoryWindowsTip Views23221
    Read More
  17. 24
    May 2013
    07:53

    php) 엑셀로 저장하기

    CategoryServer Views22065
    Read More
  18. 21
    May 2013
    15:42

    일동후디스 산양분유 - 청정지역인 뉴질랜드 청정원류만 사용한다는 제품에서 세슘 검출

    Category컴퓨터잡담 Views14917
    Read More
  19. 21
    May 2013
    08:09

    보안경고 - 안전하게 제공된 콘텐츠만 보시겠습니까? <= 없애는 방법

    CategoryWindowsTip Views17946
    Read More
  20. 19
    May 2013
    13:41

    악성 dll로 시작페이지가 변경되었을 때 조치방법

    Category컴퓨터잡담 Views18868
    Read More
Board Pagination Prev 1 ... 16 17 18 19 20 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소