|
Please help me I lost my night sleep. Tell in simple code.
From my VB client I am passing simple string "Siddharth", to a win32 dll function GetUserName(DATATYPE)(if DAtatype is BSTR or wstring tell me how to convert it into string in dll function declaration). My program should run in 98 as well as NT. I am trying lot of examples but they all are for long. When I convert it to string nothing works out.
VB client
Dim x as string
x = "String"
GetStringFromVb(wstring *)
end
Win32
GetStringFromVb(wstring*)
{
vector MyString;
MyString.push_back(wstring);
{
//..Lot of string manipulation
}
}
One more issue. in the win32 DLL.h if I declare stl parameter, it is not accepted by the compiler.
|
|
|
|
|
Widebytetomultibyte will help you convert wstring to string.
But since the input is from VB i guess it must be BSTR
so to convert BSTR to string
put USES_CONVERSION as the first line in the function
and when you want to convert BSTR to string
use this macro OLE2A to finish the job.
Still Alive!!!
Thank you God.
|
|
|
|
|
Bulls eye boss, in identifying the problem. Really U are great. I am trying it. Will get back to you.
One point I want to clarify USES_CONVERSION is not included in Index part of MSDN. Nor OLE2A
|
|
|
|
|
SiddharthAtw wrote:
Really U are great
humm, ab chane ke jhad pe mat chada.
Still Alive!!!
Thank you God.
|
|
|
|
|
Meri kya aukaat ki guru logo ke chana ka Jhad par chadao. It gave me breather, believe me.Right now experimenting with the issue.
|
|
|
|
|
Mr.Prakash wrote:
humm, ab chane ke jhad pe mat chada
jhad chana chane ka jhad chakkar ke hai
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
include atlconv.h for uses_conversion stuff
also you can refer this link for futher understanding
USES_CONVERSION[^]
its not a complete doc but its good to understand and about the link in MSDN
try searching it, i guess its in of the knowledge base article.
Still Alive!!!
Thank you God.
|
|
|
|
|
During write IIS Filter, I want to find and send message to other windows, but I find the ::FindWindow and ::PostMessage seems does work inside IIS Filter codes. I think maybe they work in different desktop. Would you please tell me how can I make them communicate? Thanks a lot!
|
|
|
|
|
Have you tried checking the option to allow the WWW service to interact with the desktop? This would be in the controlpanel/services applet.
onwards and upwards...
|
|
|
|
|
I have an unmanaged MFC project that I am referencing from a managed MFC project. The unmanaged project builds successfully, but the build of the managed project fails during the link because it cannot find the external symbols from the unmanaged class. In what directory should the dll file be placed for the unmanaged project? The intellisense operates correctly referencing the unmanaged class within the source for the managed class. However, the linker is not finding the external symbols for the compiled class. Any suggestions?
|
|
|
|
|
|
Hi !
(calling an ActiveX thing from Delphi 7)
Any clues as to why I am getting the following error msg ?
error msg; Undeclared identifier: 'Layer2'
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Script
procedure TMinMap.MGMap3onMapLoaded(ASender: TObject;
const Map: IDispatch);
var
Layer2: String;
begin
Layer2 := 'Streets-All-With Names';
TMinMap.Layer2.setVisibility(true);
end;
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Thanks, Cliff
|
|
|
|
|
woah! what language is that? Greek?
Still Alive!!!
Thank you God.
|
|
|
|
|
Greek would possibly be easier !
It's a messy post, but between the<<<<<<<<<<<<'s
is a piece of Delhpi 7 script that is trying my patience. There isn't a Delphi forum here so. . .
|
|
|
|
|
|
Thanks Mike,
Didn't fix it though.
Cliff
|
|
|
|
|
CliffClimber wrote:
Layer2 := 'Streets-All-With Names';
TMinMap.Layer2.setVisibility(true);
No knowing delphi I have a problem with these two lines. In one you use Layer2 without a TMinMap. Are they two different variables named Layer2? One as an object variable and one as a local procedure variable?
John
|
|
|
|
|
John,
procedure TMinMap.MGMap3onMapLoaded(ASender: TObject; const Map: IDispatch);
var
// the following line declares the variable as
//a String
Layer2: String;
begin
// the following line assigns a value to the
//String
Layer2 := 'Streets-All-With Names';
// and this one is supposed to instruct the
// program to set the layer named
//'Streets-All-With Names' visible
TMinMap.Layer2.setVisibility(true);
end;
|
|
|
|
|
Did you try?
procedure TMinMap.MGMap3onMapLoaded(ASender: TObject; const Map: IDispatch)
var
Layer2: String;
begin
Layer2 := 'Streets-All-With Names';
Layer2.setVisibility(true);
end;
John
|
|
|
|
|
John,
It returns a different error
"Record, object or class type required"
I will change the name of the variable Layer2 and see if that works.
Thanks, Cliff
|
|
|
|
|
Nope, didn't work either.
|
|
|
|
|
Ok, I will apply some VC++ knowledge to it, lets see.
I assume TMinMap is a class as in c++;
so when you say TMinMap.Layer2.setVisibility(true); it is refering to the member variable of the class, but it is not coz i guess its a local variable of the procudure so you will get variable not declared error.
In one of the post you said Layer2.setVisibility(true) gives a different error as its not an object or so, that means setVisibility(true) is not a member function(procudure) of String.
So i guess these lines of code is quite wrong.
Still Alive!!!
Thank you God.
|
|
|
|
|
yes, I'm finished for today anyway.
Thanks for all the feedback !!
Cliff
Modification;
solved the problem
|
|
|
|
|
Hiya, I want an easy way of outputting persistant files in MFC but not serializing them. I've tried fostream and CFile techniques but am having no luck.
Trying to override the OnSaveDocument function to get access to the file name and path I'm saving to, but fostream doesn't accept LPCTSTR's as parameters, and am having no luck with CFile.
If anyone knows how to parse the variable to get the filename and path exactly, or has any techniques, I'd appreciate it.
Thank you.
|
|
|
|
|
strik wrote:
fostream doesn't accept LPCTSTR's as parameters
It should. Are you using UNICODE? Otherwise LPCTSTR is just a char *
John
|
|
|
|