-
May 31st, 2011, 03:57 AM
#1
Convert C to VB
Please help me,how can i convert this c++ code to vb.
LPSTR lpszComparison;
CHAR szzMethod[] = "1000\0" "2000\0" "3000\0";
pcnd.lpszComparison = szzMethod;
lpszComparison
Set a pointer to the buffer containing multiple null-terminated comparison strings. The last string in the buffer must be terminated by two NULL characters
please show me the convertion of this to VB 6.0
thank you
-
May 31st, 2011, 08:34 AM
#2
Re: Convert C to VB
Set a pointer to the buffer containing multiple null-terminated comparison strings. The last string in the buffer must be terminated by two NULL characters
as much as i know .there is no any concept of pointer in neither in vb nor in vb.net .it is very hard to convert c code in vb .better why don't you write code in vb.net .it is
much easier language then c ,c++.
Last edited by firoz.raj; May 31st, 2011 at 08:36 AM.
-
May 31st, 2011, 05:11 PM
#3
Re: Convert C to VB
Pretty hard, if you didn't write the DLL, isn't it?
-
June 1st, 2011, 01:22 AM
#4
Re: Convert C to VB
Code:
LPSTR lpszComparison;
Search CG for DLL Calling 'Declare Function XXX lib "YYY" (parameters)'
Code:
CHAR szzMethod[] = "1000\0" "2000\0" "3000\0";
hmm this should be something like
Code:
Dim szzMethod(2) as String
szzMethod(0) = "1000\0"
szzMethod(1) = "2000\0"
szzMethod(2) = "3000\0"
And finaly
Code:
pcnd.lpszComparison = szzMethod;
Look up Calling conventions...
there are different methods to call this.. one been
Code:
Output = lpszComparison (szzMethod())
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
June 1st, 2011, 06:42 AM
#5
Re: Convert C to VB
Originally Posted by GremlinSA
Code:
CHAR szzMethod[] = "1000\0" "2000\0" "3000\0";
hmm this should be something like
Code:
Dim szzMethod(2) as String
szzMethod(0) = "1000\0"
szzMethod(1) = "2000\0"
szzMethod(2) = "3000\0"
I'd say it's rather like
Code:
Dim szzMethod As String
szzMethod = "1000" & Chr(0) & "2000" & Chr(0) & "3000" & Chr(0)
However, of course this doesn't solve the OP's overall problem...
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
June 1st, 2011, 02:16 PM
#6
Re: Convert C to VB
Originally Posted by Eri523
I'd say it's rather like
Code:
Dim szzMethod As String
szzMethod = "1000" & Chr(0) & "2000" & Chr(0) & "3000" & Chr(0)
However, of course this doesn't solve the OP's overall problem...
Ahh okay ...
My C is rusty at best ... And looking at it again your correct.. Array of Char = String...
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
-
June 5th, 2011, 10:52 PM
#7
Re: Convert C to VB
this is the whole codes from c
typedef struct tagSORTMETHOD {
DWORD cbSize; /* Size of SORTMETHOD structure */
INT32 nPocket;
INT32 nSortMethod;
LONG lUseStartPosChar;
LONG lPos;
CHAR cStartPos;
LONG lUseEndPosChar;
LONG lLen;
CHAR cEndPos;
LPSTR lpszComparison;
BOOL bPolarity;
} SORTMETHOD, *LPSORTMETHOD;
pcnd.cbSize = sizeof(SORTMETHOD);
pcnd.nSortMethod =1;
pcnd.nPocket=1;
pcnd.lPos = 0;
pcnd.lLen = 4;
CHAR szzMethod[] = "1000\0" "2000\0" "3000\0";
pcnd.lpszComparison = szzMethod;
pcnd. bPolarity = TRUE;
CsdParSet( CSDP_SORT_METHOD, (LPARAM) &pcnd );
could anyone help me please...
tnx
-
June 5th, 2011, 11:34 PM
#8
Re: Convert C to VB
You can't really use that, as VB6 doesn't know what a POINTER is, and your code uses one.
-
June 9th, 2011, 12:50 AM
#9
Re: Convert C to VB
Guys this is the code from C.NET,please convert it to VB.NET hope this would help.
Tnx
public struct SORTMETHOD
{
/// <summary>sizeof SORTMETHOD structure</summary>
public int cbSize;
/// <summary></summary>
public int nPocket;
/// <summary></summary>
public int nSortMethod;
/// <summary></summary>
public int lUseStartPosChar;
/// <summary></summary>
public int lPos;
/// <summary></summary>
public char cStartPos;
/// <summary></summary>
public int lUseEndPosChar;
/// <summary></summary>
public int lLen;
/// <summary></summary>
public char cEndPos;
/// <summary></summary>
[MarshalAs(UnmanagedType.LPStr)]
public string lpszComparison;
/// <summary></summary>
[MarshalAs(UnmanagedType.Bool)]
public bool bPolarity;
}
-
June 9th, 2011, 10:17 AM
#10
Re: Convert C to VB
Here's the first line, so you can see the SYNTAX
Code:
Public cbSize as Integer ' or whatever TYPE it is
Also, please use CODE TAGS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|