| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hello, I am trying to rewrite this Delphi code for Xharbour var h2:Thandle; ms:integer; begin h2:=findwindow('TForm2', nil); ms:=1024; if h2 <> 0 then begin postmessage(h2, ms, 0, 0); end; end; I use FindWindow API function to check whether an application is running or not and Postmessage to comunicate a message to this Delphi application . API Function's syntax is as following: HWND FindWindow( LPCTSTR lpClassName, // pointer to class name LPCTSTR lpWindowName // pointer to window name ); ------------------------------------------------------ BOOL PostMessage( HWND hWnd, // handle of destination window UINT Msg, // message to post WPARAM wParam, // first message parameter LPARAM lParam // second message parameter ); where i can find support or examples to implement this function with xharbour ? thanks, Eugenio. |
|
#2
| |||
| |||
| Eugenio Belli napisał(a): > Hello, > > I am trying to rewrite this Delphi code for Xharbour > > var > h2:Thandle; > ms:integer; > begin > h2:=findwindow('TForm2', nil); > ms:=1024; > if h2 <> 0 then begin > postmessage(h2, ms, 0, 0); > end; > end; > > > I use FindWindow API function to check whether an > application is running or not and Postmessage to comunicate > a message to this Delphi application . > > > API Function's syntax is as following: > > HWND FindWindow( > > LPCTSTR lpClassName, // pointer to class name > LPCTSTR lpWindowName // pointer to window name > ); > > ------------------------------------------------------ > BOOL PostMessage( > > HWND hWnd, // handle of destination window > UINT Msg, // message to post > WPARAM wParam, // first message parameter > LPARAM lParam // second message parameter > ); > > > where i can find support or examples to implement this > function with xharbour ? Hi, Included in what32.lib . Sources in \contrib\what32 : _winwnd.c : (...) HB_FUNC( FINDWINDOW ) { hb_retnl((ULONG) FindWindow( (LPCSTR) hb_parcx(1), ISCHAR(2) ? hb_parcx(2):NULL ) ) ; } (...) _winmsg.c : (...) HB_FUNC( POSTMESSAGE ) { char *cText = NULL; if (ISBYREF(4)) { cText = (char*) hb_xgrab( hb_parcsiz(4) ); hb_xmemcpy( cText, hb_parcx(4), hb_parcsiz(4) ); } hb_retnl( (LONG) PostMessage( (HWND) hb_parnl( 1 ), (UINT) hb_parni( 2 ), (ISNIL(3) ? 0 : (WPARAM) hb_parnl( 3 )) , (ISNIL(4) ? 0 : ( ISBYREF(4)? (LPARAM) (LPSTR) cText : ( ISCHAR(4) ? (LPARAM)(LPSTR) hb_parcx(4) : (LPARAM) hb_parnl( 4 )))) ) ); if( ISBYREF( 4 ) ) { hb_storclen( cText, hb_parcsiz(4), 4 ) ; hb_xfree( cText ); } } (...) Regards JoteR |
|
#3
| |||
| |||
| Il Fri, 29 Aug 2008 10:31:29 +0200, Eugenio Belli <no@spam.it> ha scritto: I am trying this : procedure winmsg FINDWIN( "TFORM2", 0 ) RETURN #pragma BEGINDUMP #include "windows.h" #include "hbapi.h" HB_FUNC( FINDWIN ) { hb_retnl( (LONG) FINDWINDOW( hb_parnl(1), hb_parc(2) ) ); } #pragma ENDDUMP I obtain this compiler message: Warning W8065 winmsg.prg 16:Call to function 'FINDWINDOS' with non prototype in function HB_FUN_FINDWIN |
|
#4
| |||
| |||
| Il Fri, 29 Aug 2008 02:37:32 -0700 (PDT), J_Rudnicki@wp.pl ha scritto: I read now your message, please ignore my previous reply eugenio. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.