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

LIST DAYS based month and year

$
0
0
How to list the days of month based year?

for xample:

VarYear=2020
VarMonth =12 (December)

Arrange the numbers

$
0
0
Hello,

How can i Arrange the numbers in the database

Because it come like this in database


So can i Array Sorting or no

26
27
28
29
30
31
32
33
34
35
36
37
39
40
41
42
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Waiting for your response, please

[RESOLVED] Huffman String Conversion

$
0
0
What I am trying to do is use hoffman and not go straight to file because it must be obfuscated.

Could anyone possibly help my on my quest to determine how to do it?

First the hoffman compression must be converted to ascii for string
Second to decompress an ascii hoffman string back to ?? bytes, hex, binary

ThanksHuffmanExample.zip
Attached Files

Driving me crazy for years click menu in 3rd party app. event fires in 'our' app. ???

$
0
0
G'Day Guys

This has been driving me crazy off and on for years :(

I know how to add a menu option into M$s notepad as an example, BTDT :)

I have been looking at code like this for more than a decade

https://stackoverflow.com/questions/...er-application

All good

What I want to do is add a menu option to NotePad and then have the click event call a routine in my code, even if it is not VB6, so C or even assembler.

How can I have a click event in a 3rd party app. fire in my app. ?

Tryed searching for

vb6 click menu option in 3rd party

etc.

etc.

etc.

etc.

No joy, any gurus even worked out how to do this ???

TIA

JG

[RESOLVED] LIST DAYS based month and year

$
0
0
How to list the days of month based year?

for xample:

VarYear=2020
VarMonth =12 (December)

LISTVIEW and scrollbar left to right...

$
0
0
Ppossible to fix (lock) the first 2 column in listview and scroll only the column from 3h column?

listview and header column name

$
0
0
possible to have a header column name in vertical?

similar: AAAA

To:

A
A
A
A

How to find out if a form is 'on-top'?

$
0
0
Google returns countless articles/examples of how to set a form topmost or not_topmost using the SetWindowPos API. But, how do I determine if a Window has been set topmost? TIA. Bob.

VB6: where is SQRT() and ceiling() functions?

$
0
0
the Visual Basic 6 don't have the Sqrt() and Ceiling() functions?
the Sqr() isn't Sqrt(), right?

[RESOLVED] Rotate Text Using GDI+

$
0
0
Hello,

A while back dilettante and Schmidt helped me with precise positioning of text on a baseline.
http://www.vbforums.com/showthread.p...ing&highlight=

The text is positioned on a marker , and can be left, center, or right aligned.

Now I have a need to rotate this text, and I would like to rotate about a center point ,
and send this point to the DrawTextRotated function.

Any help would be appreciated.

Code:

Option Explicit


Dim gdiplusToken As Long


Private Enum TextJustify
    JustifyCenter
    JustifyLeft
    JustifyRight
End Enum


Dim stat As Long


Private Sub Form_Load()

    Form1.Caption = "GDI+"
    Form1.Width = Screen.TwipsPerPixelX * 600
    Form1.Height = Screen.TwipsPerPixelY * 465
    Form1.BackColor = &H8000000F
    Form1.ScaleMode = vbPixels
   
    Command1.Width = Form1.ScaleWidth
    Command1.Height = 25
    Command1.Left = 0
    Command1.Top = Form1.ScaleHeight - Command1.Height
    Command1.Caption = "execute"
    Command1.ZOrder (0)
   
    Picture1.Appearance = 0
    Picture1.Left = 20
    Picture1.Top = 20
    Picture1.Height = 366
    Picture1.Width = 552
    Picture1.AutoRedraw = True
   
    ' Initialize Windows GDI+
    Dim GdiplusStartupInput As GdiplusStartupInput
    GdiplusStartupInput.GdiplusVersion = 1
    GdiplusStartupInput.DebugEventCallback = 0
    GdiplusStartupInput.SuppressBackgroundThread = False
    GdiplusStartupInput.SuppressExternalCodecs = False
    Dim status As GpStatus
    status = GdiplusStartup(gdiplusToken, GdiplusStartupInput, 0)
    If status <> Ok Then
        MsgBox "Error loading GDI+!", vbCritical
        Call GdiplusShutdown(gdiplusToken)
    End If

End Sub


Private Sub Form_Unload(Cancel As Integer)
   
    ' Clean up resources used by Windows GDI+
    Call GdiplusShutdown(gdiplusToken)
   
End Sub


Private Sub Command1_Click()

    Call GdipSample
   
End Sub


Private Sub GdipSample()

    Picture1.Cls
   
    Dim stat As Long

    ' Create Graphics object
    Dim graphics As Long
    stat = GdipCreateFromHDC(Picture1.hdc, graphics)

    Dim fontFamily As Long
    stat = GdipCreateFontFamilyFromName(StrPtr("Times New Roman"), 0, fontFamily)

   
    stat = GdipSetTextRenderingHint(graphics, TextRenderingHintAntiAlias)
   
   
   
   
    Call DrawTextRotated(graphics, _
                        "Whirligig", _
                        275, 195, _
                        JustifyCenter, _
                        fontFamily, FontStyleRegular, 96, _
                        45)
   
   


    ' Cleanup
    stat = GdipDeleteFontFamily(fontFamily)
    stat = GdipDeleteGraphics(graphics)
   
    Picture1.Refresh
   
End Sub


Private Sub DrawTextRotated(G As Long, _
                            text As String, _
                            x As Single, y As Single, _
                            justify As TextJustify, _
                            fontFamily As Long, FontStyle As FontStyle, fontSize As Single, _
                            rotationAngle As Single)

    '-------------------------------------------------------------------------------------------
    ' Get some font metrics
   
    Dim fontEmSize As Single
    fontEmSize = fontSize

    Dim EmHeight As Integer
    stat = GdipGetEmHeight(fontFamily, FontStyle, EmHeight)

    Dim CellAscent As Integer
    stat = GdipGetCellAscent(fontFamily, FontStyle, CellAscent)

    Dim CellDescent As Integer
    stat = GdipGetCellDescent(fontFamily, FontStyle, CellDescent)

    Dim fontAscentInPixels As Single
    fontAscentInPixels = (fontEmSize * CellAscent / EmHeight)
   
    Dim fontDescentInPixels As Single
    fontDescentInPixels = (fontEmSize * CellDescent / EmHeight)
    '-------------------------------------------------------------------------------------------
   

    '-------------------------------------------------------------------------------------------
    ' Set text baseline

    Dim baselineX As Single
    Dim baselineY As Single
   
    baselineX = x
    baselineY = y
    baselineX = Int(baselineX)
    baselineY = Int(baselineY)
    '-------------------------------------------------------------------------------------------
   
   
    '-------------------------------------------------------------------------------------------
    ' Set the text layout rect

    Dim txtRect As RECTF
    txtRect.Right = 0                                              'width  (0 means no boundary)
    txtRect.Bottom = 0                                            'height (0 means no boundary)
    txtRect.Left = baselineX                                      'x
    txtRect.Top = baselineY - fontAscentInPixels                  'y
    '-------------------------------------------------------------------------------------------

   
    '-------------------------------------------------------------------------------------------
    ' Initialize GDI+ objects
   
    Dim redPen As Long
    stat = GdipCreatePen1(&HFFFF0000, 1, UnitPixel, redPen)

    Dim bluePen As Long
    stat = GdipCreatePen1(&HFF0000FF, 1, UnitPixel, bluePen)
   
    Dim blackBrush As Long
    stat = GdipCreateSolidFill(&HFF000000, blackBrush)
   
    Dim txtFont As Long
    stat = GdipCreateFont(fontFamily, fontEmSize, FontStyle, UnitPixel, txtFont)
   
    Dim txtStringFormat As Long
    stat = GdipStringFormatGetGenericTypographic(txtStringFormat)
    '-------------------------------------------------------------------------------------------
   

    '-------------------------------------------------------------------------------------------
    ' Adjust for Alignment

    Select Case justify
        Case JustifyCenter
            stat = GdipSetStringFormatAlign(txtStringFormat, StringAlignmentCenter)
        Case JustifyLeft
            stat = GdipSetStringFormatAlign(txtStringFormat, StringAlignmentNear)
        Case JustifyRight
            stat = GdipSetStringFormatAlign(txtStringFormat, StringAlignmentFar)
    End Select
    '-------------------------------------------------------------------------------------------
   
   
    '-------------------------------------------------------------------------------------------
    ' Draw Text

    stat = GdipDrawString(G, StrPtr(text), -1, txtFont, txtRect, txtStringFormat, blackBrush)
    '-------------------------------------------------------------------------------------------
   
   
    '-------------------------------------------------------------------------------------------
    ' Draw position marker for the text

    ' horz baseline
    stat = GdipDrawLine(G, redPen, _
                        baselineX - (fontSize / 2), baselineY, _
                        baselineX + (fontSize / 2), baselineY)
   
    ' vert alignment marker
    stat = GdipDrawLine(G, redPen, _
                        baselineX, baselineY, _
                        baselineX, baselineY - fontAscentInPixels + fontDescentInPixels)
    '-------------------------------------------------------------------------------------------

                           
    '-------------------------------------------------------------------------------------------
    ' Draw rotation point
   
    ' horz line
    stat = GdipDrawLine(G, bluePen, _
                        baselineX - 10, _
                        baselineY - ((baselineY - _
                            (baselineY - fontAscentInPixels + fontDescentInPixels)) / 2), _
                        baselineX + 10, _
                        baselineY - ((baselineY - _
                            (baselineY - fontAscentInPixels + fontDescentInPixels)) / 2))
    ' vert line
    stat = GdipDrawLine(G, bluePen, _
                        baselineX, _
                        baselineY - (((baselineY - _
                            (baselineY - fontAscentInPixels + fontDescentInPixels)) / 2) _
                                - 10), _
                        baselineX, _
                        baselineY - (((baselineY - _
                            (baselineY - fontAscentInPixels + fontDescentInPixels)) / 2) _
                                + 10))
    '-------------------------------------------------------------------------------------------
   
   
    '-------------------------------------------------------------------------------------------
    ' Clean-up GDI+ objects

    stat = GdipDeletePen(redPen)
    stat = GdipDeletePen(bluePen)
    stat = GdipDeleteBrush(blackBrush)
    stat = GdipDeleteFont(txtFont)
    stat = GdipDeleteStringFormat(txtStringFormat)
    '-------------------------------------------------------------------------------------------
 
End Sub

GdipGetFamilyName

$
0
0
Has anyone had success calling the GDI+ function GdipGetFamilyName ?

When I call it, I get a stat = 0 (OK), but the return string is empty.

Call:
Code:

Dim famName As String
stat = GdipGetFamilyName(fontFamily, famName, 0)

Declare:
Code:

Public Declare Function GdipGetFamilyName Lib "gdiplus" _
    (ByVal family As Long, ByVal name As String, ByVal language As Integer) As GpStatus

[RESOLVED] GdipGetFamilyName

$
0
0
Has anyone had success calling the GDI+ function GdipGetFamilyName ?

When I call it, I get a stat = 0 (OK), but the return string is empty.

Call:
Code:

Dim famName As String
stat = GdipGetFamilyName(fontFamily, famName, 0)

Declare:
Code:

Public Declare Function GdipGetFamilyName Lib "gdiplus" _
    (ByVal family As Long, ByVal name As String, ByVal language As Integer) As GpStatus

Webbrowser documenttext after invoking a submit button in the runtime

$
0
0
One Webbrowser1 control and one Textbox1 control is placed on a form.
In a sub, webbrowser1 navigates an url and shows its source in the textbox1.
In another sub, webbrowser1 navigates the same url, invoke a submit button in the webbrowser1, which append some controls and texts to the webbrowser1. Invoking does not change the url. After invoking the submit button, webbrowser1 is showing the added text correctly, but textbox1 does not updating the new source (after appending the new controls and texts). It shows the same old source.

private sub sub1name()

Webbrowser1.navigate(url)

//
do some work here
//

Textbox1.text = Webbrowser1.Documenttext

end sub




private sub sub2name()

Webbrowser1.navigate(url)

//
do some work here
//

WebBrowser1.Document.GetElementById("IDNAME").InvokeMember("click")
//this appends new control and text to the webbrowser1 by using javascript. Webbrowser1 displays the new added text correctly.

Textbox1.text = Webbrowser1.Documenttext
// Textbox1.text does not show the added controls and texts.
end sub

When True isnt True

$
0
0
Can someone smarter than me help me wrap my head around what is happening here? the expression (bBefore = True) is returning false even though the value of bBefore is true.

Name:  Image2.jpg
Views: 92
Size:  33.3 KB
Attached Images
 

Drawing an image, then copying it on screen many times for tile effect

$
0
0
Hello,

I am trying to draw an image and tile it across the screen, giving it the effect of drawing copies of itself.

I came across a sample on here

http://www.vbforums.com/showthread.p...eps-flickering

that shows how to stop flickering, and coincidentally also has an image that copies itself while it moves, looking like a tiled image.

How do I get an image (either an image or a picturebox, I don't care which), to achieve this result?

I have tried moving the picturebox to the left , ie

Code:

Timer1_timer
picturebox.left=picturebox.left+5
picturebox.autoredraw=true

trying to force it to draw itself again at every new
interval, but that doesn't do what I am trying to do.

Could anyone help please? Thank you.

VSFlexGrid2

$
0
0
Buenas tardes compañeros,
Estoy ejecutando un programa con el VSFlexGrid2 y me falta en la librería, estoy buscando por Mr. Google y no encuentro un enlace, no se si algunos de vosotros os habeis encontrado con este problema, serán agradecidos si me pueden aportar alguna información, saludos para tod@s.

the project menu is hidden

$
0
0
the project menu has disappeared and I don't know why ......Name:  IDE_VB6.jpg
Views: 4
Size:  31.5 KB
Attached Images
 

[RESOLVED] the project menu is hidden

$
0
0
the project menu has disappeared and I don't know why ......Name:  IDE_VB6.jpg
Views: 32
Size:  31.5 KB
Attached Images
 

Tipo de color de un pixel

$
0
0
Hola de que forma puedo determinar que tipo de color es un pixel.

Si ese color es mas rojo,verde,celeste, etc. entre los colores mas basicos y me muestre a cual color se aproxima mas.

Menu items clicking on them from another app

$
0
0
I have two apps, App1 and App2. App2 has one menu item with several submenu items and one Command button. I used Spy++ to look up App2 but all I see is the handle for the Command button but I do not see any handles for the menu items. I want to use App1 and click on one or the other submenu items on App2. How can I do that if possible
Viewing all 21402 articles
Browse latest View live


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