what-the wrote:
ihaveamac wrote:
What language did you use? Visual Basic? C#? C++? Some other? I know you wrote it in a .NET Framework language.
Visual Basic on Vista. I used Vista because that is the worst OS for programming. Upon first release I will release the source code and program files. (Open source).
Right now I just need a list of pro's, con's and bugs.
I can program VB.
New page!
Can you release source code?
Last edited by comp500 (2010-11-16 11:35:15)
Offline
comp500 wrote:
what-the wrote:
ihaveamac wrote:
What language did you use? Visual Basic? C#? C++? Some other? I know you wrote it in a .NET Framework language.
Visual Basic on Vista. I used Vista because that is the worst OS for programming. Upon first release I will release the source code and program files. (Open source).
Right now I just need a list of pro's, con's and bugs.I can program VB.
New page!
Can you release source code?
Ok. Here is the beta source code.
'Scratch Viewer Beta open source code.
'Created by what-the (http://scratch.mit.edu/users/what-the)
'You are free to use the following code
'You may not sell programs based on this code
'Please give credit to me in derivative programs (Based on what-the's "Scratch Viewer Beta". http://scratch.mit.edu/users/what-the )
Imports System.Runtime.InteropServices
Public Module resChanger
Const ENUM_CURRENT_SETTINGS As Integer = -1
Const CDS_UPDATEREGISTRY As Integer = &H1
Const CDS_TEST As Long = &H2
Const CCDEVICENAME As Integer = 32
Const CCFORMNAME As Integer = 32
Const DISP_CHANGE_SUCCESSFUL As Integer = 0
Const DISP_CHANGE_RESTART As Integer = 1
Const DISP_CHANGE_FAILED As Integer = -1
Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Integer, ByVal iModeNum As Integer, ByRef lpDevMode As DEVMODE) As Integer
Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (ByRef DEVMODE As DEVMODE, ByVal flags As Integer) As Integer
<StructLayout(LayoutKind.Sequential)> Public Structure DEVMODE
<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=CCDEVICENAME)> Public dmDeviceName As String
Public dmSpecVersion As Short
Public dmDriverVersion As Short
Public dmSize As Short
Public dmDriverExtra As Short
Public dmFields As Integer
Public dmOrientation As Short
Public dmPaperSize As Short
Public dmPaperLength As Short
Public dmPaperWidth As Short
Public dmScale As Short
Public dmCopies As Short
Public dmDefaultSource As Short
Public dmPrintQuality As Short
Public dmColor As Short
Public dmDuplex As Short
Public dmYResolution As Short
Public dmTTOption As Short
Public dmCollate As Short
<MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst:=CCFORMNAME)> Public dmFormName As String
Public dmUnusedPadding As Short
Public dmBitsPerPel As Short
Public dmPelsWidth As Integer
Public dmPelsHeight As Integer
Public dmDisplayFlags As Integer
Public dmDisplayFrequency As Integer
End Structure
Public Sub changeRes(ByVal theWidth As Integer, ByVal theHeight As Integer)
Dim DevM As DEVMODE
DevM.dmDeviceName = New [String](New Char(32) {})
DevM.dmFormName = New [String](New Char(32) {})
DevM.dmSize = CShort(Marshal.SizeOf(GetType(DEVMODE)))
If 0 <> EnumDisplaySettings(Nothing, ENUM_CURRENT_SETTINGS, DevM) Then
Dim lResult As Integer
DevM.dmPelsWidth = theWidth
DevM.dmPelsHeight = theHeight
'DevM.dmPelsWidth = 1280
' DevM.dmPelsHeight = 1024
lResult = ChangeDisplaySettings(DevM, CDS_TEST)
If lResult = DISP_CHANGE_FAILED Then
MsgBox("Display Change Failed.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Screen Resolution Change Failed")
Else
lResult = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY)
Select Case lResult
Case DISP_CHANGE_RESTART
MsgBox("You must restart your computer to apply these changes.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Screen Resolution Has Changed")
Case DISP_CHANGE_SUCCESSFUL
MsgBox("Display Change Successful.", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Screen Resolution Successful")
Case Else
MsgBox("Display Change Failed.", MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Screen Resolution Change Failed")
End Select
End If
End If
End Sub
End Module
Public Class Form1
Dim resolutionx As Integer
Dim resolutiony As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
resolutionx = Screen.PrimaryScreen.Bounds.Width
resolutiony = Screen.PrimaryScreen.Bounds.Height
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call changeRes(640, 480)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Call changeRes(resolutionx, resolutiony)
End
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call changeRes(resolutionx, resolutiony)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = resolutionx
Label2.Text = resolutiony
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If WebBrowser1.Url.ToString.StartsWith("http://scratch.mit.edu/projects/") Then
Dim websitecode As String
WebBrowser1.ScrollBarsEnabled = False
websitecode = "about:<html><body bgcolor=""Black""><div style=""position: absolute; left: 80px; top: 40px; ""><applet id='ProjectApplet' style='display:block' code='ScratchApplet' codebase='http://scratch.mit.edu/static/misc' archive='ScratchApplet.jar' height='387' width='482'><param name='project' value='../../static/" & WebBrowser1.Url.ToString.Remove(0, 23) & ".sb'></applet></div></body></html>"
MsgBox(websitecode)
WebBrowser1.Navigate(websitecode)
Button4.Visible = False
Else
MsgBox("No project to display")
End If
End Sub
Private Sub Button5_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Call changeRes(resolutionx, resolutiony)
Application.Restart()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Call changeRes(resolutionx, resolutiony)
Form2.Visible = True
End Sub
End Class
My site Offline
It doesn't run on my computer...? But sounds cool!
Offline