473,809 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extracting a int32 from a string (VB6)

Subject line says it all really.
I have a 4 character long string, that contains a 32bit integer. Problem is
i have no idea how i go about extracting it.

Any help will be appreciated.
Jul 17 '05 #1
2 3660
On Fri, 14 Nov 2003 12:39:07 -0000, "Sammy" <no@isp.com> wrote:
Subject line says it all really.
I have a 4 character long string, that contains a 32bit integer. Problem is
i have no idea how i go about extracting it.

Any help will be appreciated.


It may be 4 characters long, but due to the perversity of MS, it is 8
bytes
Private Declare Sub MoveString _
Lib "kernel32" _
Alias "RtlMoveMem ory" _
(Dest As Any, _
ByVal Source As String, _
ByVal Bytes As Long)
Public Function CVL(S$) As Long
If Len(S$) < 4 Then
MsgBox "CVL Error - String too Short"
Exit Function
End If
Call MoveString(CVL, S$, 4)
End Function

Jul 17 '05 #2
Perfect, thanks very much for the help.

Sammy.

"J French" <er*****@nowher e.com> wrote in message
news:3f******** ********@news.b tclick.com...
On Fri, 14 Nov 2003 12:39:07 -0000, "Sammy" <no@isp.com> wrote:
Subject line says it all really.
I have a 4 character long string, that contains a 32bit integer. Problem isi have no idea how i go about extracting it.

Any help will be appreciated.


It may be 4 characters long, but due to the perversity of MS, it is 8
bytes
Private Declare Sub MoveString _
Lib "kernel32" _
Alias "RtlMoveMem ory" _
(Dest As Any, _
ByVal Source As String, _
ByVal Bytes As Long)
Public Function CVL(S$) As Long
If Len(S$) < 4 Then
MsgBox "CVL Error - String too Short"
Exit Function
End If
Call MoveString(CVL, S$, 4)
End Function

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10650
by: cassandra.flowers | last post by:
Hi, I am using VB6 and want to extract text from a string. But ONLY take out words that begin with 't' or 'd'. The mainstring is input by the user into 'txtMain' and then by clicking a command button, all the words that begin with 't' or 'd' will be extracted and appear in a second text box, txtExtract. So, i know that I have to search through the main string for the character "d", then extract the following characters until it...
2
2820
by: Dickyb | last post by:
Extracting an Icon and Placing It On The Desktop (C# Language) I constructed a suite of programs in C++ several years ago that handle my financial portfolio, and now I have converted them to C#. The only significant problem that I have encountered in the conversion is this one - extracting an icon from the 'KTEntryPoint' program into the software suite and placing that icon on the PC Desktop.
1
4914
by: Hifni Shahzard | last post by:
Hi, I got a stored procedure, where it returns a value. But if I execute it. It gives an error as "Invalid cast from System.Int32 to System.Byte.". To make clear how do I execute this, below I'm specifiying my code: The Code used in Visual Studio: Function GetRank(ByVal ID As Integer, ByVal Comp As String, ByVal Sec As String, ByVal iDate As Date) As String 'Dim Ret As Integer
3
3640
by: Richard | last post by:
how can I extract an icon from a fil for example this sentence "F:\WINDOWS\System32\shell32.dll,3" how can I extract icon nr 3 from the shell32.dll?? I found some code for VB6 that might have worked in VB6, but it's been changed in VB.NET, it was some API-calls, and drawing on compononts using
0
1164
by: Ankit Aneja | last post by:
string comm="CONTSCAN E:\\projects backup\\ankitclam backup\\Clamtest\\testing\\hello.txt\r\n" int x=comm.Length; x=x-7; string path; path=comm.Substring(9,x); MessageBox.Show(path); it works fine and give path as E:\projects backup\ankitclam backup\Clamtest\testing\hello.txt
2
2779
by: ammmmmu | last post by:
Hi all, I need a code to extract the sub string from a string in VB6 EX I have a string str = "Post your QSquestion in a relevant forum" and I want to store the word which starts from QS in the above string ie I want to store QSquestion in other string.. How can I do this?
1
2604
by: northerntechie | last post by:
Ok, I don't normally post (I would rather rummage around in the thoughts and frustrations of others) but this one has got me stumped. I am using MS VB 2005 Express and I am using a COM object reference that will not allow me to read back an array of System.int32 through a byref parameter. In the older VB6 program I would simply declare a long (int32) array with no dimension and the COM object method would, by reference, pass back an...
6
3936
by: geegeegeegee | last post by:
Hi All, I have come across a difficult problem to do with extracting UniCode characters from RTF strings. A detailed description of my problem is below, if anyone could help, it would be much appreciated. I've tried to make the problem as clear as possible, but if any clarification is needed please let me know. Task -Convert RTF2 formatted text containing foreign characters (UniCode) to PlainText. Background -We are using Stephan...
2
1809
by: Per Juul Larsen | last post by:
hi. I do want to extract this string "abcdefg" from string "C:\dir1\dir2\abcdefg-12345gsd" Note : the length of the text string "abcdefg" may vary, but the last character is always "-". I need only the string "abcdefg" not "-12345gsd"
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10637
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10379
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.