- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
(p.s. You may need to add WININET.LIB to the link library list for the project)
program Testinternetconnection
use dfwin
use dflib
implicit none
interface
Integer function InternetGetConnectedState(result, dummy)
!DEC$ ATTRIBUTES C, ALIAS :'_InternetGetConnectedState@8'::InternetGetConnectedState
!DEC$ ATTRIBUTES REFERENCE:: RESULT
!DEC$ ATTRIBUTES VALUE:: DUMMY
integer dummy
integer result
end function
end interface
INTEGER, PARAMETER :: INTERNET_CONNECTION_CONFIGURED = Z'40'
INTEGER, PARAMETER :: INTERNET_CONNECTION_LAN = Z'2'
INTEGER, PARAMETER :: INTERNET_CONNECTION_MODEM = Z'1'
INTEGER, PARAMETER :: INTERNET_CONNECTION_OFFLINE = Z'20'
INTEGER, PARAMETER :: INTERNET_CONNECTION_PROXY = Z'4'
INTEGER, PARAMETER :: INTERNET_RAS_INSTALLED = Z'10'
integer iret, lret
character(3) chiret
integer result
iret=InternetGetConnectedState(result, 0)
!
write(chiret,'(i3)') iret
lret=MessageBox(0,'iret = '//chiret//char(0),'Internetconnection status'c,MB_OK)
If ((Result.AND.INTERNET_CONNECTION_CONFIGURED) .EQ. INTERNET_CONNECTION_CONFIGURED) Then
lret=MessageBox(0,"Local system has a valid connection to the Internet,/r but it may or may not be currently connected."c, & 'Internet Connection Status'c, mb_OK)
endif
If ((Result.AND.INTERNET_CONNECTION_LAN) .EQ. INTERNET_CONNECTION_LAN) Then
lret=MessageBox(0,"Local system uses a local area network to connect to the Internet."c, &
'Internet Connection Status'c, mb_OK)
endif
If ((Result.AND.INTERNET_CONNECTION_MODEM) .EQ. INTERNET_CONNECTION_MODEM) Then
lret=MessageBox(0,"Local system uses a modem to connect to the Internet."c, &
'Internet Connection Status'c, mb_OK)
endif
If ((Result.AND.INTERNET_CONNECTION_OFFLINE) .EQ. INTERNET_CONNECTION_OFFLINE) Then
lret=MessageBox(0,"Local system is in offline mode."c, &
'Internet Connection Status'c, mb_OK)
endif
If ((Result.AND.INTERNET_CONNECTION_PROXY) .EQ. INTERNET_CONNECTION_PROXY) Then
lret=MessageBox(0,"Local system uses a proxy server to connect to the Internet."c, &
'Internet Connection Status'c, mb_OK)
endif
If ((Result.AND.INTERNET_RAS_INSTALLED) .EQ. INTERNET_RAS_INSTALLED) Then
lret=MessageBox(0,"Local system has RAS installed."c, &
'Internet Connection Status'c, mb_OK)
endif
end program Testinternetconnection
(P.S. Later bug-tracing shows that the above has the wrong calling convention: Please replace
!DEC$ ATTRIBUTES C, ALIAS :'_InternetGetConnectedState@8'::InternetGetConnectedState
with
!DEC$ ATTRIBUTES STDCALL, ALIAS :'_InternetGetConnectedState@8'::InternetGetConnectedState
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The IVF solution showED one bug, in that the ' iret =' part of the first messageBox text string is screwed up (see attachment) although subsequent messageboxes show correct text(see attachment). If I put the concatenated text into a seperate character string and include that into the message box instead, I get an access violation. Wierd! I will investigate this further.
Well I investigated further and I think it is a stack problem caused by the wrong calling convention.
Please replace
!DEC$ ATTRIBUTES C, ALIAS :'_InternetGetConnectedState@8'::InternetGetConnectedState
with
!DEC$ ATTRIBUTES STDCALL, ALIAS :'_InternetGetConnectedState@8'::InternetGetConnectedState
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have no idea how my VS 2005 knows where the export library WININET.LIB associated with the DLL is located on my system and therefore have no idea how VS automatically finds it when it is listed as an Additional dependency. Perhaps Steve can oblige?. On my system, I have found that WININET.LIB is located at a couple of places, both in a PlatformSDK /Lib/ folder.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The only way I have found of actually viewing the contents of a particular VS environment variable was to open the VSVARS32.BAT in the \Program Files\Visual Studio 8\common7\tools\ folder and browse it in an Editor. Is there a way from within Visual Studio?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then do a build.
Reading the .bat file will not help you here - some of the variables are generated dynamically by Visual Studio.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page