|
i want to convert the interger to a binary string in EVC.so i use the '_itot'.
<br />
UINT16 high16data = dwReadValue;<br />
CString high16string = _itot(high16data, high16string, 2);<br />
the error is:error C2664:'_itow':cannot convert parameter 2 from 'const unsigned short *'
how can i convert the parameter?(i do want to use the CString type not the char[] as showed in MSDN). so how to do it?
thanks for helping.
i 've tried ,then i have no regret
|
|
|
|
|
_itot does not accept a CString as parameter. you have to pass a TCHAR* as the second parameter. Why don't you use CString::Format?
|
|
|
|
|
CString::Format maybe a good choice,i'll try it tomorrow
i 've tried ,then i have no regret
|
|
|
|
|
CHYGO wrote: i'll try it tomorrow
It will be a good day
virtual void BeHappy() = 0;
|
|
|
|
|
it is an good day
i 've tried ,then i have no regret
|
|
|
|
|
LPWSTR URL;
ComboBox_GetText(hComboBox, URL, sizeof URL);
I'm writing this app where the user enters a URL in a ComboBox.
When he presses OK, the text in the ComboBox is retrieved to start processing.
Using Unicode!
Every time I enter a URL the program breaks and starts the debugger.
Running Visual Studio 2010.
Any help appreciated.
modified on Wednesday, April 7, 2010 8:43 AM
|
|
|
|
|
And what is your trouble about?
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]
|
|
|
|
|
Every time I enter a URL the program breaks and starts the debugger.
Running Visual Studio 2010.
|
|
|
|
|
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
|
|
|
|
|
|
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
|
|
|
|