• WSDylan Morley

    WSDylan Morley

    @wsdylan-morley

    Viewing 15 replies - 76 through 90 (of 94 total)
    Author
    Replies
    • in reply to: creating a helpfile (VB6) #606331

      There are a couple of help packages that you can use to create files…

      ‘Microsoft Help Workshop’
      This is the help package used to create the older ‘windows style’ help files. You generate the files by linking RTF documents together. Painful.

      ‘Microsoft HTML Help Workshop’
      This package generates help files in the ‘browser’ style format. You can design your help pages in any HTML editor, save to .HTM format and link the pages together in HTML workshop. Most of Microsofts help files are now in this format – I find this much easier to use and you can create quite advanced help files incorporating Java scripts etc. HTML workshop is a free download from Microsoft if you do not have it.

      The HelpContextID and WhatsThisHelpID properties allow you to link your VB application together with your help file. So, when a user presses F1 on a particular section of your system, the correct help page will be displayed. Unfortunately, there’s no standard wizard to create your help files with VB.

    • in reply to: menu bars (vb6) #605424

      The only way you can affect the menu bar or menu objects is by sub-classing the items and creating custom paint routines in your new window procedure.

      Can be complicated, but there’s some excellent source at http://www.vbaccelerator.com[/url%5D

      Check out either the coolbar/rebar or popmenu controls, both of which demonstrate these techniques with example projects.

    • in reply to: VB6 (Modules In Memory) #605176

      I suppose the biggest module is about 100KB & that’s been broken down into specific modular routines already (it’s a particularly complicated application now!). Whilst this isn’t much in itself, I worry about the client PC’s who don’t have as much RAM and pretty much push their PCs with multiple instances of Word, Access, Excel etc.

      This isn’t a serious problem, it’s not something thats causing the app to crash – I’m just not sure on how the modules are handled in Memory compared to say class objects which have obvious initialise/terminate events (Maybe I’ll create a few more objects if possible and get some of the code out of standard modules).

      Thanks for the answers – always good advice on this site.

    • in reply to: VB6 (Modules In Memory) #604906

      Gary,

      Yes, I think this is what I’m going to do. I was just hoping to find some articles to give a bit more info on what an ‘acceptable’ size module is and how they are handled during code execution – searched MSDN and found exactly nothing…!

      Thanks for your answer.

      Dylan

    • in reply to: Outlook ‘From’ Property (Outlook 98 VBA) #603882

      Just found the ‘SentOnBehalfOfName’ property!! Thanks anyway

    • in reply to: Reg Key Permissions (Any) #603470

      Kevin,

      Pure API for this one, there’s quite a good article on MSDN that should help you…

      http://msdn.microsoft.com/library/default….regapi_9zoz.asp[/url]

      You’ll need to use the GetNamedSecurityInfo or GetSecurityInfo APIs to return the security descriptor associated with the key.

      Thanks

      Edited by Rory to make link live.

    • in reply to: Compile Errors (MS Access 97) #603151

      I opened a temporary module in the database and noticed that the..

      Option Compare Database
      Option Explicit

      …statements were duplicated – Removed & it runs fine. Thanks, didn’t know this could affect queries…

    • in reply to: Missing Records (VB6 / MS Access) #591407

      Our network can be flaky at times & we are in the middle of migrating from 3xNovell 5.1 to IP4700 so this could well explain the hiccups.

      I think I’ll give the dbForceOSFlush and dbRefreshCache flags a go, they sound like they could solve my issues.

      Thanks again for your help

    • in reply to: Missing Records (VB6 / MS Access) #591173

      That sounds good & makes sense, I didn’t realise it could occur like that! I’m creating global objects when the app is loaded, I use a single routine to create the objects…

      Private Function OpenDatabase(DB_Database As Database, sDatabaseName As String) As Boolean

      On Error GoTo MainOpenError

      ‘ // Create workspace if one does not exist
      If (g_WSControl Is Nothing) Then
      Set g_WSControl = DBEngine.Workspaces(0)
      End If

      ‘ // Set the database
      Set DB_Database = g_WSControl.OpenDatabase(DataLocations.NetworkDatabasePathName & “” & sDatabaseName, False, False)
      OpenDatabase = True

      Exit Function

      MainOpenError:
      If Len(sDatabaseName) = 0 Then
      MsgBox “Error opening database – no database name supplied. Please check INI File”, vbInformation, “Error Occurred”
      End
      ElseIf (Err.Number = 3045) And (sDatabaseName = DataLocations.NetworkDatabaseName) Then
      MsgBox “The MACC database is being compacted and is not currently available.” & Chr$(13) & “Please try again in 5 minutes”, vbExclamation, “Database compacting”
      End
      Else
      MsgBox “Error occurred opening database(” & sDatabaseName & “)” & Chr$(13) & Err.Description, vbCritical, “Could not access ” & sDatabaseName
      End If

      End Function

      So, the g_WSControl is just the [DEFAULT_WORKSPACE] for the client PC.

      Oh, and just to make things more interesting – this isn’t a persistent error. It only seems to happen every now & then, but it’s too serious an error for me to roll the app out!

      Thanks again

    • in reply to: Missing Records (VB6 / MS Access) #591158

      Charlotte,

      This is the thing that’s driving me crazy. The search screen just builds some SQL from user input and opens a recordset over the ‘Order_Details’ table. The results of the SQL are then loaded into the results pane.

      Record 5029 appeared in the results pane so it has been returned from the SQL run over the database, indicating to me that the record has been saved. But, when I went into Access and looked at the table, the record was not there! How is it possible for the SQL to return a record in the app that’s not there in table view? If the record has not been saved, surely the SQL should not pick it up?

      I used a single transaction to control the update routine (BeginTrans, Update the recordset, CommitTrans, nothing fancy). Could the workspace have this effect?

      The WS object is released when the app is closed, this is the only thing I can think of that is being destroyed at this point, perhaps explaining why the data vanishes between app loads. Have you ever encountered any strange behaviour when using Workspaces?

      Thanks

    • in reply to: Registry Settings (MS Access 97) #591119

      Many Thanks

    • in reply to: DEVLOPER SITES (VBA) #588666

      http://www.planet-source-code.com [/url] has a forum where you may explain your project requirements and developers then bid against it.

      There are some good developers associated with the site and bids can be very competitive…

    • in reply to: DAO – File Sharing Lock Count (Visual Studio 6) #587954

      Charlotte,

      Yes, we’re using a Novell server – currently in the process of converting everything over to NT. Thanks for an excellent answer though, the article is very helpful.

      Cheers
      Dylan

    • in reply to: GetWindowLong (VB API) #565460

      Sam,

      Yeah that does it – my function now looks like…

      Private Function ValidateWindowStyle() As Boolean

      Dim lResult As Long

      lResult = GetWindowLong(m_varhWnd, GWL_STYLE)
      If (lResult And WS_THICKFRAME) Then
      ValidateWindowStyle = True
      End If

      End Function

      Thanks for your help!

    • in reply to: Reset printer to default using VBA (Word 2000) #559278

      I had a similar problem in a project that I am developing – I needed to switch to a different printer before opening Crystal reports (which picks up the default printer and doesn’t let you change before printing!).

      Couple of functions here might help…

      ‘ // To notify applications the printer has changed
      Private Const HWND_BROADCAST As Long = &HFFFF
      Private Const WM_WININICHANGE As Long = &H1A

      Private Declare Function GetProfileString Lib “kernel32” _
      Alias “GetProfileStringA” _
      (ByVal lpAppName As String, _
      ByVal lpKeyName As String, _
      ByVal lpDefault As String, _
      ByVal lpReturnedString As String, _
      ByVal nSize As Long) As Long

      Private Declare Function WriteProfileString Lib “kernel32” _
      Alias “WriteProfileStringA” _
      (ByVal lpszSection As String, _
      ByVal lpszKeyName As String, _
      ByVal lpszString As String) As Long

      Private Declare Function SendMessage Lib “user32” _
      Alias “SendMessageA” _
      (ByVal hwnd As Long, _
      ByVal wMsg As Long, _
      ByVal wParam As Long, _
      lparam As Any) As Long

      ‘ // ******************************************************************************
      ‘ // FUNCTION
      ‘ // SubDefaultPrinter(ByVal PrinterName As String,
      ‘ // ByVal DriverName As String,
      ‘ // ByVal PrinterPort As String)
      ‘ //
      ‘ // PARAMETERS
      ‘ // PrinterName – The name of the object printer
      ‘ // Drivername – The name of the driver for the objet printer
      ‘ // PrinterPort – The name of the port to action the printer on

      ‘ // RETURN VALUE
      ‘ // None
      ‘ //
      ‘ // COMPONENTS USED
      ‘ // Windows Registry
      ‘ //
      ‘ // NOTES
      ‘ // You can change the ‘default’ printer programatically by using the Win32-API. Used
      ‘ // to switch from a default printer to ‘Zetafax’ without any user interction
      ‘ // ******************************************************************************

      Private Sub SetDefaultPrinter(ByVal PrinterName As String, _
      ByVal DriverName As String, _
      ByVal PrinterPort As String)
      Dim DeviceLine As String

      ‘rebuild a valid device line string
      DeviceLine = PrinterName & “,” & DriverName & “,” & PrinterPort

      ‘Store the new printer information in the
      ‘[WINDOWS] section of the WIN.INI file for
      ‘the DEVICE= item
      Call WriteProfileString(“windows”, “Device”, DeviceLine)

      ‘Cause all applications to reload the INI file
      Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, ByVal “windows”)

      End Sub

      ‘ // ******************************************************************************
      ‘ // FUNCTION
      ‘ // GetDefaultPrinter()
      ‘ //
      ‘ // PARAMETERS
      ‘ // None

      ‘ // RETURN VALUE
      ‘ // String representation of the current default printer
      ‘ //
      ‘ // COMPONENTS USED
      ‘ // Windows Registry
      ‘ //
      ‘ // NOTES
      ‘ // Returns the value held in the registry that represents the users default printer
      ‘ // ******************************************************************************

      Public Function GetDefaultPrinter() As String

      Dim sReturnString As String

      ‘ // Allocate string space
      sReturnString = Space(1024)

      ‘ // Get the currently active (default) printer held in the registry
      GetDefaultPrinter = Left(sReturnString, GetProfileString(“windows”, “Device”, “”, sReturnString, Len(sReturnString)))

      ‘ // Cause all applications to reload the INI file
      Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, ByVal “windows”)

      End Function

      Test out the ‘GetDefaultPrinter’ function which should return the print string that is stashed in the registry

    Viewing 15 replies - 76 through 90 (of 94 total)