|
|
Thank you for the fast reply.
In my WTL project,
CString a = "1234"; // a is WTL string
// call mfc dll function
SendDataToMFCDll(a);
In my MFC dll
void SendDataToMFCDll(CString a)
{
// a is MFC string
...
}
is it right?
-Freehawk
|
|
|
|
|
|
Thank you.
What you said is as the following?
In my WTL project,
CString a = "1234"; // a is WTL string
// call mfc dll function
SendDataToMFCDll((LPCTSTR)a);
In my MFC dll
void SendDataToMFCDll(CString a)
{
// a is MFC string
...
}
-Freehawk
|
|
|
|
|
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<string> 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.
|
|
|
|
|
hi sidharth,
when u r passing string in vc++ they are accepted in BSTR format. so u have to first change into CString and then to char* to use it as a string.
function used to perform this is
#include<cstring.h>
CString CString_str = _T("");
if (BSTR_str != NULL) // To be sure that input string is valid...
{
CString s;
LPSTR p = s.GetBuffer(::SysStringLen(BSTR_str) + 1);
BOOL UsedDefaultChar;
::WideCharToMultiByte(CP_ACP, 0, BSTR_str, -1,
p, ::SysStringLen(BSTR_str)+1,
NULL, &UsedDefaultChar);
if (UsedDefaultChar)
// BSTR_str contains an ANSI string
CString_str = (LPCTSTR)BSTR_str;
else
// BSTR_str contains an UNICODE string
CString_str = (LPCWSTR)BSTR_str;
}
char *temp = LPSTR(CString_str);
further if u have to include MFC support at the time of creating new ATL project
I hope it will help u.
Ritu
|
|
|
|
|
Thanx a lot buddy. That was a breather. I will try and get back.But I am not using MFC. and if I include <iostream> it will create conflict. Any way let me try first.
|
|
|
|
|
Can i serialize an object with WTL like doing with MFC
vi
|
|
|
|
|
|
"the value of ESP was not properly saved across a function call." i got this error dialog while compiling a MFC client. the MFC client is empty except for a ATL control added to the UI. the ATL control is empty too. Just as it was 1st created by the wizard.
any idea what's wrong?
|
|
|
|
|
|
apparently the problem is with the compiling computer. it works fine in other computers. i tried installing MS SDK, VC++ SP5, clearing up the registry... and nothing works.. haha.. will be installing a new copy of VC++ today.. thanks for all the help guys. BUnch of great ppl we have here!!!
|
|
|
|
|
Hello everyone.
I am a beginner of WTL and STL.
Could you tell me whether STL can be used in a WTL project?
and I need to read data from file line by line,
is there a way to do it like "CStdioFile" of MFC?
Thank you.
-Freehawk
|
|
|
|
|
Hello,
Usel low level or stdio.h in WTL/ATL for e.g
fopen(....);
fwrite(...);
fread(...);
regards
balkrishna talele
|
|
|
|
|
Thank you for the fast reply.
is there way to read file line by line?
-Freehawk
|
|
|
|
|
Hey come on...
if you use
char *readme;
while(!feof(fp))
{
fscanf(fp,"%s",readme);
}
u will get line by line..
cheers
Balkrishna Talele
|
|
|
|
|
Thank you very much.
I will try it.
-Freehawk.
|
|
|
|
|
No you will not. You will get "token by token". Try fgets instead.
--
So let's just walk from place to place, as long as we don't talk face to face.
|
|
|
|
|
|
There you go, always thinking differetly
I have lost more blood shaving than on the battlefield - Adolf Hitler
|
|
|
|
|
freehawk wrote:
Could you tell me whether STL can be used in a WTL project?
STL can be used with any C++ project.
freehawk wrote:
and I need to read data from file line by line,
#include < iostream >
#include < fstream >
#include < string >
int main()
{
std::ifstream f( "c:\\test.txt" );
std::string fline;
while(std::getline( f, fline) )
std::cout << fline << std::endl;
return 0;
}
---
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Thank you and everyone very much.
It is useful to me and I can know it clearly.
-Freehawk
|
|
|
|
|
Less typing:
#include < iostream >
#include < fstream >
#include < string >
using namespace std;
int main()
{
ifstream f( "c:\\test.txt" );
|
|
|
|
|
I have a com object in which there are different properties. When i get these values through it works well when property is returning long or some other integer but it crashes when property is returning bstr. Take a look at my code and guide me that what i did wrong.
VARIANT pvResult;
memset(&pvResult, 0, sizeof pvResult);
VariantInit(&pvResult);
DISPID dispID=this->pColl->getMemberID(index);
DISPPARAMS dispParamsNoArgs={NULL,NULL,0,0};
HRESULT hr=pDispatch->Invoke(dispID,IID_NULL,LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET,&dispParamsNoArgs,
&pvResult,NULL,&nArgErr);
Thanx in advance
Inam
|
|
|
|
|
The EOF marker has arisen from its MS-DOS grave to cause troubles for me -- I have an ifstream (which I open with the ios::binary flag specified) that refuses to read past a 0x1A byte. What am I doing wrong? The only calls I make are:
ticks.open(fn, ios::in || ios::binary);
...
ticks.seekg(fpos<int>(0, iter->offs));
...
ticks.read((char *) &data, sizeof (data));
if (ticks.eof()) return;
Whenever the initial byte of the block to be read is 0x1A, the read fails and eof() returns true. The same code works elsewhere and it's causing me a bit of grief. Any help greatly appreciated.
READIN writin rhythmetic
|
|
|
|