` Checking for winsock version (Jim Kane) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Clarion Environment (IDE etc.): Checking for winsock version
2004-01-16 -- Jim Kane
 
Newsgroups: softvelocity.clarion.third_party On second thought it's not that long so I'll just post it. calldllcl is my call by address class from clarion mag. if anyone finds a bug in this please call it to my attention - this has not been throughly tested yet. Jim Kane program _abcdllmode_ equate(0) _abclinkmode_ equate(1) map checkwsock(),byte end include('calldllcl.inc') code case checkwsock() of 0 Message('Winsock 2.0 is installed.') of 5 Message('winsock 2.0 is NOT installed.') else Message('Error determining if winsock2 installed.') end checkwsock procedure() calldllcl calldllcltype eProcfailcode equate(99) res byte(0) wsadatatype group,type wversion ushort whighversion ushort szDescription cstring(256) szSystemstatus cstring(128) iMaxsockets ushort iMaxUdpdg ushort lpvendorinfo long pad1 long pad2 long end wsadatastr &string wsadata &wsadatatype I long,auto cstr &cstring bytegroup group,over(Wsadata.whighversion) hibyte byte lobyte byte end code !create the data on the heap so it is 8 byte aligned wsadatastr&=new string(size(wsadatatype)) if wsadatastr&=null then return 3. !null it - prob not needed loop i=1 to size(wsadatatype) wsadatastr[i]='<0>' end wsadata&=(address(wsadatastr)) !load the dll if calldllcl.init('ws2_32.dll') then res=5 do procret end calldllcl.SetProcFailCode(eProcfailcode) case calldllcl.call('WSAStartup',2,address(wsadatastr)) of eProcfailcode res=3 !dll loaded but problems (unexplained calling it.) of 0 !got a result message('version='& bytegroup.hibyte & '.' & bytegroup.lobyte,'version') if bytegroup.hibyte>=2 then ! message('its 2') res=0 else ! message('not 2') res=5 end else !some winsock error res=3 end calldllcl.call('WSACleanup') do procret procret routine dispose(wsadatastr) calldllcl.kill() return res


Today is November 21, 2024, 3:48 am
This article has been viewed 35362 times.
Google search has resulted in 291 hits on this article since January 25, 2004.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: