|
Send me an email if you need a coded example. Otherwise, try this instead:
CString data = "1.1.1.200";
WCHAR strMsg[MAX_PATH];
ZeroMemory(strMsg, MAX_PATH*sizeof(WCHAR));
mbstowcs(strMsg, (const char*)data.GetBuffer(), MAX_PATH);
pAccessPointsInfo[0].sysIPAddress = strMsg;
The only part that throws me a little is your structure. I couldn't "easily" set myself up a small test project passing that structure around... cause I can't remember how to do it because I gladly strode away from BSTR's and VARIANT's 2 years ago when I switched completely to C# and VB.NET. However, that should pretty much do it. I have lots of various examples and ways of doing this so let me know if that doesn't work for you.
|
|
|
|
|
it didnt work for me.... its still one character... i checked my return by putting a sprintf at my code...the whole string is being passed to my vb app.. but only the first character is being seen by the vb app..im sure im passing the structure correctly coz i can see the value of the integer type member of my structue returned... i got this code from one site.. instead of manipulating my mfc com dll.. it manipulates the vb code...its written in vb6 so i had to rewrite my code to vb6....
StringFromBSTR - Convert a BSTR to a VB string
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As _
Any, source As Any, ByVal bytes As Long)
' convert a BSTR into a VB String
Function StringFromBSTR(ByVal pointer As Long) As String
Dim temp As String
' copy the pointer into the temporary string's BSTR
CopyMemory ByVal VarPtr(temp), pointer, 4
' now Temp points to the original string, so we can copy it
StringFromBSTR = temp
' manually clear then temporary string to avoid GPFs
CopyMemory ByVal VarPtr(temp), 0&, 4
End Function
i guess a similar code like that will work for me... i've been trying that code but still no work... pls send me or post a similar code... thanks in advance...
|
|
|
|
|
Try this... this might not be good practice because you'd be allocating memory in C++ and I don't know that VB will clean it up or not...
but try changing your BSTR to BSTR*:
struct udtAccessPointsInfo
{
BSTR* sysIPAddress;
INT sysPortNumber;
BSTR sysAccessPointID;
BYTE sysStatus;
};
CString data = "1.1.1.200";
WCHAR strMsg[MAX_PATH];
ZeroMemory(strMsg, MAX_PATH*sizeof(WCHAR));
mbstowcs(strMsg, (const char*)data.GetBuffer(), MAX_PATH);
pAccessPointsInfo[0].sysIPAddress = SysAllocString(strMsg);
|
|
|
|
|
hi matt.. i cant change the structure they provided for me... it has to be like that.. anyways.. i've already told them about the problem.. still got one issue.. how do i pass an array of struct in vb.net? like for an example..
Structure AccessPointsInfo
Dim sysIPAddress As String
Dim sysPortNumber As Integer
Dim sysAccessPointID As String
Dim sysStatus As Byte
End Structure
Private Declare Function GetAccessPointsInfo Lib "Sample.dll" (ByRef AccessPt As AccessPointsInfo) As Long
i have to pass an array of struct... like... Dim AccessArray(100) As AccessPointsInfo.. i just couldnt find a way....
|
|
|
|
|
You'll need to look into VARIANT arrays. I can't really help you on that one. It's been too long but there are samples here on CP.
|
|
|
|
|
Hi All,
Please provide some clarity to my muddled brain.
I am new to VB.NET and am building some add on customisation to ESRI's ArcGIS suite. I have VS.NET 2003 and am building a VB Class Library project.
My code builds and runs without a hitch on my computer (win2K SP4) but when I build the setup program and deploy on another machine (WinXP SP2) my code installs alright and runs some sections fine, but falls over when it gets to a section requiring stdole saying stdole or one of its dependencys not found.
The target machine has .net 1.1 framework installed and on investigating my .net project I find that the detected dependencies in the setup project stdole is missing reference to mscorlib 1.0.330.0. (I could only find mscorlib 1.05000.0 on my machine)
Further investigation shows that stdole reference is to runtime version 1.0.3705 and file version 7.0.3300.0 yet when I check this file in win explorer it says the file version is 7.0.9466.0.
I can't find any other copies of this file on my machine. Am I somehow referencing a file that no longer exists?? should there be a 1.1 version of stdole??
I have searched and searched and have thus far come up blank.
Any help or explanations greatly appreciated.
Cheers
David
|
|
|
|
|
do you have references to any PIA's?
if you do did you install the latest ones?
|
|
|
|
|
stdole is under the \program file\microsoft.net\primary interop assemblies directory.
I have installed .net framework sp1.
As mentioned above, I am not sure if it is referencing correctly as the reference says file version 7.0.3300.0 but win explorer says stdole.dll file version is 7.0.9466.0.
|
|
|
|
|
are any of these missing from the Windows\System32 or WINNT\System32 folder:
stdole32.tlb
stdole2.tlb
stdole.tlb
|
|
|
|
|
Thanks for the quick reply.
All files exist on my machine under winnt\system32 and client machine under windows\system32
|
|
|
|
|
Mine is the same as yours and I have no trouble in deploying to a new machine. The problem must be somewhere else.
C:\Program Files\Microsoft.NET\Primary Interop Assemblies\stdole.dll
runtime version 1.0.3705 and file version 7.0.3300.0
explorer it says the file version is 7.0.9466.0.
|
|
|
|
|
If you add a setup project to a project with stdole as a reference.
Does the detected dependency refer to mscorlib v1.0330.0?? If so where does this live on your machine.
This is the dependency that seems to be missing from my setup project
I can only locate mscorlb v1.0.5000.0 which live under c:\winnt\microsoft.net\framework\v1.1.4322
|
|
|
|
|
I have these:
mscorelib version 1.0.3300.0 in:
c:\windows\microsoft.net\framework\v1.0.3705\mscorlib.dll
mscorelib version 1.1.4322.2032 in:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorlib.dll
mscorelib version 1.0.2268.0
C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE
if I add the reference to stdole it shows the 1.0.3300.0 version.
|
|
|
|
|
Thanks. I think I'm starting to get somewhere now.
I have loaded .Net Framework 1.0 which has put the file back on my computer under \microsoft.net\framework\v1.0.3705\mscorlib.dll.
It still refuses to pick it up as a dependency and if I add it as a reference (via browse) to the source project I get a message saying it will change where System etc are referenced from and if I agree I get heap of 'Object' is ambiguous in the namespace 'System' type errors come up in the tasks.
I am going to try a reinstall of VS.NET 2003 now that I have .NET Framework 1.0 installed and see if stdole references mscorlib properly.
If I am still having problems I will reply again.
|
|
|
|
|
This is driving me crazy.
OK step by step this is what I do.
I have a VB.NET class library with varios forms and classes, one of which uses stdole.IFontDisp
The solution builds and runs like clockwork on the development machine.
I add a setup project so that I can distribute the dll in a .exe file.
I set the Project Output of the Setup Project to be the source project mentioned above.
When I look at the Detected Dependencies, stdole is missing a dependecy mscorlib 1.0.3300.0
I am sure it exists on my computer now, I am at a loss.
|
|
|
|
|
Ok, I think I may know what the problem is, if you'll bear with me for a bit.
I mushed around thru microsoft's site a bit and found a lot of references about the stdole.dll you are trying to distribute, it is the developer version and that's not supposed to be re-distributed, you reference it in a build when you use the office interops but as far as I can tell the IDE is not supposed to add it to the dependency list because it is installed with the net framework re-distribution. The only one allow to be re-distributed is the runtime version. If your still following all this the a solution may be to download the re-distributable pia's to your machine move the stdole.dll file to your app bin directory and reference it instead, make sure your software works then add it as the dependancy.
This is just a shot in the dark, because, one, I have never had that problem, and two, my IDE say's the same thing your's does, and I have no stdole problem with my builds that include it, as it never get's packaged in the msi file.
|
|
|
|
|
Thanks again.
Are the redistributable PIA's part of the .NET redistributable (dotnetfx.exe).
Should I be thinking then that this is more an issue with the client machine and digging deeper there?? Although I am sure .NET 1.0, .NET 1.1 and Office XP PIA's are installed.
I'll get back to you with any results.
Cheers
|
|
|
|
|
I would look on the Target machine for a problem,
maybe even target another machine like your laptop or somthing to check. I realy don't know what could be causing it.
you should read this page first:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stagsdk/html/stconPIAs.asp
you can get the office PIA's here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en
The PIA runtime's are installed when you intstall officexp.(not on the minimal install)
|
|
|
|
|
Here is somthing else you may want to see:
Information about designing Office XP add-ins and Office 2003 add-ins by using the .NET Framework
http://support.microsoft.com/?id=840585
|
|
|
|
|
Would the fact that I am building on a win2K machine have an impact??
The PIA's are on both build and target machines and are the same version.
|
|
|
|
|
Yes it will, I have had trouble before with app's built on a 2000 box, if your target is XP, I would suggest that you build it on XP, in any case, that may very well be the whole problem.
|
|
|
|
|
Hi,
I'm back apologies for dropping off the planet but meetings and travel kicked in.
The current situation is;
The problem appears to be that all client machines lack the stdole in the assembly directory of the c:\winnt or c:\windows.
From what I read these should be installed with the minimum install of office 2003 but this isn't happening (I am waiting on confirmation from our IT people as they setup all installs remotely over the network.)
Installing the .Net redistributable and XP PIA's doesn't seem to solve the issue as the register.bat for the PIA's requires VS.NET command prompt.
I am trying to following the instructions given for inclusing PIA's in the deployment of the setup project but as yet have had no luck. The project builds but when it is installed it doesn't create stdole in the assembly directory.
Any advice????
|
|
|
|
|
I was wondering if anyone knew how to download attachments from email to a folder using VB.net. What i'm trying to do is take an email, read or unread, from my Inbox, and download the attachments from the email into a predetermined folder. I cannot find any help doing this in the MSDN library. any ideas oh programming guru's? thanks!
megadith
|
|
|
|
|
HOW TO: Retrieve Unread Messages from Inbox by Using Outlook Object Model in Visual Basic .NET
http://support.microsoft.com/?kbid=313795
|
|
|
|
|
I've found that one before, but it doesn't mention anything about attachments. thanks though. Anyone else have any ideas? thanks!!!
|
|
|
|