Hi Mindaugas, Pritpal,
I was just writing about and Mindaugas sent this mail, great!
I was thinking about adding a separate handling for ActiveX code to
leave isolate as Ole code we already have, so it will be enough (!) to
add an upper layer where ActiveX can attach itself without needs of
gtwvg and passing only hWnd to it.
Obviously nothing against gtwvg but in this way that code it will be
more general and usable also with other libs.
What do you think about ?
Best Regards,
Francesco
Il 18/05/2009 21.38, Mindaugas Kavaliauskas ha scritto:
Hi,
I've tried to add ActiveX to my plain WinAPI Hello world sample. I
needed to add *TWO* lines (marked by /* !!!*/) below and #pragma
begindump/enddump. THAT'S ALL! I understand that event handler is
missing and OleAutomation object should be created, but this is not so
much code. I have a feeling, that if I'll do some ActiveX support, I'll
do that starting from zero, instead of trying to analyse all current
code. WARNING: The bad side will be that my code could be not compatible
to existing one, the good one is that it will be simple and clear.
===============================================
#include "c:\cawi32\include\windows.ch"
REQUEST HB_GT_NUL_DEFAULT
FUNC main()
LOCAL nAddr, hWnd, cMsg
AtlAxInit() /* !!! */
nAddr := MakeWndProc({|X,Y,Z,T| WndProc(X,Y,Z,T)})
RegisterClass("MainWndCls",, COLOR_WINDOW + 1, LoadCursor(EMPTYPTR(),
IDC_ARROW), LoadIcon(EMPTYPTR(), IDI_APPLICATION),,,, nAddr)
hWnd := CreateWindow("MainWndCls", "CAWI32 Sample Hello",
WS_OVERLAPPEDWINDOW, 100, 100, 600, 500)
ShowWindow(hWnd, SW_SHOWNORMAL)
UpdateWindow(hWnd)
DO WHILE GetMessage(@cMsg)
TranslateMessage(cMsg)
DispatchMessage(cMsg)
ENDDO
RETURN 0
FUNC WndProc(hWnd, nMsg, wParam, lParam)
LOCAL hDC, sPS, hMenu, hSubMenu
IF nMsg == WM_CREATE
CreateWindow("ATLAXWin", "http://www.harbour-project.org", WS_CHILD
+ WS_VISIBLE + WS_BORDER + WS_HSCROLL + WS_VSCROLL, 10, 10, 500, 400,
hWnd) /* !!! */
ELSEIF nMsg == WM_PAINT
hDC := BeginPaint(hWnd, @sPS)
EndPaint(hWnd, @sPS)
ELSEIF nMsg == WM_DESTROY
PostQuitMessage()
RETURN 0
ENDIF
RETURN DefWindowProc(hWnd, nMsg, wParam, lParam)
PROC RDDSYS(); RETURN
PROC HB_GTSYS(); RETURN
#pragma begindump
#include "hbapi.h"
#include <windows.h>
static HMODULE hLib = NULL;
HB_FUNC( ATLAXINIT )
{
BOOL ( CALLBACK *pAtlAxWinInit )( void );
hLib = LoadLibrary( "atl.dll" );
if( ( unsigned long ) hLib > 32 )
{
pAtlAxWinInit = GetProcAddress( hLib, "AtlAxWinInit" );
if( pAtlAxWinInit )
( *pAtlAxWinInit )();
}
// I leave hLib not freed to avoid unloading of library
}
#pragma enddump
===============================================
You'll not be able to compile it, but all function are straight wrappers
of WinAPI (MakeWndProc() is an exception, it registers codeblock and
returns window procedure address). So, I hope you'll be able to create
ActiveX control in your environment, if you have idea how to create a
window in it and access hWnd.
Regards,
Mindaugas
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour