Skip to content

Instantly share code, notes, and snippets.

@KevinRagsdale
KevinRagsdale / fontfactor.prg
Created December 16, 2013 15:56
Code to determine the current DPI setting. Displays the percentage I should bump up my visual controls by in order to match the users settings.
LOCAL liHDC, liPixelsPerInchX, ;
liPixelsPerInchY, lnFontFactor
DECLARE INTEGER GetDC IN Win32API ;
INTEGER iHDC
DECLARE INTEGER GetDeviceCaps IN WIN32API ;
INTEGER iHDC, INTEGER iIndex
#DEFINE cnLOG_PIXELS_X 88
@KevinRagsdale
KevinRagsdale / lblLabel.prg
Last active December 31, 2015 10:59
Subclassed Label control, used as my base label
DEFINE CLASS lbllabel AS label
AutoSize = .T.
FontName = "Segoe UI Symbol"
BackStyle = 0
Caption = "lblLabel"
Height = 17
Width = 43
Name = "lblLabel"
@KevinRagsdale
KevinRagsdale / lblHyperlink.Init
Created December 15, 2013 18:04
Init() method for the lblHyperlink class
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim lcUserAgent As String = Request.UserAgent.ToString()
If lcUserAgent.Contains("Visual Search Pro Demo") = False Then
Response.Write("Sorry. Not the User-Agent I expected.")
Else
Response.Write("Yay! You selected the correct User-Agent!")
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim lcHeader As String = ""
If Not Request.Headers("X-MyHeader") Is Nothing Then
lcHeader = Request.Headers("X-MyHeader").ToString()
Response.Write("Hey, thanks for sending X-MyHeader: " & lcHeader)
Else
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim lcUserAgent As String = Request.UserAgent.ToString()
If lcUserAgent.Contains("Visual Search Pro Demo") = False Then
Response.Write("Sorry. Not the User-Agent I expected.")
Else
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim lcHeader As String = ""
If Not Request.Headers("X-MyHeader") Is Nothing Then
lcHeader = Request.Headers("X-MyHeader").ToString()
Response.Write("Hey, thanks for sending X-MyHeader: " & lcHeader)
Else
** This DLL is a simple PRG file.
** It will create a web page "on the fly"
** and return it as a string to the
** calling program.
DEFINE CLASS Demo As Session OLEPUBLIC
FUNCTION GetHTML() As String
LOCAL lcString As String
TEXT TO m.lcString TEXTMERGE NOSHOW
<!DOCTYPE html>
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim oVFP As New Interop.FirstDemo.Demo
Dim cRet As String = oVFP.GetHTML()
oVFP = Nothing
Response.Write(cRet)
End Sub
</script>