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

PNG-Channel-Splitting+Editing via Cairo-Classes

$
0
0
Just a demonstration how to use the Cairo-COM-Wrapper-Classes as an alternative to GDI+,
(in the recently discussed context of PNG-Loading + ChannelSplitting + separate Editing + Recombining + Saving).



As the Screenshot shows, the Demo is a "complete little Editor-App", consisting of only 3 Modules:
- fMain.frm
- modMain.bas
- ucProcessing.ctl
with in total little more than 100 lines of code: PNGEditor.zip

I hope it gives some ideas, how such an App can be efficiently structured,
and how a Class-wrapped graphics-API can ease things significantly (implementation-wise).

Olaf
Attached Files

How to make Microsoft XMl v3 DOMDocument indent saved file using spaces?

$
0
0
I made a project that can edit XML files using Microsoft XMl v3 DOMDocument (msxml3.dll), everything works perfect except one thing i want to fix, by default DOMDocument indent saved file using Tabs but i really want to indent using spaces instead. Is this possible? How?

Code bookmark add-in?

$
0
0
I've been searching for an add-in that allows me to bookmark code in projects and name those bookmarks. I've been Googling and searching vbforums, but I'm having a heck of a time finding one

I envision bookmarks in a dockable window so I can have them on the right, where I can get to any bookmark by just clicking on it in a list. It would also be great to rename those bookmarks as needed. In my dreams they'd even have at least one level of hierarchy (folder) so there could be different bookmark categories. It sure would save people a lot of time navigating code on larger projects.

Surely someone has made such a marvel over the years. Does such a thing exist?

GDI+ Combine RGBA channels

$
0
0
Okay, I can easily split RGBA channels of a Gdip hImage by creatively using the ColorMatrix. Easy peasy to get four new images with their corresponding hImage.

However, after I make various changes to these, what's the best way to put them back together? For simplicity, let's say we've got four hImage gdip handles. The first only has values in Red, the second in Green, the third in Blue, and the fourth only has an Alpha layer (all else zero).

I can certainly do it by fetching the RgbaQuad arrays. However, I'm doing my best to stop thinking about those things. Is there just some creativity with GdipDrawImageRectRectI that I'm not fully understanding?

Many Thanks,
Elroy

How to import txt file to datagrid and import from datagrid to table database?

$
0
0
Im stuck with my work for import an txt file to the datagrid so I can add it into database table, what can I do is reverse it from datagrid export to txt file such code like this
Code:

Dim FileName As String
FileName = txtDrive.Text
Open FileName For Output As #1
    Do While rsDTS.EOF = False
        Print #1, rsDTS.Fields("KDDTS").Value & "|" & rsDTS.Fields("KDHDTS").Value & "|" & rsDTS.Fields("TGLWORK").Value & "|" & rsDTS.Fields("KDKRY").Value & "|" & rsDTS.Fields("KDTOW").Value & "|" & rsDTS.Fields("KDSTOW").Value & "|" & rsDTS.Fields("HSTOW").Value & "|" & rsDTS.Fields("REMARK").Value
        rsDTS.MoveNext
    Loop
Close #1
MsgBox "Done!Exported to", vbInformation + vbOKOnly, "Information"

now I wondering how can I import txt file to the datagrid and after that add it into database table line per line with the delimiter "|"? anyone can help? since vb6.0 doesnt have StreamReader

Type Mismatch when trying to save data from MSFlexGrid to Database (*.fdb) table

$
0
0
I want to save data from txt file that I display to MSFlexGrid, so far this is my code to save it
Code:

Dim i As Integer
Call Buka
rsDTS.Open "Select * from TBL_DTSHEET ", koneksi, adOpenStatic, adLockOptimistic
Do While Not rsDTS.EOF
    rsDTS.AddNew
    For i = 0 To MSFlexGrid1.Rows - 1
        rsDTS!KDDTS = MSFlexGrid1.TextMatrix(i, 1)
        rsDTS!KDHDTS = MSFlexGrid1.TextMatrix(i, 2)
        rsDTS!TGLWORK = Format(MSFlexGrid1.TextMatrix(i, 3), "mm/dd/yyyy")
        rsDTS!KDKRY = MSFlexGrid1.TextMatrix(i, 4)
        rsDTS!KDTOW = MSFlexGrid1.TextMatrix(i, 5)
        rsDTS!KDSTOW = MSFlexGrid1.TextMatrix(i, 6)
        rsDTS!HSTOW = MSFlexGrid1.TextMatrix(i, 7)
        rsDTS!REMARK = MSFlexGrid1.TextMatrix(i, 8)
        rsDTS.update
        rsDTS.MoveNext
        Next
        Loop
rsDTS.Close
MsgBox "Done!", vbInformation + vbOKOnly, "Information"

but I have an error in type mismatch at fields
Code:

rsDTS!TGLWORK = Format(MSFlexGrid1.TextMatrix(i, 3), "mm/dd/yyyy")
and at
Code:

rsDTS!HSTOW = MSFlexGrid1.TextMatrix(i, 7)
the type of TGLWORK is date and HSTOW is decimal like this picture
Name:  table1.jpg
Views: 48
Size:  17.9 KB
and my msFlexGrid display like this Name:  tbl2.jpg
Views: 29
Size:  19.3 KB and field at the table like this Name:  tbl3.jpg
Views: 23
Size:  8.8 KB
can anyone help me, is there any mistake at that code above?
Attached Images
   

MSCAL.OCX does not want to register even with run as administrator

$
0
0
Most of the threads have been on installing MSCAL.OCX on their development computers. This thread is about installing on customer machines with Windows 10.

I am using Installshield Express 10.

When the application installs on customer machine and they run the installer as administrator, they get "can not load, one of the components is missing" error message (actual message in image below). I have to go into their computer and go to elevated command prompt and run the regsvr32 command on the control and then all is well. Seems to install the other OCX controls without error even when not running the installer as not the administrator. The installer copies the OCX files all to the SysWOW64 directory.

My Installshield is a bit out of date admittedly (it does not have a specific entry for a manifest that forces the installer to run as administrator) but I notice those with newer versions have complained of same problem.

Any ideas would be appreciated.

Name:  MSCAL install error.jpg
Views: 4
Size:  34.7 KB
Attached Images
 

[RESOLVED] GDI+ Combine RGBA channels

$
0
0
Okay, I can easily split RGBA channels of a Gdip hImage by creatively using the ColorMatrix. Easy peasy to get four new images with their corresponding hImage.

However, after I make various changes to these, what's the best way to put them back together? For simplicity, let's say we've got four hImage gdip handles. The first only has values in Red, the second in Green, the third in Blue, and the fourth only has an Alpha layer (all else zero).

I can certainly do it by fetching the RgbaQuad arrays. However, I'm doing my best to stop thinking about those things. Is there just some creativity with GdipDrawImageRectRectI that I'm not fully understanding?

Many Thanks,
Elroy

New install RTE 339 Comdlg32.ocx a file missing or invalid, been stuck on this

$
0
0
a long time. VB6 SP6 the app works great across XP to 10. It's the installer I'm hung on, or more importantly what I'm not installing. I have an old Install Shield installer that will install everything correctly. And after that my new installs (NSIS) work 100%, even if you uninstall the original. I have put together list after list of dll's, ocx's it may be missing, various ways of supplying the VB runtime files, used resource monitors, total uninstallers and recently setup and built the exe on the target platform (win 7) to see if this error would finally go away. If anyone has any idea of what else to try I would appreciate it. The ding - crash when it's run after the 4743rd install attempt has gotten painfully old.

Typelibs References and Discussion

$
0
0
I would like to have a thread where we can discuss Typelibs, what is good and bad, reviews and where to get them/download.
I found one using google:
http://www.xbeat.net/vbspeed/i_VBVM6Lib.html
Is this one good or are there any better out there to use GetMem/PutMem?

Are Typelibs "always" better to use then API you add on your own, or could there be Typelibs that actually make it slower? if so why?
Im also looking for a GDI32 Typelib, are there any? and what about GDI+, googled around and the few I found the download links are expired.

Textbox connected to SQL Server database does not update when the value is changed

$
0
0
Hi,

I have a textbox connected to a database in SQL Server 2014 using the following code:
Code:

Set frmMain.TxtCustomer.DataSource = CurJobRecord
frmMain.TxtCustomer.DataField = "Customer"

If the user changes the text in TxtCustomer and then the user presses a command button which runs a CurJobRecord.update command, the value in the database is updated fine. However when the value in TxtCustomer is updated from code and the recordset is updated from code, the value fails to update in the database.
Code:

TxtCustomer.Text = "Test"
CurJobRecord.Update

This is the code which originally opens the CurJobRecord Recordset
Code:

Set TempRS = New ADODB.Recordset

    TempRS.Open SQL, ConJobData, adOpenDynamic, adLockOptimistic
    If TempRS.EOF = False Then
        If CurJobRecord.State = adStateOpen Then
            CurJobRecord.Update
            CurJobRecord.Close
        End If
   
        Set CurJobRecord = TempRS

If anybody has any solutions as to why this is happening it would be appreciated.

Thanks for your time,

Hustey

How to keep last used printer as a default printer

$
0
0
I want want to keep last used printer?
For example, current default printer is Printer A.
I printed through printer B.
When I print another one, it is printed through Printer A.
I want to keep last used printer as a default printer.
How do I do this?

GdipSetImageAttributesGamma and GdipSetImageAttributesColorMatrix (GDI+ stuff)

$
0
0
Hmmm, okay, can I not use those two together? (GdipSetImageAttributesGamma and GdipSetImageAttributesColorMatrix)

Basically, I call GdipSetImageAttributesGamma, and then GdipSetImageAttributesColorMatrix (with a constructed matrix), and then GdipDrawImageRectRectI (with GdipGetImageGraphicsContext/GdipDeleteGraphics).

I can get both GdipSetImageAttributesGamma and GdipSetImageAttributesColorMatrix to work but not together.

And also, I've changed the order, and GdipSetImageAttributesGamma always overrides. In other words, if I use GdipSetImageAttributesGamma, then my ColorMatrix seems to disappear from the Attributes.

I can make this work by doing it this way:
GdipSetImageAttributesGamma -> render(GdipDrawImageRectRectI) -> GdipResetImageAttributes -> build my ColorMatrix -> GdipSetImageAttributesColorMatrix -> render(GdipDrawImageRectRectI)

However, I was hoping for this:
GdipSetImageAttributesGamma -> build my ColorMatrix -> GdipSetImageAttributesColorMatrix -> render(GdipDrawImageRectRectI)

Am I just overlooking something fundamental?

I'd post code but it's a bit involved. I will if someone thinks I'm mis-understanding something.

Thanks,
Elroy

Adding 2 columns to ComboBox in Form from table

$
0
0
Hey guys. Firstly I am beginner, so dont kill me :D

I have a problem. I have to make 2 column ComboBox in Form. Added data must be from table in sheet, BUT dont know the number of lines, so firstly I have to do that (as u can see in code- that is X)
Table looks like this
Name:  ppp.png
Views: 17
Size:  8.5 KB

Then I tried 2 ways how to add that 2 columns with X lines to ComboBox in Form. This is code:

Code:

Private Sub UserForm_Initialize()
 Dim x As Byte
 Dim riadok As Byte
 
 
  x = 1
  While Range("ODBERATELE!B" & x) <> ""
    x = x + 1
  Wend
  MsgBox x
 
 


'''''''''''''''''1.WAY - Error 381 :(
 
For riadok = 2 To x

 With UserForm1.ComboBox1
        .List = Sheets("ODBERATELE").Range("A" & riadok & ":" & "B" & riadok).Value
        .ColumnCount = 2
        .ColumnWidths = "50;50"
 End With
 
Next riadok



'''''''''''''''''''''''''''''''2.way I have tried has problem with X
Dim adresy(1 To x, 1 To x) As String

Me.ComboBox1.ColumnCount = 2

For riadok = 2 To x
  adresy(riadok, 1) = Sheets("ODBERATELE").Range("A" & riadok)
  adresy(riadok, 2) = Sheets("ODBERATELE").Range("B" & riadok)
Next riadok

Me.ComboBox1.List = adresy
 
End Sub

Any idea what Im doing wrong, please? :)
Attached Images
 

[RESOLVED] GdipSetImageAttributesGamma and GdipSetImageAttributesColorMatrix (GDI+ stuff)

$
0
0
Hmmm, okay, can I not use those two together? (GdipSetImageAttributesGamma and GdipSetImageAttributesColorMatrix)

Basically, I call GdipSetImageAttributesGamma, and then GdipSetImageAttributesColorMatrix (with a constructed matrix), and then GdipDrawImageRectRectI (with GdipGetImageGraphicsContext/GdipDeleteGraphics).

I can get both GdipSetImageAttributesGamma and GdipSetImageAttributesColorMatrix to work but not together.

And also, I've changed the order, and GdipSetImageAttributesGamma always overrides. In other words, if I use GdipSetImageAttributesGamma, then my ColorMatrix seems to disappear from the Attributes.

I can make this work by doing it this way:
GdipSetImageAttributesGamma -> render(GdipDrawImageRectRectI) -> GdipResetImageAttributes -> build my ColorMatrix -> GdipSetImageAttributesColorMatrix -> render(GdipDrawImageRectRectI)

However, I was hoping for this:
GdipSetImageAttributesGamma -> build my ColorMatrix -> GdipSetImageAttributesColorMatrix -> render(GdipDrawImageRectRectI)

Am I just overlooking something fundamental?

I'd post code but it's a bit involved. I will if someone thinks I'm mis-understanding something.

Thanks,
Elroy

Compiling and creating an .EXE after modifying .frm asking for MSDN

$
0
0
Hi all,

A friend uses a little VB6.0 system and asked to change a couple of text on some of the paper he prints out of the system. I'm not too familiar with VB but I was able to find the form and modify the text he wanted to have modified. However when I go and click in "Make Project.exe" from the "File" options I receive"
" Denied authorization C:/Program Files/PROJECT/Project.exe" then I click on the "?" quesiton mark symbol and it says: "MSDN doesn't exist. Reinstall MSDN"
He doesn't have any MSDN disc anymore, is there a way I can compile and create the exe without MSDN? how can I make he run the application with the new modifications?

Thank you

[RESOLVED] Does InkEdit control support SelPrint?

$
0
0
I changed a RichTextBox to an InkEdit control to support non-latin characters. At first I thought the print problem was with Win 10, but when I tested it on Win 8.1, the same problem showed up. I now suspect the problem is with SelPrint. When used with a Textbox, it will not compile. But when used with the InkEdit control, it compiles but errors out.

J.A. Coutts

Compiling vb6 projet

$
0
0
Hi guys l am a new member here and hope to find someone that can help me !

l have an application which is made by Visual basic 6 "VB6" . the application is already installed and l don't have the exe installer

l tried to decompile it and get the source code and make some modification such as disabeling some fonctions , now all what l want is to compile the project with the recent modification l tried to make it with vb6 but l could not ! can anyone compile to project please and give me the exe installer ! l will really appreciate the help !

link to download the vb6 project :

https://www.sendspace.com/file/ocg75q

Is it possible to pass textbox content to Data Report Label.

$
0
0
Hello experts
I tried to pass the content of a textbox to Data Report Label but I get: Invalid Data source.
Code:

DataReport1.Sections("Section1").Controls("Label1").Caption = Text1.Text
Thank you all

SelfCallback (Caton/LaVolpe); identical set-up works in one UC but not other

$
0
0
So I'm trying to use the ssc_SetCallbackAddr from the 2.0 LaVolpe re-write of the selfsubclass routines in a UserControl, and it works fine in the project I based it on, works fine in a basic, empty project, but then fails with a 'Callback address not found' error in my full project. I tried disabling all the other subclassing in case that interfered, but no help. What could cause it to fail like this?

Code:

Public Function testcb() As Long
 m_cbSort = scb_SetCallbackAddr(3, 2)
testcb = m_cbSort
End Function
Public Function LVSortProc(lParam1 As Long, lParam2 As Long, lParamSort As Long) As Long
Dim hr As Long

        LVSortProc = -1 

End Function
Public Function somefunction(szSys As String) As Long

End Function

that's the end of the UserControl in both cases, and both have the full standard self-subclass/self-callback code, with no other parts of it being used. I put the UC where it was working into the main project, and it still works there, but not in the other UC.

Edit: Attaching the project... it's for my shell browser control; I added the UC where it's working to the standard current release, with the same setup to test. I don't know how to simplify it more. The Demo project loads both controls and the command button has debug output that can switch between them.
Attached Files
Viewing all 21702 articles
Browse latest View live


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