|
|
Hello,
I am a C#/VB programmer. I am trying to fix something that someone else wrote. There is a variable of type _variant_t. I need to take that value, and split it into 2 smaller variants. I am having problems doing this. If anyone can point me in the right direction, I would appreciate it. Here is the variable, "v", that I need to split into 2 variants.
//--------------------------------------------------------
// "m_pResponseBuf->BufPtr()" is a pointer to the text in
// a Response object.
//--------------------------------------------------------
_variant_t v( m_pResponseBuf->BufPtr() );
m_Response->Write( v );
How would I take a portion of "v" and put the results into another variant?
Thanks
Danny
|
|
|
|
|
A portion of v, from what you said, would then be a part of a string. To do string operations you can transfer the string into some more usable string object, do the operation you want then transfer the result into a variant.
Usually a string contained in a variant is of type _bstr_t, so you can do:
CString myString = (LPCTSTR)(_bstr_t)v;
//Do operation on myString
//Back into variant.
_variant_t v2( (LPCTSTR)myString );
|
|
|
|
|
Hello and thanks for the response. Is CString only for MFC apps? I read that somewhere. This dll I am working on is does not use MFC. I'll see if I can do something similar to this, which probably doesn't work, but I'll give it a shot.
std::string myString = (_bstr_t)v;
myString = myString.substr(0,1000);
_variant_t v2( (_bstr_t)myString );
Thanks!!
|
|
|
|
|
Indeed my example was using MFC. Your example using std might work, but their might be a problem with the last operation:
_variant_t v2( (_bstr_t)myString );
not sure you can typecast an std::string with _bstr_t.
Louis
* google is your friend *
|
|
|
|
|
You're right. Didn't work.
Thanks
|
|
|
|
|
hint.
myString.c_str() will return a "const char *". You can then assign that to the variant.
_variant_t v2 (myString.c_str());
Louis
* google is your friend *
|
|
|
|
|
You're right! I tried that, but I did it wrong. I used:
_variant_t v2 (myString.c_str);
Now it works with the parenthesis. Thanks!!!
|
|
|
|
|
Hi
can you help me plz?
I want to use InternetFindNextFile with http not ftp
I use this way
1- InternetOpen
2- InternetConnect
3- ? which function (I think FtpFindFirstFile is for ftp not http)
if i want to use InternetFindNextFile it dont work
can you help me plz?
Thanks in advance,
|
|
|
|
|
messages wrote: if i want to use InternetFindNextFile it dont work
Why? Did you first call FtpFindFirstFile() ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi DavidCrow ,
I dont need to ftp I want to use InternetFindNextFile with http but I dont konw can you help me pls?
thanks
|
|
|
|
|
Did you miss this in the documentation:
InternetFindNextFile() continues a file search started as a result of a previous call to FtpFindFirstFile() or GopherFindFirstFile() .
If you are using MFC, there are several HTTP-related classes you can use for file retrieval.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Dear DavidCrow
I use FtpFindFirstFile but it return 0
WIN32_FIND_DATA data;
HINTERNET h3= FtpFindFirstFile(h2, "*.*", &data, 0, 0);
I guess that it work only with ftp
I use
hInternet = InternetOpen("View",INTERNET_OPEN_TYPE_DIRECT,NULL, 0, 0);
HINTERNET h2=InternetConnect(hInternet,??,INTERNET_SERVICE_HTTP,NULL,NULL,INTERNET_SERVICE_HTTP,0,0);
in ?? I dont know that what? address from ftp or http
if I write www.namesite.com then it return handle HINTERNET
I want address from only http://
but HINTERNET h3= FtpFindFirstFile(h2, "*.*", &data, 0, 0);
always return 0 and data is unknown in fact NULL
Thanks DavidCrow
|
|
|
|
|
The HTTP spec doesn't allow for directory browsing, you need to know where the file is before you can retrieve it. Any sites which *look* like it's a directory listing is just a HTML page that the server is generating on the fly.
You'll need to see if theres an FTP (o Gopher ) version or the site.
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Hi,
using Visual Studio 2003.
I have created a simple dialog based mfc application. I added a second resource file, adjusted the starting symbol values in the generated resource1.h file. Then I added a dialog to that new resource file. My problem is that I cannot add a variable to a control (value or control variable). I cannot see any control IDs in the events pane of the dialog properties so that I could add event handlers to controls. It works with the main resource file but not with this second one.
What am I missing ?
Louis
-- modified at 13:15 Wednesday 19th April, 2006
|
|
|
|
|
If I have a service running set up with Local System account.
Then if I get the System variable 'TEMP' with:
char* tempPath = ::getenv("TEMP");
I will get the variable that is set under "System variables" under "Environment variables" in System properties.
When I later run my client, I will get the current users TEMP path with the same call.
Since that user as it's own defenition of TEMP. ("User variable for XXX" under "Environment variables" in System properties.)
How can I get the "System variable" value for the TEMP variable when running as a the XXX user?
Or in other words: How can I get whatever the service is returned from the client?
//T
|
|
|
|
|
QuaKx wrote: How can I get the "System variable" value for the TEMP variable when running as a the XXX user?
They can be obtained from the HKEY_CURRENT_USER\Environment registry key.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks but, that is only the Users settings. I wanted the machine settings or Global once.
To bad there wasn't a HKEY_LOCAL_MACHINE\Environment.
|
|
|
|
|
Maybe try GetEnvironmentVariable function
|
|
|
|
|
Sorry, but that only gets the users value of TEMP. Since it superseeds the System value.
|
|
|
|
|
this is a repost, and i already told you that if you didn't want to come into the documents and settings\user\temp folder, then you had to do something like that :
%windir%\Temp
|
|
|
|
|
Yes, I posted in the wrong area.
And %windir%\Temp is a pure guess.
Since its possible to change the system environmental variables.
I leave the guessing to the meteorologists.
/T
|
|
|
|
|
Hi all,
I have a customized CFontDialog. I need to have the font sizes between 1 to 12. I've done it. But while selecting the font names, the font size combo box gets updated with default sizes. I need to have the same sizes (1..12) for all fonts.
This is how, I am doing this:
ON_CBN_SELCHANGE(cmb1, OnSelchangeFontNameCombo)
// cmb1 is for Font name combobox
OnSelchangeFontNameCombo()
{ // no code here
}
Since I have written my own SelChange hander, I am not able to generate the sample preview text.
If anyone could suggest me to achieve this, it would be more helpful.
Thanks in advance,
Sarvan AL
|
|
|
|
|
I've hit a CSS bug in IE that disappears when the window is resized. I can't find a way to work around it in CSS and so was wanting to do it in my program's code instead, forcing the embedded browser window to recalculate it's layout after it has been opened (neither a simple refresh nor re-sizing the window seem to work).
Anyone know if this is possible?
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
call SetScrollSizes with desired size.
Regards
Microsoft MVP in Visual C++
http://blog.joycode.com/jiangsheng
|
|
|
|