topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
|---|---|
Active Directory
|
Bryon
I find this works because it looks at the credentials of the workstation profile. In Microsoft the workstation profile and the AD network id should be the same and syncronized..
Works from Win98 thru Vista
xLOGIN := WNetGetUser() // FiveWin function
Rick Lipkin
SC Dept of Health, USA
|
Active Directory
|
Thank you, I will give this a try.
Byron...
|
Active Directory
|
Hi,
How can I read Active Directory ?
|
Active Directory
|
Hello Natter,
Maybe you can't run Powershell scripts with shellexec?
Then save the values to disk and read with memoread().
Best regards,
Otto
|
Active Directory
|
Look
[url:3m1xprc1]http://forums.fivetechsupport.com/viewtopic.php?f=3&t=26995&p=242438&hilit=Active+Directory&sid=0c85557c1211e48bad1107712649f5be&sid=0c85557c1211e48bad1107712649f5be#p242438[/url:3m1xprc1]
|
Active Directory
|
Thank you, Cristobal! I wanted to read the user's full name from the domain
|
Active Directory
|
Natter
Active Directory looks very much like any Sql Database ... here is how I access Active DIrectory
[code=fw:w8f8mtpv]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//----------------------</span><br />Func _UserGet<span style="color: #000000;">(</span> cMode,cAdFind,oAdFind,cUserId,oUserId,cFullName,oFullName,cLname,oLname,cFname,oFname,cPhone,oPhone,cFrom,cDomain,;<br /> oButt1,oButt2,oButt3,oButt4,oButt5,oButt6<span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Local</span> oDLG,oLBX,lOk3<br /><span style="color: #00C800;">Local</span> oRsAd,oCn,cConnect,cSql,oErr<br /><span style="color: #00C800;">Local</span> oProp,oRs<br /><span style="color: #00C800;">Local</span> aData,aHead,nI,aReg<br /><br /><span style="color: #00C800;">Local</span> oBtn1,oBtn2<br /><span style="color: #00C800;">Local</span> Saying,cValue<br /><br /><span style="color: #00C800;">If</span> cMode = <span style="color: #ff0000;">"V"</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.t.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #00C800;">If</span> cMode = <span style="color: #ff0000;">"R"</span> .and. cUserId = <span style="color: #ff0000;">"All"</span><br /> <span style="color: #00C800;">If</span> cFrom = <span style="color: #ff0000;">"BUTTON"</span><br /> <span style="color: #00C800;">Else</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.t.<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #00C800;">If</span> empty<span style="color: #000000;">(</span> cFrom <span style="color: #000000;">)</span><br /> cFrom := <span style="color: #ff0000;">"FIELD"</span><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #00C800;">If</span> Empty<span style="color: #000000;">(</span> cDomain <span style="color: #000000;">)</span><br /> Saying := <span style="color: #ff0000;">"Sorry .. the Domain Name has not been defined"</span><br /> <span style="color: #0000ff;">Msginfo</span><span style="color: #000000;">(</span> Saying <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br /><br /><span style="color: #00C800;">If</span> cFrom = <span style="color: #ff0000;">"FIELD"</span><br /> cAdFind := alltrim<span style="color: #000000;">(</span> oAdFInd:<span style="color: #000000;">GetText</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #00C800;">If</span> empty<span style="color: #000000;">(</span>cAdFind<span style="color: #000000;">)</span> .or. cAdFind = <span style="color: #ff0000;">" "</span><br /> cAdFInd:= <span style="color: #ff0000;">"Bogus"</span><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #B900B9;">// make sure there are no illegal charactors</span><br /><span style="color: #00C800;">If</span> _NameCHk<span style="color: #000000;">(</span> cAdFind,.t.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Else</span><br /> cAdFInd := Space<span style="color: #000000;">(</span><span style="color: #000000;">35</span><span style="color: #000000;">)</span><br /> oAdFind:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oAdFInd:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br />cDomain := <span style="color: #ff0000;">"LDAP://"</span>+alltrim<span style="color: #000000;">(</span>cDomain<span style="color: #000000;">)</span> <span style="color: #B900B9;">// cDomain is the name of your Domain e.g. SC.DHEC.Gov</span><br />cConnect := <span style="color: #ff0000;">"Active Directory Provider"</span><br /><br />oCn := CREATEOBJECT<span style="color: #000000;">(</span> <span style="color: #ff0000;">"ADODB.Connection"</span> <span style="color: #000000;">)</span><br />oCn:<span style="color: #000000;">Provider</span> := <span style="color: #ff0000;">'ADsDSOObject'</span><br /><br /><span style="color: #00C800;">TRY</span><br /> oCn:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> cConnect <span style="color: #000000;">)</span><br />CATCH oErr<br /> Saying := <span style="color: #ff0000;">"Could not open a Global Connection to Domain "</span>+cDomain<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> Saying <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span>.F.<span style="color: #000000;">)</span><br />END <span style="color: #00C800;">TRY</span><br /><br />*<span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Connection Established"</span> <span style="color: #000000;">)</span><br /><br />oRs := TOleAuto<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"ADODB.Command"</span><span style="color: #000000;">)</span><br />oRs:<span style="color: #000000;">ActiveConnection</span> := oCn<br /><br />cSQL := <span style="color: #ff0000;">"SELECT "</span><br />cSql += <span style="color: #ff0000;">" telephoneNumber,"</span><br />cSql += <span style="color: #ff0000;">" displayName,"</span> <span style="color: #B900B9;">// fullname</span><br />cSql += <span style="color: #ff0000;">" sAMAccountname,"</span> <span style="color: #B900B9;">// userid</span><br />cSql += <span style="color: #ff0000;">" sn,"</span> <span style="color: #B900B9;">// last name sn</span><br />cSql += <span style="color: #ff0000;">" givenname"</span> <span style="color: #B900B9;">// first name</span><br />cSql += <span style="color: #ff0000;">""</span><br />cSql += <span style="color: #ff0000;">" FROM '"</span>+cDomain+<span style="color: #ff0000;">"'"</span><br />cSql += <span style="color: #ff0000;">" WHERE objectCategory = 'person' AND"</span><br />cSql += <span style="color: #ff0000;">" objectClass = 'user' "</span><br /><br /><span style="color: #00C800;">DO</span> <span style="color: #00C800;">Case</span><br /><span style="color: #00C800;">Case</span> cAdFind = <span style="color: #ff0000;">"Bogus"</span><br /> <span style="color: #B900B9;">// do nothing .. full table scan</span><br /><span style="color: #00C800;">OtherWise</span><br /> cSql += <span style="color: #ff0000;">" and displayname = '*"</span>+alltrim<span style="color: #000000;">(</span>cAdFind<span style="color: #000000;">)</span>+<span style="color: #ff0000;">"*' "</span><br />End <span style="color: #00C800;">DO</span><br /><br />cSql += <span style="color: #ff0000;">" ORDER BY displayName"</span><br /><br />oRs:<span style="color: #000000;">CommandText</span> := cSql <span style="color: #B900B9;">//cString + cWhere</span><br /><br />oProp := oRs:<span style="color: #000000;">Properties</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">'SearchScope'</span> <span style="color: #000000;">)</span><br />oProp:<span style="color: #000000;">value</span> := ADS_SCOPE_SUBTREE<br /><br />oProp := oRs:<span style="color: #000000;">Properties</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">'Page size'</span> <span style="color: #000000;">)</span><br />oProp:<span style="color: #000000;">value</span> := <span style="color: #000000;">2000</span><br /><br /><span style="color: #00C800;">Try</span><br /> oRsAd := oRs:<span style="color: #000000;">Execute</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />Catch oErr<br /> <span style="color: #0000ff;">Msginfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"LDAP Query Execution Error"</span><span style="color: #000000;">)</span><br /> oCN:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br />End <span style="color: #00C800;">Try</span><br /><br />aData := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br />aHead := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /><span style="color: #B900B9;">// generate xBrowse headings</span><br />nFields := oRsAd:<span style="color: #000000;">Fields</span>:<span style="color: #0000ff;">Count</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">For</span> nI := <span style="color: #000000;">0</span> <span style="color: #0000ff;">TO</span> nFields - <span style="color: #000000;">1</span><br /> Aadd<span style="color: #000000;">(</span> aHead, oRsAd:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span>nI<span style="color: #000000;">)</span>:<span style="color: #0000ff;">name</span> <span style="color: #000000;">)</span><br /><span style="color: #00C800;">Next</span><br /><br /><br />nLen := oRsAd:<span style="color: #000000;">RecordCount</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">IF</span> nLen > <span style="color: #000000;">0</span><br /> oRsAd:<span style="color: #000000;">MoveFirst</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">Do</span> <span style="color: #00C800;">WHILE</span> .not. oRsAd:<span style="color: #000000;">Eof</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> aReg := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">For</span> nI := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> Len<span style="color: #000000;">(</span>aHead<span style="color: #000000;">)</span><br /> Aadd<span style="color: #000000;">(</span> aReg, oRsAd:<span style="color: #000000;">Fields</span><span style="color: #000000;">(</span> aHead<span style="color: #000000;">[</span>nI<span style="color: #000000;">]</span> <span style="color: #000000;">)</span>:<span style="color: #000000;">value</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">NEXT</span><br /><br /> <span style="color: #00C800;">If</span> empty<span style="color: #000000;">(</span> aReg<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span> .or. aReg<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> = <span style="color: #ff0000;">" "</span><br /> <span style="color: #00C800;">Else</span><br /> Aadd<span style="color: #000000;">(</span> aData, aReg <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENdif</span><br /><br /> oRsAd:<span style="color: #000000;">MoveNext</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">Enddo</span><br /><br /><span style="color: #00C800;">Else</span><br /> <span style="color: #0000ff;">Msginfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"No LDAP Data found"</span> <span style="color: #000000;">)</span><br /> oRsAd:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oCN:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span>.f.<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br />LightGreyGrad<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">If</span> cMode = <span style="color: #ff0000;">"R"</span><br /><span style="color: #00C800;">Else</span><br /> oButt1:<span style="color: #000000;">Disable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt2:<span style="color: #000000;">Disable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt3:<span style="color: #000000;">Disable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt4:<span style="color: #000000;">Disable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt5:<span style="color: #000000;">Disable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt6:<span style="color: #000000;">Disable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Endif</span><br /><br />lOk3 := .f.<br /><br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"USERSLCT"</span> ;<br /> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"User LDAP Look Up Table"</span> ;<br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">xBROWSE</span> oLBX ;<br /> ARRAY aData ;<br /> HEADERS <span style="color: #ff0000;">"FirstName"</span>, ;<br /> <span style="color: #ff0000;">"LastName"</span>, ;<br /> <span style="color: #ff0000;">"UserId"</span>, ;<br /> <span style="color: #ff0000;">"FullName"</span>, ;<br /> <span style="color: #ff0000;">"Phone"</span> ;<br /> COLSIZES <span style="color: #000000;">97</span>,<span style="color: #000000;">97</span>,<span style="color: #000000;">97</span>,<span style="color: #000000;">150</span> ;<br /> <span style="color: #0000ff;">ID</span> <span style="color: #000000;">111</span> <span style="color: #0000ff;">of</span> oDlg ;<br /> AUTOSORT <span style="color: #0000ff;">AUTOCOLS</span> LINES CELL<br /><br /> oLbx:<span style="color: #000000;">lHScroll</span> := .f. <span style="color: #B900B9;">// turn off horiz scroll bar</span><br /> oLbx:<span style="color: #000000;">lRecordSelector</span> := .f.<br /> oLbx:<span style="color: #000000;">nMarqueeStyle</span> := MARQSTYLE_HIGHLROW<br /><br /> oLbx:<span style="color: #000000;">bLDblClick</span> := <span style="color: #000000;">{</span> |nRow,nCol | <span style="color: #000000;">(</span>lOk3 := .t.,oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> _BrowColor<span style="color: #000000;">(</span>oLbx<span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> oBtn1 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">113</span> <span style="color: #0000ff;">of</span> oDlg ;<br /> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"OK"</span>, <span style="color: #ff0000;">"DOK"</span>, <span style="color: #ff0000;">"DOK"</span> ;<br /> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&Ok"</span> <span style="color: #0000ff;">LEFT</span> <span style="color: #000000;">2007</span>;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span>lok3 := .t., oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">REDEFINE</span> <span style="color: #0000ff;">BTNBMP</span> oBtn2 <span style="color: #0000ff;">ID</span> <span style="color: #000000;">112</span> <span style="color: #0000ff;">OF</span> oDlg ;<br /> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"CANCEL"</span>, <span style="color: #ff0000;">"DCANCEL"</span>, <span style="color: #ff0000;">"DCANCEL"</span> ;<br /> <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"&Cancel"</span> <span style="color: #0000ff;">LEFT</span> <span style="color: #000000;">2007</span>;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> lOk3 := .f.,oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg;<br /> <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">(</span> oDlg:<span style="color: #0000ff;">Move</span><span style="color: #000000;">(</span><span style="color: #000000;">100</span>,<span style="color: #000000;">400</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> ; <span style="color: #B900B9;">//, oLbx:SetFocus() );</span><br /> <span style="color: #0000ff;">VALID</span><span style="color: #000000;">(</span>!GETKEYSTATE<span style="color: #000000;">(</span> <span style="color: #000000;">27</span> <span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">If</span> lOk3 = .t.<br /><br /> cFname := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span>empty<span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span>,space<span style="color: #000000;">(</span><span style="color: #000000;">15</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #0000ff;">substr</span><span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span>+space<span style="color: #000000;">(</span><span style="color: #000000;">15</span><span style="color: #000000;">)</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">15</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> cLname := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span>empty<span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span>,space<span style="color: #000000;">(</span><span style="color: #000000;">15</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #0000ff;">substr</span><span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">2</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span>+space<span style="color: #000000;">(</span><span style="color: #000000;">15</span><span style="color: #000000;">)</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">15</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> cUserId := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span>empty<span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">3</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span>,space<span style="color: #000000;">(</span><span style="color: #000000;">25</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #0000ff;">substr</span><span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">3</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span>+space<span style="color: #000000;">(</span><span style="color: #000000;">25</span><span style="color: #000000;">)</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">25</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> cFullName := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span>empty<span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span>,space<span style="color: #000000;">(</span><span style="color: #000000;">35</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #0000ff;">substr</span><span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">4</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span>+space<span style="color: #000000;">(</span><span style="color: #000000;">35</span><span style="color: #000000;">)</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">35</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> cPhone := <span style="color: #00C800;">If</span><span style="color: #000000;">(</span>empty<span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">5</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span><span style="color: #000000;">)</span>,space<span style="color: #000000;">(</span><span style="color: #000000;">20</span><span style="color: #000000;">)</span>,;<br /> <span style="color: #0000ff;">substr</span><span style="color: #000000;">(</span>oLbx:<span style="color: #000000;">aCols</span><span style="color: #000000;">[</span> <span style="color: #000000;">5</span> <span style="color: #000000;">]</span>:<span style="color: #000000;">Value</span>+space<span style="color: #000000;">(</span><span style="color: #000000;">20</span><span style="color: #000000;">)</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">20</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> cAdFind := space<span style="color: #000000;">(</span><span style="color: #000000;">35</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">If</span> .not. empty<span style="color: #000000;">(</span>oUserId<span style="color: #000000;">)</span><br /> oUserId:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">If</span> .not. empty<span style="color: #000000;">(</span>oFullName<span style="color: #000000;">)</span><br /> oFullName:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">If</span> .not. empty<span style="color: #000000;">(</span>oLname<span style="color: #000000;">)</span><br /> oLname:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">If</span> .not. empty<span style="color: #000000;">(</span>oFname<span style="color: #000000;">)</span><br /> oFname:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">If</span> .not. empty<span style="color: #000000;">(</span> oPhone <span style="color: #000000;">)</span><br /> oPhone:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Endif</span><br /> oAdFind:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">ELse</span><br /><br /> cAdFind := space<span style="color: #000000;">(</span><span style="color: #000000;">35</span><span style="color: #000000;">)</span><br /> oAdFind:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #00C800;">If</span> cMode = <span style="color: #ff0000;">"R"</span><br /><span style="color: #00C800;">Else</span><br /> oButt1:<span style="color: #000000;">Enable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt2:<span style="color: #000000;">Enable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt3:<span style="color: #000000;">Enable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt4:<span style="color: #000000;">Enable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt5:<span style="color: #000000;">Enable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oButt6:<span style="color: #000000;">Enable</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">ENdif</span><br /><br />LightGreenGrad<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oRsAd:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />oCN:<span style="color: #000000;">CLose</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> Lok3 <span style="color: #000000;">)</span><br /><br /><br /> </div>[/code:w8f8mtpv]
[code=fw:w8f8mtpv]<div class="fw" id="{CB}" style="font-family: monospace;"><br />UserSLct.RC<br /><br /><span style="color: #B900B9;">// Generated by ResEdit 1.6.6</span><br /><span style="color: #B900B9;">// Copyright (C) 2006-2015</span><br /><span style="color: #B900B9;">// <!-- m --><a class="postlink" href="http://www.resedit.net">http://www.resedit.net</a><!-- m --></span><br /><br /><span style="color: #00D7D7;">#include</span> <windows.h><br /><span style="color: #00D7D7;">#include</span> <commctrl.h><br /><span style="color: #B900B9;">//#include <richedit.h></span><br /><span style="color: #B900B9;">//#include "resource.h"</span><br /><span style="color: #B900B9;">//</span><br /><span style="color: #B900B9;">// Dialog resources</span><br /><span style="color: #B900B9;">//</span><br />LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL<br />USERSLCT <span style="color: #0000ff;">DIALOG</span> <span style="color: #000000;">218</span>, <span style="color: #000000;">4294967278</span>, <span style="color: #000000;">324</span>, <span style="color: #000000;">228</span><br /><span style="color: #0000ff;">STYLE</span> DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP<br /><span style="color: #0000ff;">FONT</span> <span style="color: #000000;">8</span>, <span style="color: #ff0000;">"Arial"</span><br /><span style="color: #000000;">{</span><br /> CONTROL <span style="color: #ff0000;">"&Ok"</span>, <span style="color: #000000;">113</span>, <span style="color: #ff0000;">"TBtnBmp"</span>, 0x50010020, <span style="color: #000000;">232</span>, <span style="color: #000000;">195</span>, <span style="color: #000000;">41</span>, <span style="color: #000000;">25</span>, 0x00000000<br /> CONTROL <span style="color: #ff0000;">""</span>, <span style="color: #000000;">111</span>, <span style="color: #ff0000;">"TXBrowse"</span>, 0x50A10000, <span style="color: #000000;">4</span>, <span style="color: #000000;">1</span>, <span style="color: #000000;">315</span>, <span style="color: #000000;">180</span>, 0x00000000<br /> CONTROL <span style="color: #ff0000;">"&Cancel"</span>, <span style="color: #000000;">112</span>, <span style="color: #ff0000;">"TBtnBmp"</span>, 0x50010020, <span style="color: #000000;">276</span>, <span style="color: #000000;">195</span>, <span style="color: #000000;">41</span>, <span style="color: #000000;">25</span>, 0x00000000<br /><br /><br /> </div>[/code:w8f8mtpv]
[code=fw:w8f8mtpv]<div class="fw" id="{CB}" style="font-family: monospace;"><br />Func LightGreyGrad<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />SetDlgGradient<span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> .<span style="color: #000000;">50</span>, nRGB<span style="color: #000000;">(</span> <span style="color: #000000;">216</span>, <span style="color: #000000;">216</span>, <span style="color: #000000;">216</span> <span style="color: #000000;">)</span>, nRGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span><span style="color: #000000;">(</span><span style="color: #00C800;">nil</span><span style="color: #000000;">)</span><br /><br /><span style="color: #B900B9;">//--------------</span><br />Func LightGreenGrad<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br />SetDlgGradient<span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> .<span style="color: #000000;">50</span>, nRGB<span style="color: #000000;">(</span><span style="color: #000000;">210</span>,<span style="color: #000000;">235</span>,<span style="color: #000000;">216</span><span style="color: #000000;">)</span>, nRGB<span style="color: #000000;">(</span> <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span>, <span style="color: #000000;">255</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span><span style="color: #000000;">(</span><span style="color: #00C800;">nil</span><span style="color: #000000;">)</span><br /><br /><br /> </div>[/code:w8f8mtpv]
I use this code as an Employee look up to attach their AD name to a Computer or laptop .. Hope this helps
Rick Lipkin
|
Active Directory
|
Rick, thank you! I will definitely try.
|
Active Row-color in xBrowse lost ( after focus-change ) ?
|
Hello,I have 2 Questions :1. I noticed, after the browser lost the focus, the colors of the selected rows are grey.2. A normal text, written in a resource. Is it possible to be transparent like in the new radios and checkboxes when using a defined background ? ( see text < result > )[img:1qjpnnup]http://www.pflegeplus.com/pictures/gradient31.jpg[/img:1qjpnnup]Best RegardsUwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
Active Row-color in xBrowse lost ( after focus-change ) ?
|
Please set oBrw:bClrSel to the color you want the selected rows to be displayed when the browse loses focus
|
Active Sync Remote Display con WM6
|
Este es un truco que he econtrado por la red, por si le puede servir a alguien.Hasta la fecha yo venia utilizanndo Active Sync Remote Display, que me permitida manejar desde el PC los terminales Pocket PC, esto me va muy bien para el mantenimiento de unos terminales de una delegación remota en Sevilla (conecto con PC remoto, y desde ese PC con el terrminal PDA).Con los terminales que usaban WM2003, funcionaba perfecto, pero con los nuevos terminales con WM6, ha dejado de funcionar.Para poder seguir usando AS remote display, hay que copiar dos ficheros que se encuentran en la carpeta "C:\Program Files\Windows Mobile Developer Power Toys\ActiveSync_Remote_Display\devices\wce400\armv4t" de nuestro PC, y copiarlos en nuetro PDA dentro de la carpeta windows.Al ejectuar AS remote display aparece un mensaje de error que no conoce el SO o el procesador, pulsamos OK y acto seguido ya tenemos la pantalla de nuestra PDA en el PC.PD Puedes descargar las Windows Mobile Power Toys desde la pagina de Microsoft [url:3tlmplk4]http://www.microsoft.com/downloads/details.aspx?FamilyID=74473fd6-1dcc-47aa-ab28-6a2b006edfe9&DisplayLang=en[/url:3tlmplk4]
|
Active Sync Remote Display con WM6
|
Biel,Muchas gracias por la información <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
Active X Explorer
|
<!-- m --><a class="postlink" href="http://nolp.dhl.de/nextt-online-public/track.do?lang=de">http://nolp.dhl.de/nextt-online-public/track.do?lang=de</a><!-- m -->
This a tracking Page from DHL
How can i put Data from a dbf into Fields in Internet Explorer ?
Tx
|
Active X Explorer
|
Amiguinho
You can try a ASP Script, submiting data with GET METHOD:
[code:1zwxed3a]
<%@LANGUAGE = VBScript%>
<%
Dim nome,senha
nome = replace(request.form("nome"), "'", "''")
senha = replace(request.form("senha"), "'", "''")
Set DB = Server.CreateObject("ADODB.Connection")
cnpath="DBQ=" & server.mappath(".\")
DB.Open "Driver={Microsoft dBase Driver (*.dbf)};;" & cnpath
inserir = "INSERT INTO users (nome,senha) " & _
"VALUES ('" & nome & "','" & senha & "','" & pagina & "')"
DB.Execute(inserir)
%>
[/code:1zwxed3a]
Fivewin code:
[code:1zwxed3a]
STATIC FUNCTION NAVEGAR( MyName, MyPass )
local hE
hE := CreateOleObject("InternetExplorer.Application")
OLESetProperty(hE,"Visible" , .T.)
OLESetProperty(hE,"ToolBar" , .F.)
OLESetProperty(hE,"StatusBar", .T.)
OLESetProperty(hE,"MenuBar" , .T.)
OLEInvoke(hE,"Navigate","http://www.YourSite.com/adiciona.asp?nome="+MyName+"&senha="+MyPass)
SysRefresh()
return nil
[/code:1zwxed3a]
|
Active X Explorer
|
I will try it !!!
is it also possible with active x ???
tx
|
Active X Explorer
|
yes there is an sample on this forum but the method *DO* not run well or we not Know how make active the component of the activex
see this
<!-- m --><a class="postlink" href="http://fivetechsoft.com/forums/viewtopic.php?t=4121&highlight=">http://fivetechsoft.com/forums/viewtopi ... highlight=</a><!-- m -->
|
Active X Explorer
|
Silvio,
Method Do() runs ok. Its an ActiveX issue.
|
Active X Explorer
|
ok Antonio,
these commands not run ok
oActiveX:SetProp( "StatusBar", .T. ) // not run ???
oActiveX:SetProp( "AddressBar", .T. ) // not run ???
oActiveX:SetProp( "ToolBar", .T. ) // not run ???
oActiveX:SetProp( "LinksBar", .T. ) // not run ???
oActiveX:SetProp( "ToolbarOptions", .T. ) // not run ???
---------------------------------------------------------------------------
|
Active X Explorer
|
Silvio,
Try to do it in Visual Basic. Its not a FWH issue.
|
Active X Explorer
|
I don't Like VB , I hatred VB because I have lost many ex clipper friends
|
Active X Explorer
|
Anyone read the question ???
-:)
|
Active X Explorer
|
Uwe,
Rochinha has provided you a valid answer.
|
Active X Explorer
|
Yes i read it but im searching for a solution with active x
i want to use it in a FW Dialog
Tx Uwe D
|
Active X Explorer
|
Uwe,
Please review samples\webexp.prg
|
Active x tooooo much scrollbar in Dialog
|
When i use active x Shell explorer i have vert and horz Scrollbar on the active x control and vert and horz scrollbars on the Dialog
tx
|
Active x tooooo much scrollbar in Dialog
|
Uwe,
Could you please provide a small sample to reproduce it ? thanks,
|
ActiveSync para Windows Vista
|
Hola a todos, más de uno ya lo sabrá pero para los que no aqui dejo un link para descargar la versión compatible del ActiveSync para el Windows Vista....
<!-- m --><a class="postlink" href="http://www.microsoft.com/windowsmobile/devicecenter.mspx">http://www.microsoft.com/windowsmobile/ ... enter.mspx</a><!-- m -->
Ya me lo he bajado y probado, y la verdad que por ahora va muy bien...
Saludos.
Elías Torres.
|
ActiveSync para Windows Vista
|
Elías,
En principio no haría falta, ya que Windows Vista lo lleva incluido
|
ActiveSync para Windows Vista
|
Hola Elías,
Yo he usado Vista con PDA's sin necesidad de ningún software adicional. De hecho el activesync en vista es un servicio más que puedes o no desactivar.
|
ActiveSync para Windows Vista
|
Y como hago esto en Vista
|
ActiveSync para Windows Vista
|
Está activado por defecto, sólo tienes que conectar el Pocket PC por cable USB al ordenador con Windows Vista
|
ActiveSync para Windows Vista
|
y como hago para decirle en que carpeta quiero que sincronce
|
ActiveX
|
I eventually would like to utilize Word in an ActiveX container in Fivewin. I am trying to start by utilizing the Webexp.prg to learn (per Antonio post). I cannot get this to run. I also cannot find anything about TActiveX in the manuals under "A", or "T". Do I need a special library to be linked in to get this example to work?Error I get: Error description: Error BASE/1081 Argument error: + Args: [ 1] = O Object [ 2] = N 200Stack Calls=========== Called from: TActiveX.prg => TACTIVEX:NEW(0) Called from: TActiveX.prg => CREATEACTIVEX(184) Called from: TActiveX.prg => TACTIVEX:NEW(0) Called from: webexp.prg => MAIN(10)Thanks,
|
ActiveX
|
Friend,This is a sample with Activex class?[code:1nr76rbp]
#include "FiveWin.ch"
function Main()
local oWnd, oActiveX
local cEvents := ""
DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"
oActiveX = TActiveX():New( oWnd, "Shell.Explorer.2" )
oActiveX:Do( "ToolBar" , "true" )
oActiveX:Do( "StatusBar", "true" )
oActiveX:Do( "MenuBar" , .T. )
oActiveX:Do( "Visible" , .T. )
oWnd:oClient = oActiveX // To fill the entire window surface
oActiveX:Do( "Navigate", "http://www.google.com" )
ACTIVATE WINDOW oWnd
return nil
[/code:1nr76rbp]
And here the OLE class:
[code:1nr76rbp]
#include "FiveWin.ch"
function Main()
local oWnd, oIE
local cEvents := ""
DEFINE WINDOW oWnd TITLE "Internet Test"
oIE:=TOleAuto():New( "InternetExplorer.Application" )
oIE:ToolBar := .T.
oIE:StatusBar := .T.
oIE:MenuBar := .F.
oIE:Visible := .T.
oWnd:oClient = oIE // To fill the entire window surface
oIE:Navigate( "http://www.google.com" )
oIE:End()
ACTIVATE WINDOW oWnd
return nil
[/code:1nr76rbp]Try and report.
|
ActiveX
|
Hi,What is the difference between TOle class and TActivex class. In the above given example both the classes are doin the same. Where to use what ?.May be it is a very silly question. Would like to know the differenceRegardsAnser
|
ActiveX
|
[quote="anserkk":3104bmbi]Hi,
What is the difference between TOle class and TActivex class. In the above given example both the classes are doin the same. Where to use what ?.
May be it is a very silly question. Would like to know the difference
Regards
Anser[/quote:3104bmbi]They are both based on OLE technology but ActiveX is a control working like any other controls.EMG
|
ActiveX
|
Neither one works, the standard ole (the second one) does manage to launch Internet Explorer, but the window title is "Google - Windows Internet Explorer" which I believe is not in the Windows Container planned for in the code. I have gotten OLE to work very well with Excel so I am famialiar with controlling another application. I like to make sure the application is within a window I have created by the application. Is there any special libs I need to utilize. Is the only problem the way I call the application in the TActiveX new method (the program ID)? The activeX seems to be dying there.Thanks,
|
ActiveX
|
Byron,The problem comes from the libraries linking order. You have to link FWH libraries, before xHarbour ones.> Called from: TActiveX.prg => TACTIVEX:NEW(0) FWH does not include a TActiveX.prg, so that one is from xHarbour not from FWH. You need to use the FWH one.
|
ActiveX
|
Hello,
Is there somewhere a manual or a set of instructions available which tell me how to use ActiveX in FWH ?
Thanks.
|
ActiveX
|
Michel,
You can review the ActiveX documentation in the FiveTech's wiki:
Commands:
[url:tkmllc1r]http://wiki.fivetechsoft.com/doku.php?id=fivewin_commands_activex[/url:tkmllc1r]
Class:
[url:tkmllc1r]http://wiki.fivetechsoft.com/doku.php?id=fivewin_class_tactivex[/url:tkmllc1r]
Also, you can review all the ActiveX examples provided in FWH\samples:
excel.prg, flash.prg, gmapd.prg, goearth.prg, mappt.prg, media.prg, pdf.prg, ribonbar.prg, testactm.prg, testole2.prg, webexp.prg, word.prg
|
ActiveX
|
Antonio,
Thanks a lot for your help.
|
ActiveX ( To Antonio ) Solved
|
I´m trying execute this method
ret:=oAct:Do("RED",aParams[1],aParams[2],aParams[3],aParams[4],aParams[5],aParams[6],aParams[7],0)
ret is to return 1, more return NIL, and looking in TactiveX i see it.
METHOD Do( cMethodName, uParam1, uParam2, uParam3, uParam4, uParam5 )
have onlly 5 parans and i need 8. Im trying this form.
Ret = ActXInvoke( ActXPdisp( oAct:hActiveX ), "RED", aParams[1], aParams[2], aParams[3], aParams[4], aParams[5], aParams[6], aParams[7], 0)
more return nil yet.
Thinnk that need change function ActXInvoke to receive more params.
I try use ToleAuto
ret:=oAct:RED(aParams[1],aParams[2],aParams[3],aParams[4],aParams[5],aParams[6],aParams[7],0)
return 1 OK more i need use Eventos and class TOleAuto not have it. and class TOleWEvent() show GPF
Antonio what´s your think ?
|
ActiveX ( To Antonio ) Solved
|
<!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
ActiveX ( To Antonio ) Solved
|
<!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
ActiveX ( To Antonio ) Solved
|
Lailton,
Please use the new Class TActiveX. There are no parameters limits <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=15314&start=0">viewtopic.php?f=3&t=15314&start=0</a><!-- l -->
|
ActiveX ( To Antonio ) Solved
|
Antonio,
i need use it in fwh 8.5
how make to no have limit ??
thanks
|
ActiveX ( To Antonio ) Solved
|
Lailton,
Have you tested it with fwh 8.5 ? It should work fine
|
ActiveX ( To Antonio ) Solved
|
Perfect, all right with fwh 8.5 <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
ActiveX - CREATEOBJECT and singleton pattern
|
I need to connect the POS device TPS900 to a POS application that is done with FWH / xHarbour. The TPS900 vendor has created a software interface as a COM component with functions to communicate with the TPS900 (C #).
So far, I have used the CREATEOBJECT function very successfully for account fiscalization as well.
Example, how I used CREATEOBJECT.
Class1.cs (c#)
[code=fw:8zf2gogx]<div class="fw" id="{CB}" style="font-family: monospace;">using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.<span style="color: #0000ff;">Text</span>;<br />using System.Threading.Tasks;<br /><br />namespace MyTest<br /><span style="color: #000000;">{</span><br /><br /> <span style="color: #00C800;">public</span> <span style="color: #00C800;">class</span> HelloWord<br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">public</span> String SayHello<span style="color: #000000;">(</span>string test<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">return</span> test; <br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /><span style="color: #000000;">}</span><br /> </div>[/code:8zf2gogx]
[b:8zf2gogx]register.bat[/b:8zf2gogx]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /codebase C:\Users\Dubravko\source\repos\MyTest\MyTest\bin\Debug\MyTest.dll
[code=fw:8zf2gogx]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #B900B9;">//Test.prg</span><br /> <span style="color: #B900B9;">//========================================== My Test ActiveX</span><br /> <span style="color: #00C800;">Public</span> oPOS<br /> <span style="color: #00C800;">Local</span> ret := ““<br /><br /> oPOS := CREATEOBJECT<span style="color: #000000;">(</span><span style="color: #ff0000;">"MyTest.HelloWord"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// namespace->MyTest public class->HelloWord</span><br /><br /> alert<span style="color: #000000;">(</span>valtype<span style="color: #000000;">(</span>oPOS<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// "O"</span><br /><br /> ret := oPOS:<span style="color: #000000;">SayHello</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"I'm here !!!!!!"</span><span style="color: #000000;">)</span><br /><br /> alert<span style="color: #000000;">(</span> ret <span style="color: #000000;">)</span> <span style="color: #B900B9;">// -> " I'm here !!!!!!"</span><br /> <br /> <span style="color: #B900B9;">//==========================================</span><br /><br /> </div>[/code:8zf2gogx]
I received an email from the equipment supplier saying that they use a singleton pattern to manage and control instances of Bluetooth connections and suggest that I use the factory method BluetoothConnector.GetInstance (string serviceGuid)
[b:8zf2gogx][i:8zf2gogx][ Mail ] Greeting, [/b:8zf2gogx]
I am sending a reworked dll, it should work now. The problem was probably that COM registration required the class to have a public default constructor, and since we use a singleton pattern (to manage and control instances of Bluetooth connections), the constructor was private. In any case, do not use the constructor for the BluetoothConnector class (there is only for COM registration), but instead use the factory method BluetoothConnector.GetInstance (string serviceGuid) to create, and retrieve an instance of BluetoothConnector.[/i:8zf2gogx]
Can anyone help me how to use CREATEOBJECT for factory method
BluetoothConnector.GetInstance (string serviceGuid)
e.g:
oPOS := CREATEOBJECT("BluetoothConnector.GetInstance('TestConnectionDLL()' ) or something ?
Thanks for any help
Regards,
( TestConnectionDLL () is a built-in function in BluetoothConnector.cs
Returns what we sent as an argument. )
[b:8zf2gogx]BluetoothConnector.cs[/b:8zf2gogx]
[code=fw:8zf2gogx]<div class="fw" id="{CB}" style="font-family: monospace;"><br />using System;<br />using System.Collections.Generic;<br />using System.IO;<br />using System.Linq;<br />using System.<span style="color: #0000ff;">Text</span>;<br />using System.Threading.Tasks;<br />using InTheHand.Net;<br />using InTheHand.Net.Bluetooth;<br />using InTheHand.Net.Sockets;<br />using Newtonsoft.Json;<br /><br />namespace PaymentService<br /><span style="color: #000000;">{</span><br /> <span style="color: #00C800;">public</span> <span style="color: #00C800;">class</span> BluetoothConnector<br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">private</span> <span style="color: #00C800;">static</span> BluetoothConnector _instance = <span style="color: #00C800;">null</span>;<br /> <span style="color: #00C800;">private</span> <span style="color: #00C800;">static</span> readonly object lockObj = <span style="color: #00C800;">new</span> object<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #00C800;">private</span> BluetoothClient _client;<br /> <span style="color: #00C800;">private</span> List<BluetoothDeviceInfo> _availableDevices = <span style="color: #00C800;">new</span> List<BluetoothDeviceInfo><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">private</span> BluetoothDeviceInfo _selectedDevice = <span style="color: #00C800;">null</span>;<br /> <span style="color: #00C800;">private</span> string _serviceGuid;<br /><br /> BluetoothConnector<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> this._client = <span style="color: #00C800;">new</span> BluetoothClient<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">private</span> string ServiceGuid<br /> <span style="color: #000000;">{</span><br /> set<br /> <span style="color: #000000;">{</span><br /> this._serviceGuid = value;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">public</span> <span style="color: #00C800;">static</span> BluetoothConnector GetInstance<span style="color: #000000;">(</span>string serviceGuid<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>_instance == <span style="color: #00C800;">null</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> lock <span style="color: #000000;">(</span>lockObj<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>_instance == <span style="color: #00C800;">null</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> _instance = <span style="color: #00C800;">new</span> BluetoothConnector<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> _instance.ServiceGuid = serviceGuid;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">return</span> _instance;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #B900B9;">/// <summary></span><br /> <span style="color: #B900B9;">/// Looks up for all available bluetooth devices near by.</span><br /> <span style="color: #B900B9;">/// </summary></span><br /> <span style="color: #B900B9;">/// <returns>Returns a list of devices found.</returns></span><br /> <span style="color: #00C800;">public</span> IReadOnlyCollection<PaymentDevice> FindAvailableDevices<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> List<PaymentDevice> devicesList = <span style="color: #00C800;">new</span> List<PaymentDevice><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #0000ff;">var</span> devices = this._client.DiscoverDevices<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> foreach <span style="color: #000000;">(</span><span style="color: #0000ff;">var</span> dev in devices<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> _availableDevices.Add<span style="color: #000000;">(</span>dev<span style="color: #000000;">)</span>;<br /><br /> PaymentDevice d = <span style="color: #00C800;">new</span> PaymentDevice<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> DeviceName = dev.DeviceName,<br /> Authenticated = dev.Authenticated,<br /> DeviceAddress = dev.DeviceAddress.ToUInt64<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">}</span>;<br /><br /> devicesList.Add<span style="color: #000000;">(</span>d<span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">return</span> devicesList.AsReadOnly<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #B900B9;">/// <summary></span><br /> <span style="color: #B900B9;">/// Attempts pairing process with the POS terminal device.</span><br /> <span style="color: #B900B9;">/// </summary></span><br /> <span style="color: #B900B9;">/// <param name="device">Device information.</param></span><br /> <span style="color: #B900B9;">/// <returns>Returns <b>true</b> if pairing succeeded.</returns></span><br /> <span style="color: #00C800;">public</span> bool Pair<span style="color: #000000;">(</span>PaymentDevice device<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> bool result = <span style="color: #00C800;">false</span>;<br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>!device.Authenticated<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> result = BluetoothSecurity.PairRequest<span style="color: #000000;">(</span>device.DeviceAddress, <span style="color: #00C800;">null</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">else</span><br /> result = <span style="color: #00C800;">true</span>;<br /><br /> BluetoothDeviceInfo deviceInfo = _availableDevices.FirstOrDefault<span style="color: #000000;">(</span>d => d.DeviceAddress.ToUInt64<span style="color: #000000;">(</span><span style="color: #000000;">)</span> == device?.DeviceAddress<span style="color: #000000;">)</span>;<br /> this._selectedDevice = deviceInfo;<br /> deviceInfo?.<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #00C800;">return</span> result;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #B900B9;">/// <summary></span><br /> <span style="color: #B900B9;">/// Executes payment transaction against the POS terminal device.</span><br /> <span style="color: #B900B9;">/// </summary></span><br /> <span style="color: #B900B9;">/// <param name="amount">Transaction amount.</param></span><br /> <span style="color: #B900B9;">/// <param name="currency">Transaction currency. This parameter is optional and if omitted, "HRK" is used as default.</param></span><br /> <span style="color: #B900B9;">/// <returns>Transaction execution result details.</returns></span><br /> <span style="color: #00C800;">public</span> ResponsePay Pay<span style="color: #000000;">(</span>decimal amount, string currency = <span style="color: #ff0000;">"HRK"</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> this.ConnectClient<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #0000ff;">var</span> stream = _client.GetStream<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> StreamWriter sw = <span style="color: #00C800;">new</span> StreamWriter<span style="color: #000000;">(</span>stream, System.<span style="color: #0000ff;">Text</span>.Encoding.UTF8<span style="color: #000000;">)</span>;<br /><br /> ResponsePay responseObject = <span style="color: #00C800;">null</span>;<br /><br /> <span style="color: #00C800;">try</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">var</span> obj = <span style="color: #00C800;">new</span><br /> <span style="color: #000000;">{</span><br /> requestId = Guid.NewGuid<span style="color: #000000;">(</span><span style="color: #000000;">)</span>.ToString<span style="color: #000000;">(</span><span style="color: #000000;">)</span>.ToLower<span style="color: #000000;">(</span><span style="color: #000000;">)</span>,<br /> <span style="color: #00C800;">method</span> = <span style="color: #ff0000;">"pay"</span>,<br /> parameters = <span style="color: #00C800;">new</span> <span style="color: #000000;">{</span> amount, currency <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span>;<br /> <span style="color: #0000ff;">var</span> objectJson = JsonConvert.SerializeObject<span style="color: #000000;">(</span>obj<span style="color: #000000;">)</span>;<br /> sw.WriteLine<span style="color: #000000;">(</span>objectJson<span style="color: #000000;">)</span>;<br /> sw.<span style="color: #0000ff;">Flush</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> string response;<br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>stream.CanRead<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> using <span style="color: #000000;">(</span>StreamReader sr = <span style="color: #00C800;">new</span> StreamReader<span style="color: #000000;">(</span>stream<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> response = sr.ReadLine<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> responseObject = JsonConvert.DeserializeObject<ResponsePay><span style="color: #000000;">(</span>response<span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> catch <span style="color: #000000;">(</span>Exception ex<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">throw</span> <span style="color: #00C800;">new</span> InvalidOperationException<span style="color: #000000;">(</span>ex.<span style="color: #0000ff;">Message</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">return</span> responseObject;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #B900B9;">/// <summary></span><br /> <span style="color: #B900B9;">/// Executes payment transaction against the POS terminal device.</span><br /> <span style="color: #B900B9;">/// </summary></span><br /> <span style="color: #B900B9;">/// <param name="transactionId">Transaction identifier.</param></span><br /> <span style="color: #B900B9;">/// <returns>Transaction cancellation execution result details.</returns></span><br /> <span style="color: #00C800;">public</span> ResponsePay Cancel<span style="color: #000000;">(</span>string transactionId<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> this.ConnectClient<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #0000ff;">var</span> stream = _client.GetStream<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> StreamWriter sw = <span style="color: #00C800;">new</span> StreamWriter<span style="color: #000000;">(</span>stream, System.<span style="color: #0000ff;">Text</span>.Encoding.UTF8<span style="color: #000000;">)</span>;<br /><br /> ResponsePay responseObject = <span style="color: #00C800;">null</span>;<br /><br /> <span style="color: #00C800;">try</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">var</span> obj = <span style="color: #00C800;">new</span><br /> <span style="color: #000000;">{</span><br /> requestId = Guid.NewGuid<span style="color: #000000;">(</span><span style="color: #000000;">)</span>.ToString<span style="color: #000000;">(</span><span style="color: #000000;">)</span>.ToLower<span style="color: #000000;">(</span><span style="color: #000000;">)</span>,<br /> <span style="color: #00C800;">method</span> = <span style="color: #ff0000;">"cancel"</span>,<br /> parameters = <span style="color: #00C800;">new</span> <span style="color: #000000;">{</span> transactionId <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span>;<br /> <span style="color: #0000ff;">var</span> objectJson = JsonConvert.SerializeObject<span style="color: #000000;">(</span>obj<span style="color: #000000;">)</span>;<br /> sw.WriteLine<span style="color: #000000;">(</span>objectJson<span style="color: #000000;">)</span>;<br /> sw.<span style="color: #0000ff;">Flush</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> string response;<br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>stream.CanRead<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> using <span style="color: #000000;">(</span>StreamReader sr = <span style="color: #00C800;">new</span> StreamReader<span style="color: #000000;">(</span>stream<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> response = sr.ReadLine<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> responseObject = JsonConvert.DeserializeObject<ResponsePay><span style="color: #000000;">(</span>response<span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> catch <span style="color: #000000;">(</span>Exception ex<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">throw</span> <span style="color: #00C800;">new</span> InvalidOperationException<span style="color: #000000;">(</span>ex.<span style="color: #0000ff;">Message</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">return</span> responseObject;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #B900B9;">/// <summary></span><br /> <span style="color: #B900B9;">/// Tests a bluetooth connection against the paired device and its registered service.</span><br /> <span style="color: #B900B9;">/// </summary></span><br /> <span style="color: #B900B9;">/// <returns>Response with the test result.</returns></span><br /> <span style="color: #00C800;">public</span> Response TestConnection<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> this.ConnectClient<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> <span style="color: #0000ff;">var</span> stream = _client.GetStream<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> StreamWriter sw = <span style="color: #00C800;">new</span> StreamWriter<span style="color: #000000;">(</span>stream, System.<span style="color: #0000ff;">Text</span>.Encoding.UTF8<span style="color: #000000;">)</span>;<br /><br /> Response responseObject = <span style="color: #00C800;">null</span>;<br /><br /> <span style="color: #00C800;">try</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">var</span> obj = <span style="color: #00C800;">new</span><br /> <span style="color: #000000;">{</span><br /> requestId = Guid.NewGuid<span style="color: #000000;">(</span><span style="color: #000000;">)</span>.ToString<span style="color: #000000;">(</span><span style="color: #000000;">)</span>.ToLower<span style="color: #000000;">(</span><span style="color: #000000;">)</span>,<br /> <span style="color: #00C800;">method</span> = <span style="color: #ff0000;">"test"</span>,<br /> parameters = <span style="color: #00C800;">new</span> <span style="color: #000000;">{</span> <span style="color: #00C800;">data</span> = <span style="color: #ff0000;">"testData"</span> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span>;<br /> <span style="color: #0000ff;">var</span> objectJson = JsonConvert.SerializeObject<span style="color: #000000;">(</span>obj<span style="color: #000000;">)</span>;<br /> sw.WriteLine<span style="color: #000000;">(</span>objectJson<span style="color: #000000;">)</span>;<br /> sw.<span style="color: #0000ff;">Flush</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /><br /> string response;<br /><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>stream.CanRead<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> using <span style="color: #000000;">(</span>StreamReader sr = <span style="color: #00C800;">new</span> StreamReader<span style="color: #000000;">(</span>stream<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> response = sr.ReadLine<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> responseObject = JsonConvert.DeserializeObject<Response><span style="color: #000000;">(</span>response<span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> catch <span style="color: #000000;">(</span>Exception ex<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">throw</span> <span style="color: #00C800;">new</span> InvalidOperationException<span style="color: #000000;">(</span>ex.<span style="color: #0000ff;">Message</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">return</span> responseObject;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">private</span> void ConnectClient<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>!_client.Connected<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> _client.Connect<span style="color: #000000;">(</span>_selectedDevice.DeviceAddress, Guid.Parse<span style="color: #000000;">(</span>_serviceGuid<span style="color: #000000;">)</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>!_client.Connected || _client.PairedDevices.<span style="color: #0000ff;">Count</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> == <span style="color: #000000;">0</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">throw</span> <span style="color: #00C800;">new</span> InvalidOperationException<span style="color: #000000;">(</span><span style="color: #ff0000;">"Niste spojeni na niti jedan ure?aj. Pokrenite spajanje/uparivanje."</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /><span style="color: #000000;">}</span><br /><br /> </div>[/code:8zf2gogx]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Please build FWH\samples\olebrow.prg and inspect the DLL OLE class that you want to use and paste here what you get
Example:
[img:3ab0thcr]https://fivetechsoft.github.io/screenshots/shark.JPG[/img:3ab0thcr]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Thank you for the quick response
I hope that's what you were looking for
[img:3epvh453]http://www.inteh-app.com/app/ActiveX_scr.png[/img:3epvh453]
Registry
[img:3epvh453]http://www.inteh-app.com/app/ActiveX_scr2.png[/img:3epvh453]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Please double click on the highligthed (blue) line to show its info
|
ActiveX - CREATEOBJECT and singleton pattern
|
[img:2qhbfgfd]http://www.inteh-app.com/app/ActiveX_scr3.png[/img:2qhbfgfd]
|
ActiveX - CREATEOBJECT and singleton pattern
|
We need the complete list
Please click on Print or Excel to get it
|
ActiveX - CREATEOBJECT and singleton pattern
|
[url:2qgdvcr4]http://www.inteh-app.com/app/ActiveX_list.xlsx[/url:2qgdvcr4]
[url:2qgdvcr4]http://www.inteh-app.com/app/ActiveX_list_PaymentService.xlsx[/url:2qgdvcr4]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Download this utility to see the registered classes of activex and olecom components.
[url:cod6gk55]https://www.mitec.cz/Downloads/OLExp.zip[/url:cod6gk55]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Thank you
Yes, all 4 classes are visible
[url:dy49u8lo]http://www.inteh-app.com/app/ActiveX_scr4.png[/url:dy49u8lo]
|
ActiveX - CREATEOBJECT and singleton pattern
|
[quote:2wta9ww2] ////////////////////////////////////////////
o1 := CREATEOBJECT("PaymentService.BluetoothConnector") // ok
MsgInfo( ValType( o1 ) ) // -> "O"
local22 := o1:Invoke( "GetInstance" )
MsgInfo( ValType( local22 ) ) // N
MsgInfo( str( local22 ) ) // 244252684
o2 := o1:GetInstance() // error
MsgInfo( ValType( o2 ) )
////////////////////////////////////////////[/quote:2wta9ww2]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Please try this:
local o1 := CreateObject( "PaymentService.BluetoothConnector" )
local o2 := TOleAuto():New( o1:Invoke( "GetInstance" ) )
|
ActiveX - CREATEOBJECT and singleton pattern
|
////////////////////////////////////////////
o1 := CreateObject( "PaymentService.BluetoothConnector" )
o2 := TOleAuto():New( o1:Invoke( "GetInstance" ) )
MsgInfo( ValType( o1 ) ) // -> "O"
MsgInfo( ValType( o2 ) ) // -> "O"
////////////////////////////////////////////
|
ActiveX - CREATEOBJECT and singleton pattern
|
[quote="metro2":jizwymic][img:jizwymic]http://www.inteh-app.com/app/ActiveX_scr3.png[/img:jizwymic][/quote:jizwymic]
Is Invoke() the latest entry in the list ? The scrollbar seems to have more to show
|
ActiveX - CREATEOBJECT and singleton pattern
|
Yes, invoke is the last entry in the list
[img:1ttorr46]http://www.inteh-app.com/app/ActiveX_scr5.png[/img:1ttorr46]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Please try this:
local o1 := CreateObject( "PaymentService.BuetoothConnector" )
local o2 := o1:GetInstance()
MsgInfo( ValType( o1 ) )
MsgInfo( ValType( o2 ) )
|
ActiveX - CREATEOBJECT and singleton pattern
|
Also please try:
local o2 := o1:Invoke( "GetInstance" )
|
ActiveX - CREATEOBJECT and singleton pattern
|
prg:
////////////////////////////////////////////
o1 := CREATEOBJECT("PaymentService.BluetoothConnector") // ok
MsgInfo( ValType( o1 ) ) // -> "O"
o2 := o1:GetInstance() // error
MsgInfo( ValType( o2 ) )
////////////////////////////////////////////
error.log
[quote:1ddnvtpx]Application
===========
Path and name: G:\FWH_PRG\MetroTRG\metrotrg.exe (32 bits)
Size: 3,663,872 bytes
Time from start: 0 hours 0 mins 10 secs
Error occurred at: 29.09.2021, 12:16:07
Error description: Error PaymentService.BluetoothConnector/0 S_OK: GETINSTANCE
Args:
Stack Calls
===========
Called from: => TOLEAUTO:GETINSTANCE(0)
Called from: kasa001.prg => KASASTART(65)
Called from: G:\FWH_PRG\metroTRG\main.prg => (b)MAIN(298)
Called from: btnbmp.prg => TBTNBMP:CLICK(463)
Called from: btnbmp.prg => TBTNBMP:LBUTTONUP(658)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1483)
Called from: btnbmp.prg => TBTNBMP:HANDLEEVENT(1437)
Called from: .\source\classes\WINDOW.PRG => _FWH(3391)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(976)
Called from: clas_metro.prg => TMETRO:ACTIVATE(55)
Called from: G:\FWH_PRG\metroTRG\main.prg => MAIN(380)
System
======
CPU type: Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz -137438 Mhz
Hardware memory: 2048 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 9382)
Windows version: 6.2, Build 9200 [/quote:1ddnvtpx]
|
ActiveX - CREATEOBJECT and singleton pattern
|
> oPOS := CREATEOBJECT("BluetoothConnector.GetInstance('TestConnectionDLL()' ) or something ?
o2 should be the oPOS you were looking for
|
ActiveX - CREATEOBJECT and singleton pattern
|
Ok, i'll try to call TestConnectionDLL with an argument ...
I will report the result ...
|
ActiveX - CREATEOBJECT and singleton pattern
|
Greeting,
I was away for a while.
If an o2 instance is called from BluetoothConnector,
How to call the TestConnectionDll method eg:
ret: = o2: TestConnectionDll ("") // -> error
ret: = o2: BluetoothConnector: TestConnectionDll ("") // -> error
In other words, no matter how I try to call the method, I get an error. I'm probably wrong in syntax.
Does anyone have an idea how to call a certain method?
Antonio, thanks for the prior help.
[img:vhs07fwg]http://www.inteh-app.com/app/ActiveX_scr6.png[/img:vhs07fwg]
|
ActiveX - CREATEOBJECT and singleton pattern
|
Please try using:
o2:Invoke( "TestConnectionDll", "" )
|
ActiveX - CREATEOBJECT and singleton pattern
|
hi,
Antonio thanks for taking care of my problem ....
Yes, i tried this too, but it reports an error
o2:Invoke( "TestConnectionDll", "" )
Just today I intended to send a description of what was happening in the meantime.
On the forum [url:363sh1py]https://stackoverflow.com/questions/6252334/singleton-com-object-required[/url:363sh1py]
I found the following:
[quote:363sh1py]COM does not directly support the Singleton pattern, but it does not strictly prohibit it either. It's just that there's no registry setting that says "always serves the same object." In fact, the standard COM instance mechanism requires that a truly new object be returned each time you call it (this mechanism is used internally by new operators and CreateInstance (). This means that to create a valid COM singleton, you cannot allow your clients to do it themselves all of this can be done, but it is tricky and rarely necessary.[/quote:363sh1py]
From this I concluded that the classic way of using singleton technology, cannot be achieved by a direct call to GetInstance.
The idea is to add a method, which I will call, internally raising the singleton instance.
I made a test program with c #:
class1.cs
[code=fw:363sh1py]<div class="fw" id="{CB}" style="font-family: monospace;">using System;<br />using System.Collections.Generic;<br />using System.Linq;<br />using System.<span style="color: #0000ff;">Text</span>;<br />using System.Threading.Tasks;<br /><br />namespace MyTest <br /><span style="color: #000000;">{</span><br /> <span style="color: #00C800;">public</span> <span style="color: #00C800;">class</span> Singleton<br /> <span style="color: #000000;">{</span><br /><br /> <span style="color: #00C800;">public</span> string GetCardType<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">return</span> <span style="color: #ff0000;">"MoneyBack"</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">public</span> int GetCreditLimit<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">return</span> <span style="color: #000000;">15000</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">public</span> int GetAnnualCharge<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">return</span> <span style="color: #000000;">500</span>;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">public</span> string GetCardTypeRet<span style="color: #000000;">(</span> string ret <span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #B900B9;">//Console.WriteLine("Counter Value " + ret); // due to testing from the console application .... </span><br /> <span style="color: #00C800;">return</span> ret;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">//---------------------------------------------</span><br /> <span style="color: #00C800;">public</span> <span style="color: #00C800;">class</span> Car<br /> <span style="color: #000000;">{</span><br /><br /> <span style="color: #00C800;">public</span> string GetCardColorRet<span style="color: #000000;">(</span>string ret<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">return</span> ret;<br /> <span style="color: #000000;">}</span><br /><br /><br /><br /> <span style="color: #00C800;">public</span> object MyFunction<span style="color: #000000;">(</span>int something = <span style="color: #000000;">0</span>, string somethingelse = <span style="color: #ff0000;">"zzz"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// the arguments are due to future testing</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">var</span> ret = <span style="color: #00C800;">new</span> Singleton<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">return</span> ret;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">public</span> object GetObj<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// the method, which I will call, internally raises the singleton instance. </span><br /> <span style="color: #000000;">{</span><br /> SingletonTest fromEmployee = SingletonTest.GetInstance;<br /><br /> <span style="color: #00C800;">return</span> fromEmployee;<br /> <span style="color: #000000;">}</span><br /><br /><br /> <span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">//---------------------------------------------</span><br /> <span style="color: #00C800;">public</span> sealed <span style="color: #00C800;">class</span> SingletonTest <span style="color: #B900B9;">// </span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">private</span> <span style="color: #00C800;">static</span> int counter = <span style="color: #000000;">0</span>;<br /><br /> <span style="color: #B900B9;">/*<br /> * Private property initilized with null<br /> * ensures that only one instance of the object is created<br /> * based on the null condition<br /> */</span><br /> <span style="color: #00C800;">private</span> <span style="color: #00C800;">static</span> SingletonTest instance = <span style="color: #00C800;">null</span>;<br /><br /> <span style="color: #B900B9;">/*<br /> * public property is used to return only one instance of the class<br /> * leveraging on the private property<br /> */</span><br /> <span style="color: #00C800;">public</span> <span style="color: #00C800;">static</span> SingletonTest GetInstance<br /> <span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">get</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">if</span> <span style="color: #000000;">(</span>instance == <span style="color: #00C800;">null</span><span style="color: #000000;">)</span><br /> instance = <span style="color: #00C800;">new</span> SingletonTest<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">return</span> instance;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">/*<br /> * Private constructor ensures that object is not<br /> * instantiated other than with in the class itself<br /> */</span><br /> <span style="color: #00C800;">private</span> SingletonTest<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> <span style="color: #000000;">{</span><br /> counter++;<br /> <span style="color: #B900B9;">//Console.WriteLine("Counter Value " + counter.ToString() + " formirao instancu Singleton"); // due to testing from the console application .... </span><br /><br /> <span style="color: #000000;">}</span><br /> <span style="color: #B900B9;">/*<br /> * Public method which can be invoked through the singleton instance !!!<br /> */</span><br /> <span style="color: #00C800;">public</span> void PrintDetails<span style="color: #000000;">(</span>string <span style="color: #0000ff;">message</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// due to testing from the console application .... </span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #B900B9;">//Console.WriteLine(message); </span><br /> <span style="color: #000000;">}</span><br /> <br /> <br /> <span style="color: #B900B9;">// added ... test function !!!</span><br /> <span style="color: #00C800;">public</span> string GetCardTypeRet<span style="color: #000000;">(</span>string ret<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">return</span> ret;<br /> <span style="color: #000000;">}</span><br /><br /><br /> <span style="color: #00C800;">public</span> string TestConnectionDLL<span style="color: #000000;">(</span>string ret<span style="color: #000000;">)</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">return</span> ret;<br /> <span style="color: #000000;">}</span><br /><br /> <span style="color: #000000;">}</span><br /><br /><span style="color: #000000;">}</span><br /> </div>[/code:363sh1py]
olebrow:
[img:363sh1py]http://www.inteh-app.com/app/sl22.png[/img:363sh1py]
Register COM
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /codebase C:\Users\Dubravko\source\repos\MyTest\MyTest\bin\Release\MyTest.dll
prg code:
[code=fw:363sh1py]<div class="fw" id="{CB}" style="font-family: monospace;"><br /> <span style="color: #B900B9;">// visible class </span><br /> o1 := CREATEOBJECT<span style="color: #000000;">(</span><span style="color: #ff0000;">"MyTest.Singleton"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// namespace->MyTest public class->Singleton</span><br /> alert<span style="color: #000000;">(</span>valtype<span style="color: #000000;">(</span>o1<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// "O"</span><br /> alert<span style="color: #000000;">(</span>o1:<span style="color: #000000;">GetCardTypeRet</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Tu sam 2!!!!!!"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// -> "Tu sam 2!!!!!!"</span><br /> <br /><br /> o2 := CREATEOBJECT<span style="color: #000000;">(</span><span style="color: #ff0000;">"MyTest.Car"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// </span><br /> alert<span style="color: #000000;">(</span>valtype<span style="color: #000000;">(</span>o2<span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// -> "O"</span><br /> alert<span style="color: #000000;">(</span>valtype<span style="color: #000000;">(</span> o2:<span style="color: #000000;">GetObj</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// -> "O" </span><br /> <br /> o3 := o2:<span style="color: #000000;">GetObj</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// -> objekt - dignuta instanca</span><br /> alert<span style="color: #000000;">(</span> o3:<span style="color: #000000;">TestConnectionDLL</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"string_ret"</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// -> "string_ret" the test calls methods from a singleton instance</span><br /><br /> </div>[/code:363sh1py]
Now I expect TPS900 terminal vendors to add a method that will internally boot up the singleton instance and try it all out.
Here it is additionally good, which can be solved in this way, to manage the bluetooth port from FWH.
regards
Dubravko Basic
<!-- m --><a class="postlink" href="http://www.inteh.hr">http://www.inteh.hr</a><!-- m -->
|
ActiveX & Internet Explorer Question
|
All,
I'm using ActiveX to navigate to a secure webpage where the user enters some information and clicks a button that redirects them to another window with the results of the transaction. I need to read the results containted is this IE window.
I'm trying to view the contents of oActiveX:GetProp("document") in the valid clause before the object is closed however, oActiveX:GetProp("document") returns a numeric value. How can I grab the results in this window? What am I doing wrong?
I've also tried using CreateObject which directs me to the first window but I cannot figure out a way to get the contents of the document body of the 2nd window.
Any help or suggestions would be greatly appreciated.
Using xHarbour 9/2008 and FWH 8.01.
Thanks,
Randal
|
ActiveX & Internet Explorer Question
|
Randal,
> oActiveX:GetProp("document") returns a numeric value
This has been enhanced in FWH 9.04.
As a workaround you may try:
oDocument = TOleAuto():New( oActiveX:GetProp("document") )
also, new FWH 9.04 Class TActiveX directly allows:
oDocument = oActiveX:document
|
ActiveX & Mappoint
|
Antonio,
How can I set these properties using ActiveX & FWH?
Using xHarbour I can using the following syntax:
oMapPoint:Toolbars:Item("Standard"):Visible := .T.
oMapPoint:Toolbars:Item("Navigation"):Visible := .T.
oMapPoint:Toolbars:Item("Drawing"):Visible := .T.
oMapPoint:Toolbars:Item("Location and Scale"):Visible := .T.
Using FWH I've tried a variety of options but cannot find the correct syntax to set these properties.
Thanks,
Randal Ferguson
|
ActiveX & Mappoint
|
Randal,
This should be the first step:
MsgInfo( OleGetProperty( oActiveX:hActiveX, "Toolbars" ) )
but it is returning a nil value.
|
ActiveX & Mappoint
|
Antonio,
Toolbars is a collection object. I don't know how OleGetProperty is suppose to work but I can do the following with the same results.
// This line turns on the Legend and works properly
oActiveX:SetProp("PaneState", 1) // Turn on legend for route planer
// This line returns nil
MsgInfo( OleGetProperty( oActiveX:hActiveX, "PaneState" ) )
// This line returns 1, which is correct.
MsgInfo( oActiveX:GetProp("PaneState") )
So, I don't know why using GetProp works and OleGetProperty does not.
Additionally, when I set the PaneState property the route planner legend is visible but does not respond to any mouse clicks. According to the Microsoft docs the legend and toolbars should respond to mouse clicks, i.e. there are no events to process through the event handler for the legend and toolbars.
Just like the Excel ActiveX displays a toolbar with default functionality, the MapPoint toolbars should behave the same way.
I purchased the FWH Apr 2006 upgrade so I could get the ActiveX functionality for this project. If I need to purchase a more recent upgrade or pay extra to get this working just let me know. This is a major project that a I must get working and I'm losing customers by not having this functionality.
Regards,
Randal Ferguson[/list][/quote]
|
ActiveX & Mappoint
|
Randal,
The current ActiveX support is the same, so there is no need for the upgrade.
It looks as the MapPoint ActiveX implementation is not the standard one, or at least it is not done in the way that we use it from FWH.
Can you get the right behavior and events with xHB ?
|
ActiveX & Mappoint
|
Antonio,
With xHarbour I can set the properties to show the toolbars but they do not respond to any mouse clicks.
I've looked at samples for .net, vb, c#, c/c++ and I don't see anything extra you should have to do. You can see what events are available for Mappoint. There are no mappoint events to process in response to clicking on the toolbars.
I like the xHarbour implementation for accessing methods, properties, and objects. I don't have any problem accessing any of these using xHarbour.
I don't see anyway to access any of the many objects & collections available in MapPoint using FWH/ActiveX.
As to my original question, is there anyway to set the properties to show the toolbars?
Thanks,
Randal Ferguson
|
ActiveX & Mappoint
|
[quote="Randal Ferguson":2bknv2lk]
oActiveX:SetProp("PaneState", 1) // Turn on legend for route planer
// This line returns nil
MsgInfo( OleGetProperty( oActiveX:hActiveX, "PaneState" ) )
// This line returns 1, which is correct.
MsgInfo( oActiveX:GetProp("PaneState") )
So, I don't know why using GetProp works and OleGetProperty does not.
[/quote:2bknv2lk]
My mistake. The right syntax is:
ActXGetProperty( ActXPdisp( <oActiveX>:hActiveX ), cPropName )
|
ActiveX & Mappoint
|
Randal,
A collection is a property that requires an extra parameter. This code is working right:
[code:26df9xz9]
...
local hToolBar, hStandard
...
oActiveX = TActiveX():New( oWnd, "MapPoint.Control.9" )
oWnd:oClient = oActiveX // To fill the entire window surface
oActiveX:Do( "Newmap", 1 )
oActiveX:SetProp( "PaneState", 1 )
hToolBar = oActiveX:GetProp( "Toolbars" )
hStandard = OleGetProperty( hToolBar, "Item", "Standard" )
OleSetProperty( hStandard, "Visible", .T. )
[/code:26df9xz9]
Now we just need to properly manage the clicks <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
[url=http://imageshack.us:26df9xz9][img:26df9xz9]http://img82.imageshack.us/img82/6417/map6gs.gif[/img:26df9xz9][/url:26df9xz9]
|
ActiveX & Mappoint
|
Antonio,
Thanks, this works great to turn on the different toolbars.
Clicking on the legend or any of the toolbar buttons does not trigger any event. The question now is why don't the toolbar buttons or legend respond to any mouse clicks?
Thanks,
Randal Ferguson
|
ActiveX & Mappoint
|
Randal,
>
Clicking on the legend or any of the toolbar buttons does not trigger any event. The question now is why don't the toolbar buttons or legend respond to any mouse clicks?
>
Very good question <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> We are asking the same, why ? We have turned VIRTUAL LButtonDown(), LButtonUp() methods, but the activex does not process the clicks. We keep searching...
|
ActiveX & Mappoint
|
Randal,
Did you get to work with MapPoint ?
Can you shared with us some code samples?
Regards
George
|
ActiveX & Mappoint
|
George,
No, I never got it to work. I had upgraded to FWH 2.7 Apr 2006 version to get the new ActiveX features but still could not get it to work. I don't know if a more recent version of FWH would make any difference.
I'm still very interested in making this work. If you'd like to compare notes please feel free to email me directly at <!-- e --><a href="mailto:scebee@yahoo.com">scebee@yahoo.com</a><!-- e -->. I'd be happy to share the code I have. I'd also be willing to pay someone to get this working.
Thanks,
Randal Ferguson
|
ActiveX & Shell.Explorer
|
All,
I am using activex to show a window in explorer. I create the object with:
oActiveX = TActiveX():New( oWndHP, "Shell.Explorer.2" )
When the user closes the window I call a function in the VALID clause, passing the activex object to get the document contents. In this function I use:
oDoc := TOleAuto():New( oActiveX:GetProp("document") )
This has worked fine on several of our users computers but today I have a user gets the following error on the above line.
Error description: Error Shell.Explorer.2/0 S_OK: GETPROP
Args:
[ 1] = C document
This user has XP installed with 6.0 of IE (same as me). He did have Firefox set as his default browser but I had him change that. Anyone have any idea why this isn't working?
What is the difference between shell.explorer and shell.explorer.2?
Thanks,
Randal
|
ActiveX & Shell.Explorer
|
Randal,
With the modified Class TActiveX that we published in these forums and that has been included in FWH 9.06 you can simply do:
oActiveX = TActiveX():New( oWndHP, "Shell.Explorer.2" )
oDoc := oActiveX:document
|
ActiveX & xHarbour
|
Antonio,
I received your email with the updated libs. When I try to set the the event block I get an error on:
oMapPoint:bOnEvent = { | event, aParams | cEvents += EventInfo( event, aParams ) }
This line generates the error:
Error MapPoint.Control/16389 E_FAIL: _BONEVENT
I also tried replacing the ActiveX lib with the one you posted here for someone else recently. When I use this lib I get an error "yourapp.exe has encountered a problem and needs to close".
If I comment out the bOnEvent code the control works ok, at least the map is opened in a window.
Using FWH March 2006 and xBuilder 2006 w/xcc.
The other problem I reported seemed to be a problem with the MapPoint 2004 install, I was using the MSDN version. I uninstalled that version and installed MapPoint 2002 and this seems to be working.
Is there anyone else using MapPoint with ActiveX?
If your interested I could email you the mappoint setup and run discs.
Thanks,
Randal Ferguson
|
ActiveX & xHarbour
|
Randal,
> I also tried replacing the ActiveX lib with the one you posted here
You must use the library I posted here or then you are using xHB ActiveX instead of FWH one.
Please show your code to see why you may get an error.
|
ActiveX & xHarbour
|
Antonio,
The following is a sample of my code.
DEFINE WINDOW oWndMap OF oWnd ;
FROM 0,0 TO 0,0 ;
MDICHILD ;
MENU MapMenu(oWndMap) ;
TITLE "Map Point"
oMapPoint = TActiveX():New( oWndMap, "MapPoint.Control" )
oWndMap:oClient = oMapPoint // To fill the entire window surface
oMapPoint:Do("NewMap", 1)
// Generates an error on this line. If I comment out the window opens
oMapPoint:bOnEvent = { | event, aParams | cEvents += EventInfo( event, aParams ) }
ACTIVATE WINDOW oWndMap ;
ON INIT ( oWndMap:Move(0,0,640,390,.t.) ) ;
ON PAINT oWndMap:SetFocus() ;
VALID ( oMapPoint:Do("CloseMap"), .T. )
RETURN NIL
function EventInfo( event, aParams )
local cMsg := "Event: " + cValToChar( event ) + CRLF
local n
cMsg += "Params: "
for n = 1 to Len( aParams )
cMsg += cValToChar( aParams[ n ] ) + CRLF
next
return cMsg + CRLF
This is a list of the libs in the \fwh\lib folder. Using the Apr 2006 Build. I extracted ole.obj from the fivehc.lib. I also updated the Fivehcm and fivemx libs you sent me.
04/04/06 10:50 AM 1,400,320 Fiveh.lib
04/03/06 10:41 AM 346,112 fivehc.BAK
04/26/06 10:58 AM 339,968 fivehc.lib
04/17/06 11:18 AM 630,194 Fivehcm.lib
04/04/06 10:50 AM 2,353,354 Fivehm.lib
04/20/06 09:00 PM 2,382,536 Fivehmx.lib
04/04/06 10:50 AM 1,420,288 Fivehx.lib
04/21/06 01:33 PM 863,030 libs.zip
I'm also linking the ActiveX.lib you posted here recently.
04/21/06 08:23 AM 4,172 ActiveX.lib
Using xHarbour/xBuilder March 2006 w/xcc.
Thanks,
Randal Ferguson
|
ActiveX & xHarbour
|
Randal,
> I extracted ole.obj from the fivehc.lib.
Don't extract it. Please try with it.
|
ActiveX & xHarbour
|
Antonio,
When using the original fivehc.lib dated 4/3/06 I get the message "yourapp has encountered a problem and needs to close" at this line:
oMapPoint = TActiveX():New( oWndMap, "MapPoint.Control" )
Thanks,
Randal Ferguson
|
ActiveX & xHarbour
|
Randal,
Could you please try samples\webexp.prg and check if it works ok for you ? thanks.
|
ActiveX & xHarbour
|
Antonio,
If I build webexp sample using xharbour and bcc it works fine. If I build using xBuilder and xcc, linking ActiveX.lib from xHabour I get the same error message.
Error description: Error Shell.Explorer/16389 E_FAIL: _BONEVENT
If I build with xBuilder and do not link xHarbour ActiveX.lib I get the error
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: HWND
Thanks,
Randal Ferguson
|
ActiveX & xHarbour
|
Randal,
> Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: HWND
What source code generates that error ?
|
ActiveX & xHarbour
|
Antonio,
The line that generates that error is:
oActiveX = TActiveX():New( oWnd, "Shell.Explorer" )
Here is the error log:
Application
===========
Path and name: D:\xHB\bin\webexp.exe (32 bits)
Size: 1,504,768 bytes
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 04/27/06, 09:03:38
Error description: Error BASE/1004 Class: 'NUMERIC' has no exported method: HWND
Args:
Stack Calls
===========
Called from: => HWND(0)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: TActiveX.prg => CREATEACTIVEX(184)
Called from: TActiveX.prg => TACTIVEX:NEW(0)
Called from: webexp.prg => MAIN(11)
System
======
CPU type: Intel(R) Pentium(R) 4 CPU 3.20GHz 3200 Mhz
Hardware memory: 1023 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
Compiler version: xHarbour build 0.99.61 Intl. (SimpLex)
Windows version: 5.1, Build 2600 Service Pack 2
Windows total applications running: 35
1
2 SysFader
3 Start Menu
4 DirectDBNotifyWndProc
5 Outlook Express FolderSync Window Class
6 Outlook Express NewsStore
7 DirectDBListenWndProc
8 Norton AntiVirus
9 FiveWin ActiveX Support
10 xBuild - D:\xHB\bin\webexp.exe.xbp
11 Multi-Edit - [D:\FWH\SAMPLES\webexp.prg]
12 MCI command handling window
13 DDE Server Window
14 ThorConnWndClass
15 Identity Mgr Notify
16 WAB Notification Window
17 WOWExec
18 Microsoft ActiveSync
19 DefAlert_Window_29DABAC8-AB93-43f3-926D-1DDE0C909FDF
20 WCES Manager Thunk Window
21 DirectCD
22 DccMan
23 SigmatelSysTray
24 Connections Tray
25 ccApp
26 Power Meter
27 MS_WebcheckMonitor
28 UnErase Process
29 ATI video bios poller
30 ACT!
31 VCERuntime
32 <!-- w --><a class="postlink" href="http://www.FiveTechSoft.com">www.FiveTechSoft.com</a><!-- w --> :: View topic - ActiveX & xHarbour - Microsoft Internet Explorer
33 Command Prompt
34 xHarbour - Outlook Express
35 Program Manager
Variables in use
================
Procedure Type Value
==========================
HWND
Local 1: U
Local 2: U
Local 3: N 0
TACTIVEX:NEW
Param 1: N 1312076
Param 2: C "Shell.Explorer"
Param 3: O Class: TACTIVEX
Param 4: U
Local 1: U
Local 2: U
CREATEACTIVEX
Param 1: N 1312076
Param 2: C "Shell.Explorer"
Param 3: O Class: TACTIVEX
Local 1: U
Local 2: U
Local 3: C "Shell.Explorer"
Local 4: N 0
Local 5: O Class: ERROR
Local 6: O Class: SHELL.EXPLORER.1
Local 7: N 1330792
Local 8: N 1406416
Local 9: O Class: TYPELIB
Local 10: C "{D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}"
TACTIVEX:NEW
Param 1: O Class: TWINDOW
Param 2: C "Shell.Explorer"
Local 1: O Class: TACTIVEX
Local 2: U
Local 3: O Class: TACTIVEX
MAIN
Local 1: O Class: TWINDOW
Local 2: U
Local 3: C ""
Linked RDDs
===========
DBF
DBFFPT
DBFNTX
DataBases in use
================
Classes in use:
===============
1 HBCLASS
2 HBOBJECT
3 TWINDOW
4 TBRUSH
5 TFONT
6 TCONTROL
7 TACTIVEX
8 TYPELIB
9 ENUMTYPEINFO
10 CONSTANTTYPEINFO
11 OBJECTTYPEINFO
12 INTERFACETYPEINFO
13 METHODTYPEINFO
14 ARGUMENTTYPEINFO
15 PROPERTYTYPEINFO
16 TOLEAUTO
17 OLEWRAPPER
18 OLEXWRAPPER
19 SHELL.EXPLORER.1
20 {EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B}
21 {D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}
22 SHELL.EXPLORER.2
23 {8856F961-340A-11D0-A96B-00C04FD705A2}
24 {D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}.IWEBBROWSER2
25 {D30C1661-CDAF-11D0-8A3E-00C04FC9E26E}.IWEBBROWSER
26 {EAB22AC1-30C1-11CF-A7EB-0000C05BAE0B}
27 ERROR
28 TREG32
Memory Analysis
===============
126 Static variables
Dynamic memory consume:
Actual Value: 0 bytes
Highest Value: 0 bytes
|
ActiveX & xHarbour
|
Randal,
> Called from: TActiveX.prg => TACTIVEX:NEW(0)
You are using xHB TActiveX.prg. You need to use the ActiveX.lib we provided here that is an empty lib.
FWH's one is named ActiveX.prg.
|
ActiveX & xHarbour
|
Antonio,
If I link the small activex.lib you posted here and not the activex.lib that comes with xHarbour I get the msg "yourapp.exe has encountered a problem and needs to close" on this line:
oMapPoint = TActiveX():New( oWndMap, "MapPoint.Control" )
Thanks,
Randal Ferguson
|
ActiveX & xHarbour
|
Randal,
Where we may download a demo version of such mappoint activex ?
|
ActiveX & xHarbour
|
Antonio,
I don't know of anywhere you can download a trial version. Is there somewhere I can send you my version for you to review? I can zip up the setup and run disks, they are about 600mb & 300mb (zipped).
Thanks,
Randal Ferguson
|
ActiveX & xHarbour
|
Yes, you may email them to me as ZIP files. Thanks,
|
ActiveX -- Para Antonio
|
Hola Antonio.
Habrá mejoras en los componentes ActiveX soportados
por fivewin???
Se podrán usar en diálogos desde recursos?
que sucederá con los eventos ?
Gracias por la atención.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.