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. 23
    Jan 2013
    16:16

    윈도우 DLL 오류 해결방법

    CategoryWindowsTip Views192702
    Read More
  2. 21
    Sep 2013
    15:58

    VBS) FTP.scriptlet and Shell.scriptlet

    CategoryWindowsTip Views48506
    Read More
  3. 21
    Sep 2013
    16:04

    VBS) PostMessage or SendMessage to external program

    CategoryWindowsTip Views45965
    Read More
  4. 29
    Mar 2013
    08:22

    네트워크에 있는 다른 시스템과 ip 주소가 충돌합니다.

    CategoryWindowsTip Views38112
    Read More
  5. 12
    Mar 2013
    14:04

    네트워크 무선연결이 안될 때의 점검 방법

    CategoryWindowsTip Views28276
    Read More
  6. 04
    Dec 2013
    13:31

    Windows-XP 의 [Prefetch] 폴더에 대하여[C:\WINDOWS\Prefetch]

    CategoryWindowsTip Views24630
    Read More
  7. 27
    Dec 2013
    15:59

    스마트폰으로 오실로스코프 사용하기(App:OsciPrime Oscilloscope Legacy)

    CategoryWindowsTip Views23302
    Read More
  8. 25
    May 2013
    07:59

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

    CategoryWindowsTip Views23221
    Read More
  9. 14
    Jun 2013
    08:36

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

    CategoryWindowsTip Views21935
    Read More
  10. 03
    Dec 2013
    08:11

    탐색기로 ftp 폴더 바로열기

    CategoryWindowsTip Views19665
    Read More
  11. 21
    May 2013
    08:09

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

    CategoryWindowsTip Views17946
    Read More
  12. 24
    Jan 2013
    10:36

    네트워크 성능 측정(트래픽 대량 발생으로 통신속도 측정)

    CategoryWindowsTip Views15841
    Read More
  13. 31
    Jul 2013
    08:27

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

    CategoryWindowsTip Views15703
    Read More
  14. 06
    Sep 2016
    11:29

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

    CategoryWindowsTip Views15436
    Read More
  15. 23
    Nov 2012
    12:52

    가상메모리 클리어로 빠른 부팅하기

    CategoryWindowsTip Views14948
    Read More
  16. 05
    Jan 2013
    12:36

    패킷을 훔치는 ARP Spoofing 공격 탐지 툴과 방어방법

    CategoryWindowsTip Views13573
    Read More
  17. 28
    Feb 2013
    07:36

    윈도우 레지스트리 설정 - 인터넷 익스플로러

    CategoryWindowsTip Views12950
    Read More
  18. 23
    Feb 2013
    16:03

    SysFader: iexplore.exe - 응용 프로그램 오류 해결방법

    CategoryWindowsTip Views12360
    Read More
  19. 19
    Mar 2013
    08:48

    Process Explorer 불필요한 scvhost.exe 제거하기

    CategoryWindowsTip Views12131
    Read More
  20. 16
    Aug 2013
    07:47

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

    CategoryWindowsTip Views12083
    Read More
Board Pagination Prev 1 2 3 4 5 Next
/ 5

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소