f

OleServer - Console Window Problem

Hi All,

I hope this question isn't too dumb!

I have been testing the Oleserver capability. I can compile the
Program 1 code below (which I think is by Ron Pinkas) into a DLL and I
can call it from the xHB test program (Program 2) with no problems.

But if I convert the test program to run under VB6 (Program 3), it
runs okay but as soon as the createobject is called a console window
entitled 'Visual Basic 6.0' is opened. When the program finishes, the
window remains open. If I close it, the whole of Visual Studio is
closed as well. How can I call the oleserver 'silently' so that no
console window is opened? Or alternatively how do I close it with out
bringing down the calling program? Anybody else seen this problem? One
final point, I was wondering if it was something to do with the
CreateInstance function in the sample code, should I call this? And if
so how?

Program 1
//-------------------------------------------------------------------------=
#pragma BEGINDUMP
#define CLS_Name "SampleOleServer"
#define CLS_ID   "{D385CFF0-01BE-42ea-8272-336CDE8ABA5A}"
#include "OleServer.h"
#pragma ENDDUMP

#include "hbclass.ch"

/*
OPTIONAL FUNCTION - if exists it will set the Server to a specific
Object
Instance  or you may return the same Object previously created if you
want all OLE
intanaces  to refer to just one Object.
*/
FUNCTION CreateInstance
LOCAL oOleServer :=3D MyOleServer()

// Transfer all errors to the Client
ErrorBlock( {|e| Break(e) } )

/*   If you return an Object, it becomes *the* Server, otherwise the
non
ststic PROCEDURES and FUNCTIONS
of this module will be the exported Methods, and PUBLICS MEMVARS
will
be the exported Properties.
*/

RETURN oOleServer

CLASS MyOleServer
PUBLIC:
DATA MyProperty
METHOD MyMethod( x )
ENDCLASS

METHOD MyMethod( x ) CLASS MyOleServer
::MyProperty :=3D x
IF HB_IsByRef( @x )
SWITCH ValType( x )
CASE 'C'
x :=3D "Modified!"
EXIT
CASE 'D'
CASE 'N'
x++
EXIT
CASE 'A'
x :=3D { "Modified!" }
EXIT
END
ENDIF

RETURN Self
//-------------------------------------------------------------------------=

Program 2 - xHarbour test sample:
//-------------------------------------------------------------------------=
PROCEDURE Main()
LOCAL oServer, xByRef
oServer :=3D CreateObject( "SampleOleServer" )
oServer:MyMethod( "test" )
? ValToPrg( oServer:MyProperty )
RETURN
//-------------------------------------------------------------------------=

Program 3 - VB6 test sample:
*-------------------------------------------------------------------------=
Private Sub Command1_Click()
Dim oServer
Set oServer =3D CreateObject("SampleOleServer")
oServer.MyMethod ("test")
MsgBox oServer.MyProperty
Set oServer =3D Nothing
End Sub
*-------------------------------------------------------------------------=


 0
jevais2007 (13)
3/7/2008 4:58:29 PM
comp.lang.xharbour 5470 articles. 0 followers.

2 Replies
333 Views

Similar Articles

[PageSpeed] 14

Add to top of oleserver source:

REQUEST HB_GT_NUL_DEFAULT

Ron

"Sarrazac" <jevais2007@gmail.com> wrote in message
Hi All,

I hope this question isn't too dumb!

I have been testing the Oleserver capability. I can compile the
Program 1 code below (which I think is by Ron Pinkas) into a DLL and I
can call it from the xHB test program (Program 2) with no problems.

But if I convert the test program to run under VB6 (Program 3), it
runs okay but as soon as the createobject is called a console window
entitled 'Visual Basic 6.0' is opened. When the program finishes, the
window remains open. If I close it, the whole of Visual Studio is
closed as well. How can I call the oleserver 'silently' so that no
console window is opened? Or alternatively how do I close it with out
bringing down the calling program? Anybody else seen this problem? One
final point, I was wondering if it was something to do with the
CreateInstance function in the sample code, should I call this? And if
so how?

Program 1
//-------------------------------------------------------------------------�-----------------------//
#pragma BEGINDUMP
#define CLS_Name "SampleOleServer"
#define CLS_ID   "{D385CFF0-01BE-42ea-8272-336CDE8ABA5A}"
#include "OleServer.h"
#pragma ENDDUMP

#include "hbclass.ch"

/*
OPTIONAL FUNCTION - if exists it will set the Server to a specific
Object
Instance  or you may return the same Object previously created if you
want all OLE
intanaces  to refer to just one Object.
*/
FUNCTION CreateInstance
LOCAL oOleServer := MyOleServer()

// Transfer all errors to the Client
ErrorBlock( {|e| Break(e) } )

/*   If you return an Object, it becomes *the* Server, otherwise the
non
ststic PROCEDURES and FUNCTIONS
of this module will be the exported Methods, and PUBLICS MEMVARS
will
be the exported Properties.
*/

RETURN oOleServer

CLASS MyOleServer
PUBLIC:
DATA MyProperty
METHOD MyMethod( x )
ENDCLASS

METHOD MyMethod( x ) CLASS MyOleServer
::MyProperty := x
IF HB_IsByRef( @x )
SWITCH ValType( x )
CASE 'C'
x := "Modified!"
EXIT
CASE 'D'
CASE 'N'
x++
EXIT
CASE 'A'
x := { "Modified!" }
EXIT
END
ENDIF

RETURN Self
//-------------------------------------------------------------------------�-----------------------//

Program 2 - xHarbour test sample:
//-------------------------------------------------------------------------�-----------------------//
PROCEDURE Main()
LOCAL oServer, xByRef
oServer := CreateObject( "SampleOleServer" )
oServer:MyMethod( "test" )
? ValToPrg( oServer:MyProperty )
RETURN
//-------------------------------------------------------------------------�-----------------------//

Program 3 - VB6 test sample:
*-------------------------------------------------------------------------�-----------------------
Private Sub Command1_Click()
Dim oServer
Set oServer = CreateObject("SampleOleServer")
oServer.MyMethod ("test")
MsgBox oServer.MyProperty
Set oServer = Nothing
End Sub
*-------------------------------------------------------------------------�-----------------------


 0
Ron6402 (371)
3/7/2008 6:23:00 PM
Thanks once again Ron for your speedy reply.

Not sure exactly what it does but it works!

Okay now I have got the test program working, i'll try and adapt a
'real' program
to run as an OLE server... No doubt i'll have further questions :-)

Richard


 0
jevais2007 (13)
3/7/2008 7:09:28 PM

Similar Artilces:

Windows 7 and Eudora 7.1: problems, problems and problems.

Windows 98SE-- Windows explore problem
When ever I try to invoke windows explorer I get a blue screen message with: 0028; C000B28A IN VXD VMM(01) + 0000A28A Can someone shed some light on how I can repair this problem? Thanks, John "john" <z2345678998765432y@sbcglobal.net> wrote in message news:kr7ntv4oonaqv3o3jp4eu8ecg214ne31gi@4ax.com... > > When ever I try to invoke windows explorer I get a blue screen > message with: > > 0028; C000B28A IN VXD VMM(01) + 0000A28A > VXD is virtual device driver and VMM is virtual memory manager, so first guess is bad RAM. Take the RA...

VB6 and Windows Installer problem on Windows 2000
Hi, I've got Visual Studio 6.0 sp5 installed on a Toshiba laptop running Windows 2000 pro. Whenever I start Visual Basic, Windows Installer starts up and tries to install some unknown component, after clicking cancel Visual Basic hangs up. Help!!! Thanks, McFly Thanks anyway, A key in the windows registry was missing for some MS Office component. The Event Viewer gave the clue to solve this problem. I don't know why vb was triggering that event. Regards, McFly. ...

Windows 2000, Windows 98 dual boot problem
Hello, I have 60 gig WD drive which is partitioned into 5 gig, 35 gig, and 20 gig. 5 gig is in FAT32 with Windows 98 is installed. 35 gig partition is in NTFS with Windows 2000 installed. 20 gig partition will be used for RH Linux and is in FAT32 as of now. The problem that I am running into is that I get inaccessible_boot_device error after installing SP2. BTW, I am running EZBIOS to get my hard drive recognized as 60 gig instead of 30 gig. Your help is much appreciated. -Steve ...

windows 2000 and windows xp networking problem with athentication

Windows NT 4.0 Command Window Problem
For some strange reason the other day I noticed that the command windows (cmd.exe) will not open properly on one of our NT 4.0 servers. I noticed that the cmd.exe process shows up in the process list, but the window never opens. I have tried logging out and back in, but still the same problem occurs. I realize that a reboot would probably clear up the problem, but I wanted to find out if there is a way to correct it without resorting to a reboot since it is our e-mail server. Is there some other process which may be hung up, or crashed to create this problem? Is there anything I c...

Windows problem
Sorry to ask on this news group, but it is the most knowledgeable. My son's friend has a laptop with hard drive partitioned in 2. Windows is on the smaller partition - as is My Documents. She wants My Documents to be on the larger partition, and to be the default when any application saves data. Thank Goodness RISC OS allows you to choose your own! Any suggestions? My son has laready been on the MS knowledge site... to no avail. Hope everyone is having a good Christmas. -- Dave Wisnia, Leeds In message <fbcc60234d.dswis@freeuk.net> David <dswis@freeuk.com> wrote: ...

More Windows Problems!
http://www.annoyances.org/ -- Cheers, Bob S Bob S wrote: > http://www.annoyances.org/ Check out www.macfixit.com and read about some of the problems people have had with 10.3.5. Fortunately it installed fine on my Powerbook. John wrote: > Bob S wrote: >> http://www.annoyances.org/ > > > Check out www.macfixit.com and read about some of the problems people > have had with 10.3.5. Fortunately it installed fine on my Powerbook. Your post wasn't physically damaging, the way banging my head against the wall would have been, yet it achieved the same results mentally... duhh... what's going on... what's he trying to tell us... :-) -- Edwin ...

Problem with windows me
Hi everybody, Last week I had a problem that I've never had with my clipper program (DOS). I was doing a demo of my program... I entered a new article, saved it, pressed F1 to see my list of articles and it never appeared. I couldn't make it work!! So strange!! I had to complete my demo on my notebook. Does anybody know what could be happening? PS: This program has been working fine for many years (6-7) and I've never had this strange problem even on other Windows ME systems. Thanks in advance Mariano Donaldson pony@fibertel.com.ar Buenos Aires, Argentina Dear pony: "...

connection problem to sql 2000 on windows 2003 from Windows 95
Hi all, I have a Windows 2003 server, which is also a terminal server for application, with sql 2000 installed. My company has developed an application that uses SQL 2000 as its database. The application is a client/server one. In each client computer there's a link to the application on the server. There is no problem with Windows 98, Windows 2000 pro, Windows xp pro clients, but the windows 95 ones cannot log in to the database. The log of the application shows the following error: connection error -2147467259. Cannot open database requested in login 'database name'. Login fails. Till a week ago the application was running on a Windows 2000 server with SQL 2000 install and the W95 clients had no problem connecting to the database, so my guess is the error has something to do with Windows 2003 server, but what'causing the error? I tried to install a newer version of MDAC (MDAC 2.5, the last version of MDAC you can install on W95)but with no success. By the way W95 clients have no problem accessing shared folder on the Windows 2003 server. Any idea? Thanks Marino [posted and mailed, please reply in news] Marino (mmagi@itconsult.it) writes: > I have a Windows 2003 server, which is also a terminal server for > application, with sql 2000 installed. My company has developed an > application that uses SQL 2000 as its database. The application is a > client/server one. In each client computer there's a link to the > application on the server. ...

Windows problem

Strange problem: no problem with Linux, when I boot windows 2K network is down...
Guys: This is very strange problem, looklike this problem is not going to leave me for months. I have a computer with Windows2K and Linux. I have Netgear 4-port Switch/Router (connected to DSL modem). If I boot with Linux, everything is OK, I can be on-line, also two of my other computers works fine. If I boot my PC with Win2K, then immediately all computers are down. None of the computer connected to network. I thought some problem with LAN card, so I went for early bird sale on day after Thanksgiving and I got one LinkSys PCI LAN card and one Router and I plugged new LAN card into my machine, then I booted with Windows, same problem. No problem on Linux side, then I changed my Router with new Router, samething. CAN SOME EXPERT SUGGEST ME, WHAT IS HAPPENING with my Win2K machine. But if I bypass Router and connect directly from DSL modem to my Win2K PC, then it is working. Why win2K pc is not working with Router. I have two more XP machines connected top 4-port switch (one is with cable and other one is with 802.11), they are working fine. Can somebody suggest me, how can I fix this. I verified MAC address, all are Unique MAC's. Thanks in advance. Santa wrote: > Guys: > > This is very strange problem, looklike this problem is not going to > leave me for months. I have a computer with Windows2K and Linux. I > have Netgear 4-port Switch/Router (connected to DSL modem). If I boot > with Linux, everything is OK, I can be on-line, also two of my other...

Session problem with new IE browser window from window.open()
Hello, I am running into this strange session invalid issue when I open a new browser window using javascript's window.open(). I have a portlet running on Jetspeed portal. I have two different links on this portal which point to two different applications running on two "different" ports on an application server. On click of each link I invoke window.open() with the URL for that link and it invokes a child browser with that URL. Now, when I click both the links from the parent window, I am able to open 2 different browser windows but when I try to access the applications in these...

More problems with Windows
<http://youtu.be/04jsncsgrjo> Notice how easy it is to fix problems on a Mac. :) -- [INSERT .SIG HERE] "Snit" <usenet@gallopinginsanity.com> wrote in message news:C8F99719.81D74%usenet@gallopinginsanity.com... > <http://youtu.be/04jsncsgrjo> > > Notice how easy it is to fix problems on a Mac. :) > > > -- > [INSERT .SIG HERE] > > Keep begging for my attention On Fri, 05 Nov 2010 11:12:25 -0700, Snit <usenet@gallopinginsanity.com> wrote: ><http://youtu.be/04jsncsgrjo> > >Noti...

window problems
Hi I'm layouting a book in second edition. the book has some paragraphs which have a textwindow in which central passages of the text are highlighened in a framed box. These windows make problems because I can't control the space between the text on top of the box and the box sometimes the frame of the box is too close to the top text. fx. when the pagebreaks in the paragraph where the box is. the original definition of my "fenster" environment was as follows. **************************** \newenvironment{fenster}[3] {\begin{window}[#1,#2, {\fbox{\small{\textbf{\shortstack[c]{#3}}} %{\fbox{#1} }},{}]} {\end{window}} **************************** it is called with the following \begin{fenster}{2}{r}{I 59\% af de \\ amerikanske \\ unders�gelser har \\ musikken en \\ stimulusfunktion.} I 59\% af de amerikanske unders�gelser har musikken en stimulusfunktion. Meget p�faldende bruger ingen af de....... \end{fenster} *********************** Here the shortstack gives the problem that the linespacing is larger for lines with g or j and and those without. minipage solves the problem with the linespacing but not the one with the distance between the box and its text on top. To solve the probelm with the topdistance i define to boxes inside eachother where the outer one has no surrounding line. definition: *******************************' \newenvironment{minifenster}[4] {\begin{window}[#1,#2, {\let\\=\space % removes all the l...

Problems problems....
I've got Fujitsu MAN3184MP and Adaptec 29160 scsi card. Sometimes i have this message "A disk read error occured" , sometimes even bios does not recognize it, sometimes it does but the boot sequence does not start it seems that motherboard bios has problems with it ( so it seems to me, i could be wrong about that assumption) . Then i reset and it all works perfectly. I've noticed a speed degradation in Win XP lately. I'm angry :)) I have LVD/SE terminator, and i think 68pin cable ( not sure about that ). Hope i gave you enough info to try and help. Thanx! -- ----------------------------------- Makni #### iz adrese Seems obvious that the drive is going belly up. You could download the manufacture's utility disk and confirm it. I think time would more wisely be spent backing up your data before you can't read it at all. DaveL "biBU" <idolovcak####@inet.hr> wrote in message news:cuslus$ljq$1@fegnews.vip.hr... > I've got Fujitsu MAN3184MP and Adaptec 29160 scsi card. > > Sometimes i have this message "A disk read error occured" , sometimes even > bios does not recognize it, sometimes it does but the boot sequence does > not start it seems that motherboard bios has problems with it ( so it > seems to me, i could be wrong about that assumption) . Then i reset and it > all works perfectly. I've noticed a speed degradation in Win XP lately. > I'm angry :)) > > ...

Problem Window width/Window Level for 16 bit image
Hai Everybody In my viewer when ever i open a 12-16 bit image. when the image load on to viewer i apply the default window width window level. But it does not apply properly. I get a blur image in the viewer. I have applied the same formula which was mentioned in the IOD 04v06_03 C.11.2.1.2 that was also not working. The formular which we apply are int maxPixelValue = (samplesPerPixel * 8) - 1; maxInputRange = (int) (Math.pow(2, maxPix) - 1); int maxOutputRange=255; LookupTableJAI currentLUT = createLookupTable(maxInputRange, maxOutputRange, window, level); RenderedImage destination = JAI.create("lookup", source, currentLUT); ParameterBlock pb = new ParameterBlock(); pb.addSource(destination); pb.add(DataBuffer.TYPE_BYTE); destination = JAI.create("format", pb, null); //creates the lookuptable public static LookupTableJAI createLookupTable(int maxInputRange, int maxOutputRange, int window, int level) { int minOutputRange = 0; int midWindow = (int) (window / 2); int windowStart = level - midWindow; int windowEnd = level + midWindow; if (windowStart <= 0) { windowStart = 0; } if (windowStart > maxInputRange) { windowStart = maxInputRange; } if (windowEnd < 0) { windowEnd = 0; } if (windowEnd > maxInputRange) { windowEn...

[News] [Rival] Vietnam Has a Windows Zombies Problems; Windows Malware Everywhere
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Vietnam Rejects Google Cyber-attack Charges ,----[ Quote ] | The Vietnamese government refuted charges | of a cyber-attack targeting opponents of a | Chinese-backed mining operation, calling | Google's comments "groundless." According | to McAfee, the attack created a botnet of | infected Windows PCs and launched | distributed denial-of-service attacks | against certain political blogs. ---- http://www.eweek.com/c/a/Security/Vietnam-Rejects-Google-Cyber-Attack-Charges-181868/ Trojans continue to hit hard says Sunbelt Software ,----[ Quote ] | The latest monthly set of research from | Sunbelt Software shows that trojans | continue to wreak havoc with business | computers far and wide, with two trojans – | Trojan.Win32.GenericBT (31.07%) and Trojan- | Spy.Win32.Zbot.gen (4.97%) – making up over | a third of all detections during the month. ---- http://www.infosecurity-magazine.com/view/8627/trojans-continue-to-hit-hard-says-sunbelt-software/ Kids’ Choice Awards Exploited to Distribute FAKEAV ,----[ Quote ] | The experts commented that this business of | fake anti-virus proves extremely lucrative | for cyber-criminals as they reap massive | amounts of dollars using bogus malware- | fighting modules. They note that these | criminals have left no region on the globe | untouched to target with bogus AV | applications `---- http://www.spamfighter.com/News-14166-Kids-Choice-Awards-Exploited-to-Di...

problem to migrate from xharbour 0.99 to xharbour 1.20.01

WINDOWS XP PRO --> WINDOWS 2003 SERVER
Hello, I want to add to the domain a computer but I can't. Client PC with Windows XP Pro can only see itself and the same with the windows 2003 server. The ping doesn't work. Maybe the problems are the IP numbers? Hardware is correctly installed and appears in both computers the network icon working. Can someone help me? Thanks in advance. PeeWee You must get basic network TCP/IP connectivity working first. PING tests will help. Once that happens then try joining the PC to the domain. Can you describe your network and TCP/IP network addressing? ...

Problem Deleting Window
Hi there, i am doing something severly wrong, i have a wxControl with a sizer. To this control i add dynamically other controls, and append them to the sizer, but when i want to delete those controls i get: \wxWidgets-2.8.7\src\msw\window.cpp(553): 'DestroyWindow' failed with error 0x00000005 (zugriff verweigert). this is rather random , i am somehow initialising my child objects not correctly, i just found out it has something to do with the sizer.... please, any hints are greatly appreciated ! thx ck ...

Putty from Windows XP to Windows 2000 pro server
I've been using Putty telnet for some time (and very satisfactorily) to connect to a Solaris server. Now I'm trying to use it to connect to a Windows 2000 server. The character based application on the server uses tip files to control screen addressing - line draw chars, cursor movement, reverse type etc. - and to interpret function, delete, insert keys etc. However I can't find a combination of putty configuration setting and tip file which is entirely OK. On unix it's easy to trap function key sequences and modify tip files, but how do you do this on windows? I'd be grateful for help with this. ...

Problem with command pipeline and space in file name between Windows XP and Windows 7
I'm using command pipeline to start a another TCL script and I'm redirectin= g stderr out to a file. The following works fine on Windows 7/Linux even w= hen the value of error_log_file has a space in it. Note, $cmd has quite a f= ew arguments in it and it was "built up" using lappend. =20 if [catch {open "|$cmd 2>$error_log_file" "w+"} file_id] { When this is run on Windows XP, and error_log_file has a space in the filen= ame (or path), then everything up until the first space is being included a= s part of the command to run. No good. Any ideas how to get this to work? Thanks Al Silverstein You might try one of the following - use [file attributes$error_log_file -shortname] so you pass the 8.3 form= at file name without spaces, or - enclose the $error_log_file in escaped quotes (\") On Thursday, October 17, 2013 8:33:30 AM UTC+5:30, asilver wrote: > I'm using command pipeline to start a another TCL script and I'm redirect= ing stderr out to a file. The following works fine on Windows 7/Linux even= when the value of error_log_file has a space in it. Note,$cmd has quite a= few arguments in it and it was "built up" using lappend. =20 >=20 >=20 >=20 > if [catch {open "|$cmd 2>$error_log_file" "w+"} file_id] { >=20 >=20 >=20 >=20 >=20 > When this is run on Windows XP, and error_log_file has a space in the f...

Lookup Table Problem =?windows-1252?Q?=96_No_in_Ascending_?= =?windows-1252?Q?order?=
I�m using Access 97. I have a table with a few fields. One field I used the lookup wizard to create a lookup table from a second table. How can I get the lookup table to display in ascending order? I�ve saved the second table (used by the lookup table) in ascending order however the lookup table is always being displayed in the same order as the items were entered into the second table. George ...

MFC-app starting WINDOWS screen-saver window z-order/focus problem
Hi! I wrote an MFC-app using VC++.NET 2003, which starts a screensaver using CreateProcess(). It also terminates the screensaver using TerminateProcess() / CloseHandle(). If the user activates mouse/keyboard before my app terminates the screensaver-process, the screensaver terminates itself and the z-order and focus-handling of open windows somehow gets mixed up. this just happens when I use CreateProcess(), when I use PostMessage(WM_SYSCOMMAND, SC_SCREENSAVE, 0) for the standrad-screen-saver, everything works fine, but I dont want to use this approach. maybe the system uses different CreateProcess()-params ??? I am using the follwing CreateProcess() call: ::CreateProcess(NULL, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &m_si, &m_pi); any idea/help on how to solve this issue would be greatly appreciated, thanx in advance! regards, Hans ...

Web resources about - OleServer - Console Window Problem - comp.lang.xharbour

Resources last updated: 3/22/2016 8:16:00 PM