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

UniTextBox control

$
0
0
Original title: [RESOLVED] Tips on making VB6 program DEP compatible?

So I made some now big project and gave it for testing to the people, and they suddenly report that the program immediately crashes when they try to run it. First I didn't know about Data Execution Prevention until I searched on the Internet about that crash (I typed into Google "BEX error"). I found a solution - either the DEP has to be completely disabled or the program has to be put on its exclude list, but of course that wasn't so elegant and therefore I'm focused these days on solving that problem, without having to do such things and causing one more struggle to the users.
I've recently found that editbin.exe /NXCOMPAT:NO should help, but unfortunately it haven't in my case. Are there any other possible solutions to this problem?

VB6 - Speed Types and 32/64 bits architectures

$
0
0
I have a question about speed and Types.

(Talking about CPU intensive computation)

For sure, in a 32bits system, to use LONGs (32Bits) instead of INTEGERs (16Bits) is faster.
and I see that also using SINGLEs (32bits) instead of DOUBLEs (64Bits) is faster in a 32Bit System.

If I create a 32Bits Executable and run it on a 64Bits system, will it be faster if I use SINGLEs or DOUBLEs ?

Displaying vbmodal forms right away?

$
0
0
Hey all,

I have an app where I want the form to be shown using vbmodal, but want it displayed in front right away so it can show data on the form, rather than when the FormLoad event is finished. Is there a way to do this? Various methods i've tried just give me 400 or 364 errors.

Executing .exe in VB 6.0 with input and output files

$
0
0
Iam new to VB6. Please help me out.

I have to run one program.exe file(fortran program) using VB. this program requires inputs stored in in.txt file and the output of the program need to be stored in out1.txt and out2.txt.

I used shell command to run program.exe file but it is not taking inputs from file and not giving outputs.

please help me.

Thanks in advance.

Mouse Hook

$
0
0
Another project and I'm already cringing at its use of Mouse hooks. Its one of those projects where the programmer was not aware of VB's ability to create and support the use of comment lines.

We are way past spaghetti code here and I am absolutely amazed as to how this person could follow there own code. It's just line after line of un-formatted code, with more goto statements then conditional statements, jumping up and down, and just all over the place.

I have yet to discover why they even decided to hook the mouse in the first place, hopefully I can yank it all out. But until that happens, there is a problem with the mouse being hooked and when the program shells to an separate external program.

The best description is that while the shelled program is active, the mouse appears to be drunk! The mouse pointer stumbles, jumps, stalls and generally lags behind. With careful movements the mouse is still functional but just barely. Commenting out the hook statement:


Code:

"SetWindowsHookEx(WH_MOUSE_LL, AddressOf Mcallback, App.hInstance, App.ThreadID)"

And the mouse behaves normally during a shell operation.

To me the best solution is to just scrap the mouse hook all together but its a bit too soon as I don't completely understand whats going on.

Any thoughts? Is this just a complete no don't do, hooks while using shell, or is there something else I am missing here.

Thanks.

I have a problem scrolling in the client area of the msflexgrid

$
0
0
I ‘ve got a program from this forum as below.

Quote:

Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As POINTAPI) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type

Private Sub DrawPoint(fromX, fromY, toX, toY)
Dim hDC_Grid As Long
Dim PT As POINTAPI

hDC_Grid = GetDC(MSFlexGrid1.hwnd)
MoveToEx hDC_Grid, fromX, fromY, PT
LineTo hDC_Grid, toX, toY
End Sub

Private Sub Command1_Click()
'Draw a line from (5,5) to (100,100)
DrawPoint 5, 5, 100, 100
End Sub

After running, when I was scrolling up/down left/right, the line disappeared.
How to preserve the line still exists?

Thanks in advance.

VB6 under WIN7

$
0
0
Hi all


Will VB6 IDE work well under WIN7 os ?

If yes, will the enduserapp.exe that was developed by that VB6 under win7 os work well
under win7/8/10 os ?


Thanks in advance
Elico

Embedde SQL Demistyfied

$
0
0
Hi all

I need to understand fully the meaning of "Embedded SQL server " .

If I use at design time a sql server like Sqlite that is called embedded sql server , does it mean that the enduserapp.exe
will run at the user pc as is, wilthout any need to install on it any sql server ?

Thanks in advance

Elico

In memory database

$
0
0
What that means ?

Does it mean that the enduserapp.exe will not need any SQL engine deployed on the user pc ?

Thanks
Elico

SIMPLE DATABASE APPS W/O SQL engine/server

$
0
0
Hi

I need to build simple database apps like coin collectors database
or stamp collectors database . it is a one table database in nature no relational tables at all .

Do I have to include any SQL egine like Sqlite , or VB6 has what it takes in it ?

Thanks
Elico

Check if DTPicker1 time value is incresed by 5 minutes from the current time

$
0
0
I have a time picker that sets reminders it opens to the current time. I want to make sure the time is increased by 5 minutes when the OK button is clicked
if DTPicker1.value < 5 minutes from now
msgbox "you must increase the time by at least 5 minutes"
Exit Sub
end if
it opens like this:


DTPicker1.CustomFormat = "hh:mm tt"
DTPicker1.Format = dtpCustom
DTPicker1.Value = Now
DTPicker1.Format = 2
it shows the time as AM/PM

have tried this

If DateDiff("n", Time, DTPicker1.Value) < 5 Then
MsgBox "You must increase the time by at least 5 minutes."
End If

and this:
Dim date1 As Date
date1 = CDate(DTPicker1.Value)
If DateDiff("n", date1, Now) < 5 Then
MsgBox ("You must increase the time by at least 5 minutes.")
End If

they do not work

how can this be written ?
Name:  choose time.jpg
Views: 21
Size:  15.6 KB
Attached Images
 

call a sub in a class from another class/Designer (IRibbonExtensibility)

$
0
0
Hi

I´ve implemented a class Designer (DSR) with the IRibbonExtensibility in my Excel Activecex dll. So far so (more or less) good...
The problem is that i can only call (in the ribbon) procedures that are inside the ribbon class/Designer.

How can i can i call procedures in another class or even in a module?

Thanks a lot... and sorry for the newbi questions...

Jorge

[RESOLVED] Check if DTPicker1 time value is incresed by 5 minutes from the current time

$
0
0
I have a time picker that sets reminders it opens to the current time. I want to make sure the time is increased by 5 minutes when the OK button is clicked
if DTPicker1.value < 5 minutes from now
msgbox "you must increase the time by at least 5 minutes"
Exit Sub
end if
it opens like this:


DTPicker1.CustomFormat = "hh:mm tt"
DTPicker1.Format = dtpCustom
DTPicker1.Value = Now
DTPicker1.Format = 2
it shows the time as AM/PM

have tried this

If DateDiff("n", Time, DTPicker1.Value) < 5 Then
MsgBox "You must increase the time by at least 5 minutes."
End If

and this:
Dim date1 As Date
date1 = CDate(DTPicker1.Value)
If DateDiff("n", date1, Now) < 5 Then
MsgBox ("You must increase the time by at least 5 minutes.")
End If

they do not work

how can this be written ?
Name:  choose time.jpg
Views: 49
Size:  15.6 KB
Attached Images
 

Saving CF_DIBV5 to a file

$
0
0
So now that I've got drawing it to an hDC down, I'm trying to save it to a bmp file. The output is nearly identical to the reference copy (original bmp source file that was opened and copied), so I'm close, but it's just not producing a valid file:

Code:

        Dim tBIH5 As BITMAPV5HEADER
        Dim tHdr As BITMAPFILEHEADER
        Dim nGlb As Long
        nGlb = GlobalSize(tSTG.Data)
        lpGlobal = GlobalLock(tSTG.Data)
        CopyMemory tBIH5, ByVal lpGlobal, LenB(tBIH5)
        lRead = tBIH5.bV5Size              ' determine where pixel data starts
        If tBIH5.bV5Compression = 3& Then lRead = lRead + 12&  ' BI_BITFIELDS
        If tBIH5.bV5ClrUsed Then
            lRead = lRead + 4& * tBIH5.bV5ClrUsed
        ElseIf tBIH5.bV5BitCount <= 8& Then
            lRead = lRead + 4& * 2 ^ tBIH5.bV5BitCount
        End If
        tHdr.bfType = &H4D42 'BM
        tHdr.bfOffBits = LenB(tHdr) + lRead
        tHdr.bfSize = LenB(tHdr) + nGlb
        Dim aDat5() As Byte
        ReDim aDat5(nGlb - 1)
        CopyMemory aDat5(0), ByVal lpGlobal, nGlb
        Dim hFile As Long
        hFile = FreeFile()
        Open "C:\temp2\dib5test2.bmp" For Binary As #hFile
            Put #hFile, , tHdr
            Put #hFile, , aDat5
        Close #hFile

From my understanding, the lpGlobal data pointed to by tSTG.hGlobal (.data) is the BITMAPV5HEADER followed by the pixel data. The function continues to draw to an hDC successfully with:
Code:

        SetDIBitsToDevice mImgDC, mImgX, mImgY, tBIH5.bV5Width, Abs(tBIH5.bV5Height), _
            0, 0, 0, Abs(tBIH5.bV5Height), ByVal lpGlobal + lRead, ByVal lpGlobal, 0 'DIB_RGB_COLORS
        RedrawWindow mImgHWND, 0, 0, RDW_UPDATENOW Or RDW_INVALIDATE Or RDW_ERASE Or RDW_ALLCHILDREN
        UpdateWindow mImgHWND

So lpGlobal + lRead is giving the correct starting position for pixel data.
It seems the only difference in output compared to the reference is a few bytes in the headers.
Here's the type declares I'm using for reference;
Code:

Private Type BITMAPFILEHEADER
    bfType As Long
    bfSize As Long
    bfReserved1 As Long
    bfReserved2 As Long
    bfOffBits As Long
End Type
Private Type BITMAPV5HEADER
    bV5Size As Long
    bV5Width As Long
    bV5Height As Long
    bV5Planes As Integer
    bV5BitCount As Integer
    bV5Compression As Long
    bV5SizeImage As Long
    bV5XPelsPerMeter As Long
    bV5YPelsPerMeter As Long
    bV5ClrUsed As Long
    bV5ClrImportant As Long
    bV5RedMask As Long
    bV5GreenMask As Long
    bV5BlueMask As Long
    bV5AlphaMask As Long
    bV5CSType As Long
    bV5EndpointsRedX As Long
    bV5EndpointsRedY As Long
    bV5EndpointsRedZ As Long
    bV5EndpointsGreenX As Long
    bV5EndpointsGreenY As Long
    bV5EndpointsGreenZ As Long
    bV5EndpointsBlueX As Long
    bV5EndpointsBlueY As Long
    bV5EndpointsBlueZ As Long
    bV5GammaRed As Long
    bV5GammaGreen As Long
    bV5GammaBlue As Long
    bV5Intent As Long
    bV5ProfileData As Long
    bV5ProfileSize As Long
    bV5Reserved As Long
End Type

(the tSTG.data is obtained using an IDataObject from a drop, or OleGetClipboard and the standard CF_DIBV5 GetData call)

Edit: As an alternative, can GDI+ load an image from the data stream of a CF_DIBV5 IStream like with PNGs? Saving PNGs was much easier as I could just pass data to GdipLoadImageFromStream and use the standard saving methods. It can't do it as-is; CreateStreamOnHGlobal creates an IStream object, but GDI+ fails to create an hImage from it. Would not including the header in the stream work; and if so how could I go about it? With PNGs it just goes like this:
Code:

                hGlobal = tSTG.Data
                lpGlobal = GlobalLock(hGlobal)
                Call CreateStreamOnHGlobal(hGlobal, 1, pIStrm)
                GdipLoadImageFromStream pIStrm, hImage

How to make array of winHttp?

$
0
0
Sir,
I need to make array connection of WinHttp vb6, But I cant. Kindly help me

Read Data Format With VB6

$
0
0
Hay guys i have problem with reading binary file in vb6
Im want to read the file with following structure data like this

Byte Content Format
Position

1-4 Length I*4
5-12 Satname C*8
13-17 lat R*4


Can you help me please to read this format in vb6?

Updating Access DB at the same time as ADO Datagrid

$
0
0
Hi
I have a datagrid connected to a access DB when I add/edit/delete a record
I want both to update at the same time without reloading the data
should I use UpdateBatch,Append or Validate() or some other way
I cannot seem to find an example that suits my needs
can you help please

put value from string to labels

$
0
0
I have this string:

MyString="('AAA','BBB','CCC')"

and a varous labels in userform similar:
label1, label2, label3, .... labelx

how to put in the related label the signle value from MyString?

for example:

label1="AAA"
label2="BBB"
label3="CCC"

note:
MyString is dinamic and can have from one to N items

Excel (vb6 dll) formula Parameters Help & description

$
0
0
Hi.

i need to know, i can i make a formula helper for each parameter.
I need a help for each parameter like any other Excel formula as.
This is crucial because the parameters are complicated and really have to be explained.

Thanks (Again)
Jorge

winsock multiple SendData

$
0
0
Ordinarily you do below to send one string data

Dim txt As String
txt = Text1.Text
Winsock1.SendData txt

But if I send it twice like below, I get runtime error 40006

Dim txt As String
Dim txt2 As String
txt = Text1.Text
txt2 = Text2.Text
Winsock1.SendData txt
Winsock1.SendData txt2

So my question is, how can I send two data on one sending? Not append txt and txt2 and like
winsock1.senddata txt & " " & txt2.
Viewing all 21227 articles
Browse latest View live