Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all 21813 articles
Browse latest View live

[RESOLVED] Getting a compile error : stub or function not defined error in VB6

$
0
0
I am creating a sample VB6 application. I used WebKitX control to embed a browser into my app. Here is my sample code

Private Sub WebKitXCEF31_OnBrowserReady()

WebKitXCEF31.ExecCommandSetFocus = True
WebKitXCEF31.FormatUsingInternalSelectionAPI = True
WebKitXCEF31.DownloadScripts = True
WebKitXCEF31.Open "http://www.google.com/"

End Sub

Private Sub WebKitXCEF31_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As
String)

Settings.cache_path = App.Path + "\MyCache"
Settings.application_cache = App.Path + "\MyAppCache"
Settings.persist_session_cookies = 1
Settings.persist_user_preferences = 1
AddLog "CommandLineSwitches=" + CommandLineSwitches

End Sub

Private Sub WebKitXCEF31_OnLoadEnd()

WebKitXCEF31.Preview
WebKitXCEF31.Events = DOM_EVENT_SELECTSTART Or _
DOM_EVENT_DOMSUBTREEMODIFIED Or _
DOM_EVENT_DOMFOCUSIN Or _
DOM_EVENT_CLICK Or _
DOM_EVENT_EDITABLE_ELEMENT_CHANGED

End Sub

The Form_Load() method is empty. When I run the application, an error is thrown at the WebKitXCEF31_OnCreate stub with the message 'Compile Error: Sub or Function not defined.'. Is there any place specific where we need to define the stub/method before implementing it? I am new to VB6 and this is the first code that i have written. This code is available on WebKitX. Link : https://www.webkitx.com/webkitx.html

Remove duplication in listview column

$
0
0
Hello VbForums
Is there a way to remove duplication in a listviw column?
thank you
Name:  25-09-2020 18-03-34.png
Views: 31
Size:  4.7 KB
Attached Images
 

Looking to build a HTTP class but what should it be built off of?

$
0
0
The way I see it, there are 3 options here:



I've had some minor problems with WinHTTP.WinHTTPRequest at times, so I'm inclined not to use that, but generally speaking I don't know if Microsoft.XMLHTTP implementation is outdated also...

Does anyone have any experience here? Would you suggest XMLHTTP or WinHTTP? Or are there existing HTTP libraries out there which can be easily used?

Thanks
~Sancarn

Edit:
I did at least find this comparisson which seems to suggest WinHTTP directly is the better alternative...
https://docs.microsoft.com/en-us/win...http-interface

[RESOLVED] Remove duplication in listview column

$
0
0
Hello VbForums
Is there a way to remove duplication in a listviw column?
thank you
Name:  25-09-2020 18-03-34.png
Views: 52
Size:  4.7 KB
Attached Images
 

how to programatically use the gpedit.msc? or there is a command line version?

$
0
0
I am tryinging to configure the lanman (client side), in Windows 10 LTSC , the default is not to navigate in network directories anonymously (surelly for security reasons in a corporate environment), but this version of windows is also usual in gaming houses, LanHouses, which uses too this kind of windows virtually, because it is light.

So I need to "enable the non secure guest sessions" under lanman workstation (in spanish "habilitar el inicio de sesión de invitado no seguros".

Anyway, I toogle that politic, and watched the registry to see which key is affected, so then I regedit that instead using the gpedit, but, it didn't work, and I think some CLSIDs are different from machine to machine, atleast didn't found the same.

the only one config that is not under a CLSID path is this, <RUN="cmd /c REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows\LanmanWorkstation" /V "AllowInsecureGuestAuth" /t REG_DWORD /D 1 /f">

But this is not working, the client can't browser the anonymous browseable folders with just that reg add

Anyone solved this puzzle already?.

we almost got the source to VB6

Automatically Load most recent project at startup?

$
0
0
How the heck do you get the VB6 IDE to automatically open the last project at start-up? I get this annoying window every time. It makes no difference if you check that "show at startup" or not. I know I can make an icon on my desktop to run the IDE with a command line pointing to my project but I'd like to know if there's an easier way. This has been bugging me for 20 years and I finally decided to see if there's a solution. :) Thanks in advance.

Vb6: check if textbox contains multiple values

$
0
0
I have this text inside textbox:
----------------
Vary: Accept-Encoding
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
----------
i need to get msgbox when max=2 , but it show msgbox when textbox show max=20

this code not working, please help

If InStr(text1.text, "max=2" & "Connection: Keep-Alive") Then
MsgBox "done"
End If

VB6 Question: Is there a method of reading an embedded image in a DLL using GDI+?

$
0
0
Is there a method of reading an embedded image in a DLL using GDI+?

I have previously been using an undocumented API named PrivateExtractIcons to extract PNGs from DLLs or EXEs and then place them into a picturebox but the method I am currently using returns the PNG with a hard jpeg-like background. This is no good as I'm trying to insert the PNG into my GDi+dock that requires transparent PNGs.

I was hoping there was a GDI+ function that might be able to extract a PNG image directly from an EXE or DLL. IF there is such a thing please point me in the right direction. I have found something written for Powerbasic but before I try to hack that I was hoping you chaps might have a better idea?

Vb6: Winsock data arrival truncated problem

$
0
0
I have this code, but it only grab truncated data, the data is a little bit large, it is a page source code

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)

Dim strResponse As String
Winsock1.GetData strResponse, vbString
RichTextBox1.Text = RichTextBox1.Text & strResponse

please help to fix this problem

How to set form interior size (ScaleWidth and ScaleHeight) to specific dimensions

$
0
0
Hey

I need to set a form's interior size to specific dimensions.

frm.Width and frm.Height define not only the form's interior but also include window borders and possibly other things, which vary in size, and I don't care about those. frm.ScaleWidth and frm.ScaleHeight define the form's interior and I am interested in programmatically setting the interior size to specific dimensions. Unfortunately both of these properties are read-only.

How can one do that?

One idea I have is to first determine the size of the borders and then to set the form's size to the desired size + borders:
Code:

    reqXPx = 1280
    reqYPx = 768

    borderXTw = frm.Width - frm.ScaleWidth
    borderYTw = frm.Height - frm.ScaleHeight

    frm.Width = pixelsToTwipsH(reqXPx) + borderXTw
    frm.Height = pixelsToTwipsV(reqYPx) + borderYTw

Is there a better way?

How to display VB MessageBox to right screen in multimonitor system.

$
0
0
Need to display VB MsgBox in correct screen in multimonitor system.

Normally messagebox is displayed in screen(1) or monitor where the application main window resides - but if user moves other than application main form to second screen, messagebox called from that other form still shows in main form monitor.

Any idea - how to move/display messagebox into monitor/screen area, where the form which calls messagebox is located?

[RESOLVED] Understanding IO Operations in VB6

$
0
0
I am still in the process of converting a VB6 software application to a C#/Angular web application.

Something that I'm having a difficult time wrapping my head around is how VB6 handles IO write operations.

Here is a block of code that I'm currently examining:
Code:

On Error GoTo
With frmResources.CDialog1
    .CancelError = True
    .DialogTitle = "Please Select Save Name and Location..."
    .filename = "EBB0D5X4.txt"
    .DefaultExt = ".txt"
    .Filter = "Text (*.txt)|*.txt"
    .flags = cdlOFNPathMustExist Or cdlOFNOverwritePrompt Or cdlOFNExtensionDifferent Or cdlOFNExplorer Or cdlOFNHideReadOnly
    .ShowSave
    mSaveEdi = .filename
End With

OutNum = FreeFile
Open mSaveEdi For Output As OutNum

This looks to me like it is doing a few things:
  1. Setting up the properties of a dialog (possibly a SaveFileDialog?)
  2. Set OutNum equal to FreeFile
  3. Open the file specified in the dialog


The first thing that doesn't make sense to me is step 2 because I'm not sure what FreeFile is. The Object Browser states that it:
Quote:

Returns the next file number available for use by Open
But that doesn't really tell me much.

The second thing that I'm not necessarily sure about is step 3. I see where later on in the source code there are these lines being used in a loop:
Code:

Print #OutNum, "..."
Wouldn't this essentially build the text file, line by line? It seems to me like it'd be more efficient to build the entire contents of the text file first and then write it to the desired location all at once.

VBRichClient - SQLite - Slow Loading Data

$
0
0
Dear gurus

I am using Sqlite to build application for sales order,
I always use Begintrans, Committrans while doing saving stuff
Now problem is, when I try to load or view the record, the things start to slow down,
I am using LynxGrid to show the details data in table format.

I don't know the reason because Sqlite or LynxGrid,
I already try this :

Cnn.Synchronous = false
Cnn.begintrans
....

Cnn.committrans
cnn.synchronous = true

I don't know if we load record, do we need begintrans..committrans ??

While for Lynxgrid , I already did the redraw=false (before add item to table) and redraw=true (after additem finished)

But still really sluggish and slow

Help

VB6 - String Formatting

$
0
0
There is this bit of code:
Code:

Format(UCase(value), "!@@@@@@@@@@@@@@@@")
Looking at the user-defined string formats documentation, I wanted to verify that this code is doing the following:
  1. Force the incoming string to uppercase
  2. Take the last 16 characters
  3. If the length of the string is less than 16, append spaces for each missing character

How to Terminate Previous Instance of My Application

$
0
0
I would like my application to check upon startup if a previous instance of the application is running. If so, it should terminate the previous instance and continue running the current instance so that there is only one instance of the application running. Searching the 'net, I found the following example code:

Code:

'This is Form1.frm, the startup form
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long

Private Const WM_CLOSE = &H10

Private Sub Command1_Click()
MsgBox "Hello World"
End Sub

Private Sub Form_Load()
Dim strCap As String
Dim lngHwnd As Long
Dim lngRet As Long
Text1.Text = "This is the first instance!"
'Store the existing caption in a temp var
'and change it to something else as
'we are going to use the Caption to find
'an earlier instance of this application
strCap = Me.Caption
Me.Caption = "*" & strCap

'Find the window of the preveious instance
'using the original Caption
lngHwnd = FindWindow(ByVal vbNullString, ByVal strCap)

'This means App.PrevInstance is True
If lngHwnd <> 0 Then
    Text1.Text = "This program was already running!"
    MsgBox Text1.Text
    'Send a Close message to that window
    PostMessage lngHwnd, WM_CLOSE, 0&, 0&
End If

'Reset the Caption, so that the next version of the application
'can find this application
Me.Caption = strCap
End Sub

I compiled and tested this code and it works. But when I implement the principles and methodology of this code in my actual application, it doesn't work. My application happens to have an MDI form, mdiMain.frm, with several children forms. The startup is Sub Main and I put the previous instance checking code in Sub Main. It is able to detect that a previous instance is running, but the big problem is that it is not able to close the previous instance.

Here is the code that I put in Sub Main:

Code:

Public Sub Main()
Dim strCap As String, lngHwnd As Long
strCap = mdiMain.Caption
mdiMain.Caption = "*" & strCap
lngHwnd = FindWindow(ByVal vbNullString, ByVal strCap)
If lngHwnd <> 0 Then
    MsgBox "App already running!"
    'Send a Close message to that window
    'This does not work
    PostMessage lngHwnd, WM_CLOSE, 0&, 0&
End If
mdiMain.Caption = strCap
MsgBox "Hello! " & Now
End
End Sub

I am able to see the message "App already running!" but after that, the PostMessage command which is supposed to close the previous instance does not seem to do anything. The previous instance remains running.

What am I doing wrong?

Get directory listing on a timer

$
0
0
I was hoping for fastest directory list.

Not sure but this method works good.

Can it be memory or api problem i wonder.

Just keeps crashing on 5 second timer.

Project3.zip
Attached Files

[RESOLVED] Get directory listing on a timer

$
0
0
I was hoping for fastest directory list.

Not sure but this method works good.

Can it be memory or api problem i wonder.

Just keeps crashing on 5 second timer.

Project3.zip
Attached Files

Load image into STATIC control Win32

$
0
0
Code:

hwnd = CreateWindowEx(0, "STATIC", "", SS_BITMAP + WS_CHILD + WS_VISIBLE, 50, 55, 200, 200, hWnd, 0, Application.Hinstance, ByVal 0&)
Call SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, GetHBMP(UserForm1.Image1))

I am trying to add an image to a win32 static control using the code above.

The Static control is created successfully onto its parent form, but no image is displayed.

GetHBMP is a user function that successfully returns a valid bitmap handle from another image activeX on the form (<==tested and confirmed).

Do I need to set the static image in the static control window procedure for it to take effect or do I need to set the OwnerDrawn style and set the image in its Parent window procedure?

Note:
The Static control IS NOT OwnerDrawn.

Divide decimal or small number

$
0
0
Please help
I'm using vb6.0
Here i cant divide any decimal number by complete number
Like 0.45/72 or
Like 3 devide 234
Viewing all 21813 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>