|
You didn't provide the required buffer (URL doesn't point to a valid memory buffer).
Try
LPTSTR URL;
int len = ComboBox_GetTextLength(hComboBox);
URL = new TCHAR[len+1];
ComboBox_GetText(hComboBox, URL, len+1);
delete [] URL;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It works, but something weird happened.
The GetText method requested URL to be LPWSTR.
LPTSTR is multibyte, not unicode.
Any pointers what was the trick in fixing it?
|
|
|
|
|
Actually the ComboBox_GetText macro accpts a LPTSTR as you may see in the documentation [^].
Is there something I missed?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
LPTSTR is defined as follow:
#ifdef UNICODE
typedef WCHAR *LPTSTR;
#else
typedef char *LPTSTR;
#endif
so it will be a pointer to a multibyte or unicode string depending on the project settings; if you choose "Use Unicode Character Set" on the General Tab of your project properties, then LPCSTR is a pointer to an unicode string.
|
|
|
|
|
Hello folks!
I got an annoying anomaly with GDI+ i just can't understand. I created a 32 bit bitmap in memory, did some drawing on it and used it to display a layered window. This all works well except for one thing. I use Gdipluss::Graphics::DrawString to render some text onto this bitmap which seems to erase the alpha channel on the bitmap everywhere where letters of the text are drawn. Here's the simplified code i use:
...
Gdiplus::Graphics Gx(MemDC);
Gdiplus::SolidBrush GxTextBrush(Gdiplus::Color(0, 0, 0));
Gdiplus::Font GxFont(MemDC, &LFont);
Gdiplus::RectF TextRect;
Gdiplus::StringFormat GxFormat;
Gx.DrawString(text, textlength, &GxFont, TextRect, &GxFormat, &GxTextBrush);
...
Changing the GxTextBrush 's color by adding an alpha component of 254 "fixes" the problem, but adding 255 produces the holes again, also making the font bold (LFont.lfWeight = FW_BOLD ) seems to fix the problem also... so could someone please tell me what's the logic behind this? For now i set the alpha to 254 and go on with it...
Thanks for any light-sheding attempts in advance.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi,
I want to send a request to execute a http link which is running in another machine.how to do this using?Is there any function in MFC or SDK? anyone please help me?
thanks,
|
|
|
|
|
|
What do you mean by "execute"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I want to send a request to another system to run a URL.I tried with following code. Its showing error like URL is invalid. But im able to open that URL from my machine.But not able to open that URL using this code.
CInternetSession objInetSession;
CHttpConnection *objhttp ;
CHttpFile *objFile;
char szURL[100];
while(1)
{
objhttp = objInetSession.GetHttpConnection ("http:////101.16.0.42/test/prelogin.aspx", INTERNET_FLAG_MAKE_PERSISTENT, INTERNET_INVALID_PORT_NUMBER,
NULL, NULL);
try
{
wsprintf(szURL,"%s","http:////101.16.0.242/test/prelogin.aspx");
CStdioFile* objStdFile = objInetSession.OpenURL(szURL,1,INTERNET_FLAG_TRANSFER_ASCII,NULL,0);
}
catch(CInternetException* exp)
{
exp->ReportError(MB_OK,0);
}
}
modified on Thursday, April 8, 2010 1:29 AM
|
|
|
|
|
1. '/' is not an escape character so your url should be "http://101.16.0.42/..." not http:////...
2. Depending on what that the script at that url does, what you're trying to do might or might not work. Read about the HTTP protocolhere
in very simple terms, when using a http connection, you're making a request (that might contain some parameters - see GET/POST methods) and you receive a response - the html code that you see in your browser
I hope this helps ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
|
Hello!
I tried to compile a library with VC++ 2008.
However I get a compiler error which I don't understand - which only occurs in .c-Files:
struct MV_Vector_
{
enum ref_type { ref = 1 };
};
The enum leads to the error C2208 ('ref_type' : no members defined using this type).
What is wrong with the code? Any ideas how to work that around?
Thank you in advance,
Alex
|
|
|
|
|
Try it :
struct MV_Vector_{
enum ref_type { ref = 1 } eref_member;
};
virtual void BeHappy() = 0;
|
|
|
|
|
|
that's not standard C.You have to also declare a variable
|
|
|
|
|
That's not C .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hai,
Is there any maximum limit for the char array
Thanks in Advance
|
|
|
|
|
jannathali wrote: Is there any maximum limit for the char array
What do you mean, exactly?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Is there any limit for the array size.
i.e char a[Max_Value];
Is there a limit for this value
Or i can give any big value like char a[40000]; etc
|
|
|
|
|
If you're declaring it local to a function, the size is limited by the available stack space.
If you're declaring it globally, the size is limited by the data section size.
|
|
|
|
|
You may have such big values (why don't you try?).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In most of the cases (but there are some few exceptions), when you have to ask yourself such a question, it probably means that you have taken a bad design decision.
|
|
|
|
|
|
Hello Friends
I am using namespace MSXML in my application to traverse and read XML file.But I have some confusion regarding MSXML is that this one is related to c++ DOM APIs na? And what its relation with COM?
And these both COM AND DOM are provoding different APIs?and then what is DCOM?
Please Suggest me something.I am too confused.
Thanks & Regards
Yogesh
modified on Wednesday, April 7, 2010 2:55 AM
|
|
|
|
|
Roughly speaking, DOM is just a way of representing (and accessing) the XML document (see [^] for a better definition).
There are many libraries dealing with XML documents and some of them, such as MSXML , implement DOM .
Incidentally MSXML is COM (see [^]) based, but that is a mere technological choice. When you use MSXML library, you deal with COM objects representing the corrensponding DOM ones (ADO library shows a similar approach, it exposes an object model for databases: every database object, such as, for instance, the recordset, is a COM one).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|