
dynamic_sysop
Leaders
-
Posts
1044 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by dynamic_sysop
-
you can set Sub Main as your start up , then do this ... '/// add a module to your application , then set it's Sub Main as your start-up object Imports System.Windows.Forms Module Module1 Sub main() Dim frmMain As New Form1 frmMain.Show() Application.Run() '/// NOTE : i run the application without a start-up Main form. End Sub End Module if you close the Form1 ( or any other Form ) the application will still be running , so make sure you handle this with some sort of boolean switch eg: Dim closeapp As Boolean '/// in an unload function ( somewhere in your Application that can be accessed publicly ) If closeapp = True Then Application.Exit() Else '/// do nothing End If
-
sorry i forgot to mention , to show inside the help file it's self ( rather than explorer ) , you need to use the HelpProvider to specify the location of your .chm file , eg: Dim hlp As New HelpProvider hlp.HelpNamespace = "C:\Documents and Settings\den\My Documents\IL ASM BOOK\IS_001\ASSEMBLE.CHM" hlp.SetHelpNavigator(Me, HelpNavigator.Topic) Help.ShowHelp(Me, hlp.HelpNamespace, HelpNavigator.Topic, "mk:@MSITStore:C:\Documents%20and%20Settings\den\My%20Documents\IL%20ASM%20BOOK\IS_001\ASSEMBLE.CHM::/assemblehtml/32ch03b.htm")
-
take a look at the Help Class in System.Windows.Forms , it's as easy as this ... ( assuming you have the full url ) Help.ShowHelpIndex(Me, "mk:@MSITStore:C:\Documents%20and%20Settings\den\My%20Documents\IL%20ASM%20BOOK\IS_001\ASSEMBLE.CHM::/assemblehtml/32ch03b.htm") ;)
-
launch internet explorer in winforms using vb.net
dynamic_sysop
replied to kaisersoze's topic in Windows Forms
'/// if IE is the default browser System.Diagnostics.Process.Start("C:\your_file_name.html") '/// or System.Diagnostics.Process.Start("EXPLORER.EXE , "C:\your_file_name.html") '/// or System.Diagnostics.Process.Start("EXPLORER.EXE , "http://some_site.com") -
you can set the TextBox's style to accept only numbers being typed , but then you have to handle the pasting of text ( WM_PASTE ) , here's a quick example i knocked up for you ... Private Const ES_NUMBER As Int32 = &H2000I Private Const GWL_STYLE As Int32 = -16 Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Int32) As Int32 Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Int32, ByVal dwNewLong As Int32) As Int32 Private numertext As NumericTextbox '/// this will handle WM_PASTE Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim style As Int32 = GetWindowLong(TextBox1.Handle, GWL_STYLE) style += ES_NUMBER SetWindowLong(TextBox1.Handle, GWL_STYLE, style) '/// now i subclass the textbox to handle the paste message / CTL + V numertext = New NumericTextbox(TextBox1.Handle) End Sub Public Class NumericTextbox Inherits NativeWindow Private Const WM_PASTE As Int32 = &H302 Public Sub New(ByVal handle As IntPtr) MyBase.AssignHandle(handle) End Sub Protected Overrides Sub WndProc(ByRef m As Message) If Not m.Msg = WM_PASTE Then MyBase.WndProc(m) ElseIf m.Msg = WM_PASTE Then '/// lets get the clipboard info that's being pasted If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) Then Dim s As String = DirectCast(Clipboard.GetDataObject.GetData(DataFormats.Text), String) If IsNumeric(s) Then '/// it's a numeric string being pasted MyBase.WndProc(m) End If End If End If End Sub End Class hope it helps :)
-
Extra File Information
dynamic_sysop
replied to modularbeing's topic in Directory / File IO / Registry
take a look at this article on vbaccelerator , the page you will land on has a section about the IPropertyStorage interface , but at the top of the page you can go to a fully downloadable example ( this example is really designed for cd-burning i think ) link to article btw : if you take your time , looking at Com stuff , interfaces etc... isn't as scary as you think. be brave ;) -
you can also read the file using the System.IO.StreamReader class , then use the replace function of the string class to remove your string , eg: [color=Blue]string[/color] path = [color=Purple]@"C:\a text file.txt"[/color]; [color=Green]// path to the text file.[/color] System.IO.StreamReader sread = [color=Blue]new[/color] System.IO.StreamReader( path , System.Text.Encoding.Default); [color=Blue]string[/color] temp = sread.ReadToEnd(); [color=Green]// read the file[/color] temp = temp.Replace("some" , ""); [color=Green]// remove the string ( in this case the word ' some ' )[/color] sread.Close(); [color=Green]/* make sure we close the StreamReader , so we can write the file back with the string removed. now we can write the file back ( minus the string ' some ' ) */[/color] System.IO.StreamWriter swrite = [color=Blue]new[/color] System.IO.StreamWriter( path , [color=Blue]false[/color] , System.Text.Encoding.Default); swrite.Write(temp); swrite.Close();
-
well in that path , you seem to have a \ missing , shouldn't it be HOST\ then the file name.
-
you won't actually open the file ( so as to see it ) using File.Open , you need to use Process.Start to do that , eg: Dim strFile As String strFile = Application.StartupPath & "\help.chm" If (System.IO.File.Exists(strFile)) Then System.Diagnostics.Process.Start(strFile) '/// launch the chm file to view it. End If
-
I forgot to mention , try pressing ' Alt & Space ' , then you can select the ' Move ' menuitem using the Arrow keys on your keyboard and still move the Form using the WndProc Method you are using ;) another good reason to remove the MenuItem i guess :) hope it helps :cool:
-
the vb syntax is done by [ vb ] --- code --- [ /vb ] without the spaces. the menu thing , what you must consider is, if you want to make a form that doesn't move, but it has a menu option to move it, it might not look to professional ( just my personnal opinion ) :-\
-
you could always remove the ' Move ' MenuItem from your Form , so that the menu option to move it is gone , eg: Private Declare Function GetSystemMenu Lib "user32.dll" (ByVal hwnd As IntPtr, ByVal bRevert As Int32) As Int32 Private Declare Function RemoveMenu Lib "user32.dll" (ByVal hMenu As Int32, ByVal nPosition As Int32, ByVal wFlags As Int32) As Int32 Private Const MF_BYPOSITION As Int32 = &H400I Private Const MF_DISABLED As Int32 = &H2I Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim hMenu As Int32 = GetSystemMenu(MyBase.Handle, 0) If (hMenu > 0) Then Dim MOVEMENU As Int32 = 1 '/// this is the normal index of the ' Move ' menuitem RemoveMenu(hMenu, MOVEMENU, MF_BYPOSITION Or MF_DISABLED) End If End Sub ;)
-
under HKEY_CLASSES_ROOT this may be what you are looking for then HKEY_CLASSES_ROOT\htmlfile\shell\open\command the Default value being the key , in this case ... "C:\Program Files\Internet Explorer\iexplore.exe" -nohome
-
yeah :D good on you for havin a go.
-
quite a bit of .NET is built using C# ;) C# is better than Managed C++ in my opinion
-
not sure what other's may think, but i'd recommend using C# rather than c++ or vb.net. but C# happens to be my favourite language ( along with J# :eek: )
-
DLL or ActiveX controls for VB6
dynamic_sysop
replied to joe_pool_is's topic in Interoperation / Office Integration
you can use the command tlbexp from the .NET Command Prompt to produce a typelib that can be referenced in vb6 , but you would if my memory serves me well still need the machine the application will run on to have the .NET Framework installed. here's an msdn article on it ... using tlbexp -
gc stands for garbage collection ( part of the .net framework ) , here's msdn's explanation ... __gc here's msdn's link to all the C++ Keywords ... C++ Keywords hope it helps :)
-
i assume you are using managed C++ ( windows forms ) , here's one way... String * str = "Joe "; String * str1 = "Fly"; String * str2 = "\nSome stuff on a newline"; /// \n being a new line String * result = String::Concat(str,str1,str2); /// String::Concat joins an array of strings together MessageBox::Show(result);
-
you can make an eventhandler for the usercontrol like this ... Public Event AfterExpand(ByVal s As String) Public Event AfterSelect(ByVal s As String) Private Sub TreeView1_AfterExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterExpand RaiseEvent AfterExpand(" your string here ") End Sub Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect RaiseEvent AfterSelect(" your string here ") End Sub to access them from say a form .... Private WithEvents uc As UserControl1 = New UserControl1 Private Sub uc_AfterExpand(ByVal s As String) Handles uc.AfterExpand '/// your code here. End Sub Private Sub uc_AfterSelect(ByVal s As String) Handles uc.AfterSelect End Sub
-
you are only trying to changed the string value you get out of the array , you need to change the actual array item , eg: Dim strItems As String() = {"item 1", "item 2", "item 3", "item 4", "item 5", "item 6"} '/// add some items to a string array Dim arrlist As New ArrayList arrlist.AddRange(strItems) Dim x As Integer = 0 For x = 0 To arrlist.Count - 1 arrlist(x) = "the new value " & x '/// modify the array item's text. Next
-
Changing desktop wallpaper
dynamic_sysop
replied to allstar's topic in Interoperation / Office Integration
you would first need to create a bitmap / some sort of image of the html page , then you can use the above mentioned methods of setting as desktop background. here's an example i built a long time ago ( been digging through my cd archives ) it's based on the screenshot application i did in C++ to capture the mouse but thats another story . the form ( Form1 ) ... [color=Green]/// in a Form with 2 buttons ...[/color] [color=Gray]/// <summary> ///[/color] [color=Green]the code to use the class ( in this case it's button clicks in Form1 )[/color] [color=Gray] /// </summary>[/color] private void button1_Click(object sender, System.EventArgs e) { Process.Start("IEXPLORE.EXE" , textBox1.Text ); /// textBox1.Text contains a valid url to snapshot. button1.Enabled = false; } private void button2_Click(object sender, System.EventArgs e) { this.Visible=false; while(this.Visible) { Application.DoEvents(); } System.Threading.Thread.Sleep(75); /// give the form chance to hide. _win32 bmpShot = new _win32(); /// the snapshot takes place upon creating this class. bmpShot.bmp.Save( @"C:\imgWeb.bmp" ); /// in this case i save the image as a bitmap to the C drive. button1.Enabled = true; this.Visible=true; } the class that takes the html screen and makes an image of it... [color=Gray]/// <summary> ///[/color] [color=Green]the class that performs the snapshot of your html page.[/color] [color=Gray]/// </summary>[/color] [color=Blue]public class[/color] _win32 { [color=Blue]#region[/color] " Api Calls " [color=Blue]private const int[/color] SRCCOPY = 0xCC0020; [DllImport("gdi32.dll")] [color=Blue]private static extern[/color] IntPtr BitBlt (IntPtr hDestDC, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop); [DllImport("gdi32.dll")] [color=Blue]private static extern[/color] IntPtr CreateCompatibleBitmap (IntPtr hdc, int nWidth, int nHeight); [DllImport("gdi32.dll")] [color=Blue]private static extern[/color] IntPtr CreateCompatibleDC (IntPtr hdc); [DllImport("gdi32.dll")] [color=Blue]private static extern[/color] IntPtr DeleteDC (IntPtr hdc); [DllImport("gdi32.dll")] [color=Blue]private static extern[/color] IntPtr DeleteObject (IntPtr hObject); [DllImport("user32.dll")] [color=Blue]private static extern[/color] IntPtr GetDC (IntPtr hwnd); [DllImport("user32.dll")] [color=Blue]private static extern int[/color] GetWindowRect (IntPtr hwnd, ref Rectangle lpRect); [DllImport("user32.dll")] [color=Blue]private static extern[/color] IntPtr ReleaseDC (IntPtr hwnd, IntPtr hdc); [DllImport("gdi32.dll")] [color=Blue]private static extern[/color] IntPtr SelectObject (IntPtr hdc, IntPtr hObject); [DllImport("user32.dll", EntryPoint="FindWindowA")] [color=Blue]private static extern[/color] IntPtr FindWindow (string lpClassName, string lpWindowName); [DllImport("user32.dll", EntryPoint="FindWindowExA")] [color=Blue]private static extern[/color] IntPtr FindWindowEx (IntPtr hWnd1,IntPtr hWnd2, string lpsz1, string lpsz2); [color=Blue]#endregion[/color] [color=Blue]public[/color] Rectangle clientRect=new Rectangle(); [color=Blue]public[/color] Bitmap bmp; [color=Blue]public[/color] _win32() { IntPtr val = this.WebHandle(); if(val!=IntPtr.Zero) { this.dcHandle( val ); } } [color=Blue]public[/color] IntPtr WebHandle() { IntPtr hwnd = FindWindow( "IEFRAME" , null ); IntPtr hwndSrc = IntPtr.Zero; if(hwnd != IntPtr.Zero) { hwndSrc = FindWindowEx( hwnd , IntPtr.Zero , "Shell DocObject View" , null ); hwndSrc = FindWindowEx( hwndSrc , IntPtr.Zero , "InterNet Explorer_Server" , null ); GetWindowRect( hwndSrc , ref clientRect ); } return hwndSrc; } [color=Blue]public void[/color] dcHandle(IntPtr hHandle) { IntPtr srcHdc = gDc( hHandle ); IntPtr destHdc = CreateCompatibleDC( srcHdc ); IntPtr bmpDc = CreateCompatibleBitmap( srcHdc , clientRect.Width , clientRect.Height - 145 ); CreateImageCanvas( destHdc , srcHdc , bmpDc , clientRect , SRCCOPY ); bmp = bMap( bmpDc ); /// create the bitmap to save. CleanDcs( hHandle , destHdc , srcHdc , bmpDc ); return; } [color=Blue]public[/color] IntPtr gDc(IntPtr hHandle) { return GetDC( hHandle ); } [color=Blue]public void[/color] CreateImageCanvas(IntPtr dest , IntPtr source , IntPtr bDc , Rectangle rct , int dwRop ) { IntPtr objDc = SelectObject( dest , bDc ); BitBlt( dest , 0 , 0 , clientRect.Width , clientRect.Height - 145 , source, 0 , 0 , SRCCOPY ); SelectObject( dest , objDc ); return; } [color=Blue]public[/color] Bitmap bMap(IntPtr b) { return Bitmap.FromHbitmap(b); } [color=Blue]public void[/color] CleanDcs(IntPtr hHandle , IntPtr dest , IntPtr source , IntPtr bDc ) { ReleaseDC( hHandle , source ); DeleteDC( dest ); DeleteObject( bDc ); return; } } hope it helps :) -
like this... [color=Blue]if[/color](MessageBox.Show("is it yes or no","the caption",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes) { Console.WriteLine("the answer is yes"); }
-
click help on internet explorer and then " about " in the drop down menu, you will see that IE is developed from Mosaic , this is the message you'll see... you can find quite a bit of stuff about mosaic on google , it's possible to develop your own webbrowser from scratch if you check it out .
-
System.Diagnostics.Process.Start("http://www.visualbasicforum.com")