hi guys, i was talking to someone about the window handle and they said i already have it with the code i have, i just need to display it. i want to display it on a editbox, but i cant get it to work still hehe. here is my full code: .386 .model flat, stdcall ;################################################################################### include c:\masm32\include\windows.inc include c:\masm32\include\kernel32.inc include c:\masm32\include\user32.inc include c:\masm32\include\gdi32.inc includelib c:\masm32\lib\user32.lib includelib c:\masm32\lib\kernel32.lib includelib c:\masm32\lib\gdi32.lib ;################################################################################### WinMain proto :DWORD, :DWORD, :DWORD, :DWORD .data AppName byte "spy", 0 ClassName byte "spyclass", 0 Static byte "static", 0 Button byte "button", 0 TextBox byte "edit", 0 WindowCaption byte "Window Caption:", 0 WindowClass byte "Window ClassName:", 0 WindowHandle byte "Window Handle:",0 FontName byte "Verdana", 0 hFont dword 0 StaticID dword 0 FrameID dword 0 FrameID2 dword 0 FrameID3 dword 0 TextBoxID dword 0 TextBoxID2 dword 0 TextBoxID3 dword 0 hWindowHandle byte "%Xh", 0 .data? hInstance HINSTANCE ? CommandLine LPSTR ? buffer byte 1024 dup (?) buff byte 1024 dup (?) .const IDI_ICON1 equ 102 IDB_BITMAP1 equ 103 .code start: invoke GetModuleHandle, NULL mov hInstance, eax invoke GetCommandLine mov CommandLine, eax invoke WinMain, hInstance, NULL, CommandLine, SW_SHOW invoke ExitProcess, eax ;################################################################################### WinMain proc hInst:HINSTANCE, hPrevInstance:HINSTANCE, CmdLine:LPSTR, CmdShow:DWORD local wc:WNDCLASSEX local msg:MSG local hwnd:HWND mov wc.cbSize, sizeof WNDCLASSEX mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW mov wc.lpfnWndProc, offset WndProc mov wc.cbClsExtra, NULL mov wc.cbWndExtra, NULL push hInstance pop wc.hInstance mov wc.hbrBackground, COLOR_BTNFACE+1 mov wc.lpszMenuName, NULL mov wc.lpszClassName, offset ClassName invoke LoadIcon, hInstance, IDI_ICON1 mov wc.hIcon, eax mov wc.hIconSm, eax invoke LoadCursor, NULL, IDC_ARROW mov wc.hCursor, eax invoke RegisterClassEx, addr wc invoke CreateWindowEx, WS_EX_WINDOWEDGE, addr ClassName, addr AppName, WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 351, 282, NULL, NULL, hInst, NULL mov hwnd, eax invoke ShowWindow, hwnd, SW_SHOWDEFAULT invoke UpdateWindow, hwnd .while TRUE invoke GetMessage, addr msg, NULL, 0, 0 .break .if (!eax) invoke TranslateMessage, addr msg invoke DispatchMessage, addr msg .endw mov eax, msg.wParam ret WinMain endp ;################################################################################### WndProc proc wnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM local pt: POINT local WindowID: HWND .if uMsg == WM_CREATE invoke SetTimer, wnd, 1, 1, NULL invoke CreateFont, 12, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH + FF_DONTCARE, addr FontName mov hFont, eax invoke CreateWindowEx, NULL, addr Static, NULL, WS_VISIBLE+SS_BITMAP+WS_CHILD, 7, 7, 200, 200, wnd, NULL, hInstance, NULL mov StaticID, eax invoke LoadBitmap, hInstance, 103 invoke SendMessage, StaticID, STM_SETIMAGE, IMAGE_BITMAP, eax invoke CreateWindowEx, NULL, addr Button, addr WindowCaption, BS_GROUPBOX+WS_CHILD+WS_VISIBLE, 7, 70, 331, 55, wnd, NULL, hInstance, NULL mov FrameID, eax invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr TextBox, NULL, WS_BORDER+WS_CHILD+WS_VISIBLE, 12, 85, 320, 33, wnd, NULL, hInstance, NULL mov TextBoxID, eax invoke CreateWindowEx, NULL, addr Button, a
Posted on 2001-02-18 08:20:00 by hehe
use code tags when posting code like this:

	.386
	.model flat, stdcall
	
;###################################################################################

	include c:\masm32\include\windows.inc
	include c:\masm32\include\kernel32.inc
	include c:\masm32\include\user32.inc
	include c:\masm32\include\gdi32.inc
	includelib c:\masm32\lib\user32.lib
	includelib c:\masm32\lib\kernel32.lib
	includelib c:\masm32\lib\gdi32.lib

;###################################################################################


	WinMain proto :DWORD, :DWORD, :DWORD, :DWORD



.data
	AppName		byte "spy", 0
	ClassName	byte "spyclass", 0     
	Static		byte "static", 0  
	Button		byte "button", 0
	TextBox		byte "edit", 0
	WindowCaption	byte "Window Caption:", 0 
	WindowClass	byte "Window ClassName:", 0
	WindowHandle	byte "Window Handle:",0
	FontName	byte "Verdana", 0
	hFont 		dword 0
	StaticID		dword 0
	FrameID		dword 0
	FrameID2	dword 0
	FrameID3	dword 0
	TextBoxID	dword 0
	TextBoxID2	dword 0
	TextBoxID3	dword 0
	hWindowHandle	byte "%Xh", 0


.data?
	hInstance		HINSTANCE ?
	CommandLine	LPSTR ? 
	buffer          byte 1024 dup (?)
	buff	byte 1024 dup (?)
.const
 
	IDI_ICON1	equ 102 
	IDB_BITMAP1	equ 103

.code

start: 
      
	invoke GetModuleHandle, NULL            
	mov hInstance, eax  
	invoke GetCommandLine
	mov CommandLine, eax
 
	invoke WinMain, hInstance, NULL, CommandLine, SW_SHOW
	invoke ExitProcess, eax
     
;###################################################################################
 
 WinMain proc hInst:HINSTANCE, hPrevInstance:HINSTANCE, CmdLine:LPSTR, CmdShow:DWORD
 	local wc:WNDCLASSEX
 	local msg:MSG
 	local hwnd:HWND
        
 	mov wc.cbSize, sizeof WNDCLASSEX
 	mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
 	mov wc.lpfnWndProc, offset WndProc
 	mov wc.cbClsExtra, NULL
 	mov wc.cbWndExtra, NULL
 	push hInstance
 	pop wc.hInstance
 	mov wc.hbrBackground, COLOR_BTNFACE+1
 	mov wc.lpszMenuName, NULL
 	mov wc.lpszClassName, offset ClassName
	invoke LoadIcon, hInstance, IDI_ICON1 
	mov wc.hIcon, eax 
	mov wc.hIconSm, eax 
 	invoke LoadCursor, NULL, IDC_ARROW
	mov wc.hCursor, eax       
 
	invoke RegisterClassEx, addr wc
	
	
	invoke CreateWindowEx, WS_EX_WINDOWEDGE, addr ClassName, addr AppName, WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 351, 282, NULL, NULL, hInst, NULL
 	mov hwnd, eax
 	
	invoke ShowWindow, hwnd, SW_SHOWDEFAULT
	invoke UpdateWindow, hwnd
 
 	.while TRUE
  		invoke GetMessage, addr msg, NULL, 0, 0  
  		.break .if (!eax)
  		invoke TranslateMessage, addr msg
  		invoke DispatchMessage, addr msg
  	.endw
  
  	mov eax, msg.wParam
  	ret         
  
  WinMain endp 
   
;###################################################################################

WndProc proc wnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
	local pt: POINT
 	local WindowID: HWND

	.if uMsg == WM_CREATE 
		
		invoke SetTimer, wnd, 1, 1, NULL

		invoke CreateFont, 12, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH + FF_DONTCARE, addr FontName
	          mov hFont, eax

		invoke CreateWindowEx, NULL, addr Static, NULL, WS_VISIBLE+SS_BITMAP+WS_CHILD, 7, 7, 200, 200, wnd, NULL, hInstance, NULL
                  mov StaticID, eax

		invoke LoadBitmap, hInstance, 103
		invoke SendMessage, StaticID, STM_SETIMAGE, IMAGE_BITMAP, eax

		invoke CreateWindowEx, NULL, addr Button, addr WindowCaption, BS_GROUPBOX+WS_CHILD+WS_VISIBLE, 7, 70, 331, 55, wnd, NULL, hInstance, NULL
  	          mov FrameID, eax

		invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr TextBox, NULL, WS_BORDER+WS_CHILD+WS_VISIBLE, 12, 85, 320, 33, wnd, NULL, hInstance, NULL
		  mov TextBoxID, eax   
    	
		invoke CreateWindowEx, NULL, addr Button, addr WindowClass, BS_GROUPBOX+WS_CHILD+WS_VISIBLE, 7, 120, 331, 55, wnd, NULL, hInstance, NULL
		  mov FrameID2, eax
		
		invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr TextBox, N
Posted on 2001-02-18 16:56:00 by Hiroshimator
Hello hehe, I took your source code and tried to assemble it after looking at it carefully. I found some things that I changed in "my" version of it. here is the source code.

.386
.model flat, stdcall
option casemap:none

;################################################################

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\gdi32.lib

;################################################################

WinMain proto :DWORD, :DWORD, :DWORD, :DWORD

.data
AppName byte "spy", 0
ClassName byte "spyclass", 0 
Static byte "static", 0 
Button byte "button", 0
TextBox byte "edit", 0
WindowCaption byte "Window Caption:", 0 
WindowClass byte "Window ClassName:", 0
WindowHandle byte "Window Handle:",0
FontName byte "Verdana", 0
hFont dword 0
StaticID dword 0
FrameID dword 0
FrameID2 dword 0
FrameID3 dword 0
TextBoxID dword 0
TextBoxID2 dword 0
TextBoxID3 dword 0
hWindowHandle db "%x", 0


.data?
hInstance HINSTANCE ?
CommandLine LPSTR ? 
buffer db 1024 dup (?)
buff db 1024 dup (?)
.const

IDI_ICON1 equ 102 
IDB_BITMAP1 equ 103

.code

start: 

invoke GetModuleHandle, NULL 
mov hInstance, eax 
invoke GetCommandLine
mov CommandLine, eax

invoke WinMain, hInstance, NULL, CommandLine, SW_SHOW
invoke ExitProcess, eax

;################################################################

WinMain proc hInst:HINSTANCE, hPrevInstance:HINSTANCE, CmdLine:LPSTR, CmdShowWORD
local wc:WNDCLASSEX
local msg:MSG
local hwnd:HWND

mov wc.cbSize, sizeof WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
mov wc.lpfnWndProc, offset WndProc
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push hInstance
pop wc.hInstance
mov wc.hbrBackground, COLOR_BTNFACE+1
mov wc.lpszMenuName, NULL
mov wc.lpszClassName, offset ClassName
invoke LoadIcon, hInstance, IDI_ICON1 
mov wc.hIcon, eax 
mov wc.hIconSm, eax 
invoke LoadCursor, NULL, IDC_ARROW
mov wc.hCursor, eax 

invoke RegisterClassEx, addr wc


invoke CreateWindowEx, WS_EX_WINDOWEDGE, addr ClassName, addr AppName, WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 351, 282, NULL, NULL, hInst, NULL
mov hwnd, eax

invoke ShowWindow, hwnd, SW_SHOWDEFAULT
invoke UpdateWindow, hwnd

.while TRUE
invoke GetMessage, addr msg, NULL, 0, 0 
.break .if (!eax)
invoke TranslateMessage, addr msg
invoke DispatchMessage, addr msg
.endw

mov eax, msg.wParam
ret 

WinMain endp 

;################################################################

WndProc proc wnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local pt: POINT
local WindowID: HWND

.if uMsg == WM_CREATE 

invoke SetTimer, wnd, 1, 1, NULL

invoke CreateFont, 12, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH + FF_DONTCARE, addr FontName
mov hFont, eax

invoke CreateWindowEx, NULL, addr Static, NULL, WS_VISIBLE+SS_BITMAP+WS_CHILD, 7, 7, 200, 200, wnd, NULL, hInstance, NULL
mov StaticID, eax

invoke LoadBitmap, hInstance, 103
invoke SendMessage, StaticID, STM_SETIMAGE, IMAGE_BITMAP, eax

invoke CreateWindowEx, NULL, addr Button, addr WindowCaption, BS_GROUPBOX+WS_CHILD+WS_VISIBLE, 7, 70, 331, 55, wnd, NULL, hInstance, NULL
mov FrameID, eax

invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr TextBox, NULL, WS_BORDER+WS_CHILD+WS_VISIBLE, 12, 85, 320, 33, wnd, NULL, hInstance, NULL
mov TextBoxID, eax 

invoke CreateWindowEx, NULL, addr Button, addr WindowClass, BS_GROUPBOX+WS_CHILD+WS_VISIBLE, 7, 120, 331, 55, wnd, NULL, hInstance, NULL
mov FrameID2, eax

invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr TextBox, NULL, WS_BORDER+WS_CHILD+WS_VISIBLE, 12, 135, 320, 33, wnd, NULL, hInstance, NULL
mov TextBoxID2, eax 

invoke CreateWindowEx, NULL, addr Button, addr WindowHandle, BS_GROUPBOX+WS_CHILD+WS_VISIBLE, 7, 170, 331, 55, wnd, NULL, h
Posted on 2001-02-18 17:04:00 by Stefan Krause
thanks stefan! i can finish this program now hehe =).
Posted on 2001-02-19 14:56:00 by hehe