|
But the line
free(lpText);
does that exists in your code? Beacause that line is wrong. Please try your code without that line...
Wout Louwers
|
|
|
|
|
You should try
lpText=(char*)malloc(32);
strcpy(lpText,"Hello world\n");
...
free(lpCode);
free(lpText);
|
|
|
|
|
SendMessage is synchronous. It's perfectly OK to use lpText as the parameter. SendMessage will not return until the receiving window has handled the message.
If you wrote the control with ID IDE_RTFBOX , and overrode WM_SETTEXT , you should make a copy of the argument there.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Anyone know how to turn it off from a WinInet-based client?
I'm getting hit by Q263754: WinInet Application Stops Responding and Shows 100-Percent CPU Utilization[^]. The problem only occurs when chunked encoding is enabled.
They recommend that you use HTTP 1.0, which doesn't support chunked encoding, except that specifying HTTP 1.0 in the request doesn't fscking work!!![^]
Their recommendation is to change a setting in the registry to force IE/WinInet to use HTTP 1.0. It would, of course, be extremely poor form for my application to do this so is there anything else I can do?
I tried setting a "Transfer-Encoding: identity" header in my request but that causes the HttpSendRequest() call to hang
Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin
Awasu 2.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
I have a proplem when I insert data into a binary field of table.
I use ODBC and MFC.
thank you very much.
|
|
|
|
|
In my quest for a simple to use image loading library I came across GDI+. I only want to use the portion of GDI+ that loads images, since it loads every image type that I would ever need into a DIB (which I can extract and feed OpenGL). However, I have the most annoying and frustrating issue: the image is not loaded and the lastResult member of the Bitmap object indicates InvalidParameter. Obviously I'm feeding it something bad. The relevant code snippet follows:
<br />
xBoolean xImage::Load (char *fileName, xBoolean mipmap)<br />
{<br />
BitmapData *bmpData = new BitmapData ();<br />
Rect *rect = new Rect ();<br />
sint32 format, stride;<br />
uint32 i, j;<br />
xbyte *tempBuffer;<br />
uint32 wideLen;<br />
WCHAR *fileNameW = NULL;<br />
<br />
if (fileName == NULL)
return xfalse;<br />
<br />
wideLen = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, fileName, -1, NULL, 0);
fileNameW = (WCHAR *)malloc (wideLen);
MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, fileName, -1, fileNameW, wideLen);
<br />
Bitmap bmp ((const WCHAR *)fileNameW, FALSE);<br />
<br />
...<br />
The string fileName is being properly translated to fileNameW as below:
<br />
fileName[0] 119 'w' char<br />
fileName[1] 104 'h' char<br />
fileName[2] 105 'i' char<br />
fileName[3] 116 't' char<br />
fileName[4] 101 'e' char<br />
fileName[5] 46 '.' char<br />
fileName[6] 116 't' char<br />
fileName[7] 103 'g' char<br />
fileName[8] 97 'a' char<br />
fileName[9] 0 char<br />
<br />
fileNameW[0] 119 unsigned short<br />
fileNameW[1] 104 unsigned short<br />
fileNameW[2] 105 unsigned short<br />
fileNameW[3] 116 unsigned short<br />
fileNameW[4] 101 unsigned short<br />
fileNameW[5] 46 unsigned short<br />
fileNameW[6] 116 unsigned short<br />
fileNameW[7] 103 unsigned short<br />
fileNameW[8] 97 unsigned short<br />
fileNameW[9] 0 unsigned short<br />
The constructor for the Bitmap object is as follows:
<br />
class Bitmap : public Image<br />
{<br />
public:<br />
friend class Image;<br />
friend class CachedBitmap;<br />
<br />
Bitmap(<br />
IN const WCHAR *filename,<br />
IN BOOL useEmbeddedColorManagement = FALSE<br />
);<br />
Recall that the lastResult member is being set to InvalidParameter. Here are the possible GDI+ return values:
<br />
enum Status<br />
{<br />
Ok = 0,<br />
GenericError = 1,<br />
InvalidParameter = 2,<br />
OutOfMemory = 3,<br />
ObjectBusy = 4,<br />
InsufficientBuffer = 5,<br />
NotImplemented = 6,<br />
Win32Error = 7,<br />
WrongState = 8,<br />
Aborted = 9,<br />
FileNotFound = 10,<br />
ValueOverflow = 11,<br />
AccessDenied = 12,<br />
UnknownImageFormat = 13,<br />
FontFamilyNotFound = 14,<br />
FontStyleNotFound = 15,<br />
NotTrueTypeFont = 16,<br />
UnsupportedGdiplusVersion = 17,<br />
GdiplusNotInitialized = 18,<br />
PropertyNotFound = 19,<br />
PropertyNotSupported = 20<br />
};<br />
It isn't that it can't find the file, GDI+ is initialized properly, and it isn't any useful error. One other thing, if I change the line
<br />
Bitmap bmp ((const WCHAR *)fileNameW, FALSE);<br />
to read
<br />
Bitmap *bmp = new Bitmap ((const WCHAR *)fileNameW, FALSE);<br />
the compiler spits an error about not finding the constructor, which I found odd. If anyone can help, it would be much appreciated.
|
|
|
|
|
jgeorge21 wrote:
fileName[5] 46 '.' char
fileName[6] 116 't' char
fileName[7] 103 'g' char
fileName[8] 97 'a' char
From MSDN:
[quote]
Bitmap::Bitmap(filename, useIcm)
Creates a Bitmap object based on an image file.
Bitmap(
const WCHAR* filename,
BOOL useIcm
);
Parameters
filename
[in] Pointer to a null-terminated string that specifies the path name of the image file. The graphics file formats supported by GDI+ are BMP, GIF, JPEG, PNG, TIFF, Exif, WMF, and EMF.
[/quote]
I do not see tga in the list of supported formats.
Try http://www.codeproject.com/bitmap/cximage.asp[^] instead.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
hello
This is meant as a theorethical programming question basically but if you could acompany some examples in c and vbs to your answers as examples or proof of concepts that would be lovely.
So the question is:
Can code be archived(made smaller than it actually is)?
Like for exemple could I have a function make_code_big_again that could receive as a parameter a array like structure, string wharever containing some code that was made small andmake it bigg again and run it???
or could this be done with binary files???
like could I somehow archive them, put them inside the exe in a big string or as resources and then unpack them, but withouth utilising any third paryt software like winrar or winzip cause that wouldn't make the program very platform independent.
???
thank you for your time
|
|
|
|
|
Sure, if the code is run on an interpreter.
|
|
|
|
|
something like an auto-extractable zip archive ? yes it's possible...
I think that you can find an example somewhere here on codeproject.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
how to create thread in runtime
|
|
|
|
|
UINT thFun(void*){
return 0;
}
fun(){
AfxBeginThread(thFun,NULL); //starts thFun() in a new thread
return 0;
}
This creats a worker thread. There is something called UI thread also-
search cp for them ...
suhredayan There is no spoon.
|
|
|
|
|
I have 2 parse a xml in my vc++ programs , which parser should i used , how 2 implement that.
Rahul Agarwal
|
|
|
|
|
there is very well documented Interface in COM known as IXMLDOMDocument,IXMLDOMElement which help you in parsing the XML.
MSDN has Example to show working of IXMLDOMDocument, IXMLDOMElement .
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hain Rahul,
Here is your Sample Code For XML Parsing in both VB and vc++. i hace taken this code from the MSDN
[Visual Basic]
Example
The following Microsoft® Visual Basic® example creates an IXMLDOMAttribute object from the first attribute of the root and displays the object's value and xml properties.
Dim xmlDoc As New Msxml2.DOMDocument
Dim root As IXMLDOMElement
Dim objDOMatt As IXMLDOMAttribute
xmlDoc.async = False
xmlDoc.Load ("books.xml")
Set root = xmlDoc.documentElement
Set objDOMatt = root.firstChild.Attributes.Item(0)
MsgBox (objDOMatt.Value)
MsgBox (objDOMatt.xml)
[C/C++]
Example
#import "msxml3.dll"
using namespace MSXML2;
#define CHECK_AND_RELEASE(pInterface) \
if(pInterface) \
{\
pInterface->Release();\
pInterface = NULL;\
}\
#define RELEASE(pInterface) \
{\
pInterface->Release();\
pInterface = NULL;\
}\
_variant_t varValue;
BSTR bstrAttributeName = ::SysAllocString(_T("dateCreated"));
IXMLDOMElement *pIXMLDOMElement = NULL;
IXMLDOMDocument *pIXMLDOMDocument = NULL;
HRESULT hr;
try
{
hr = pIXMLDOMDocument->get_documentElement( &pIXMLDOMElement);
SUCCEEDED(hr) ? 0 : throw hr;
if(pIXMLDOMElement)
{
varValue = _T("year 2000");
hr = pIXMLDOMElement->setAttribute(bstrAttributeName, varValue);
SUCCEEDED(hr) ? 0 : throw hr;
hr = pIXMLDOMElement->getAttribute(bstrAttributeName, &varValue);
SUCCEEDED(hr) ? 0 : throw hr;
if(varValue.vt != VT_NULL)
{
::MessageBox(NULL, _bstr_t(varValue), bstrAttributeName, MB_OK);
bResult = TRUE;
}
RELEASE(pIXMLDOMElement);
}
::SysFreeString(bstrAttributeName);
bstrAttributeName=NULL;
}
catch(...)
{
if(bstrAttributeName)
{
::SysFreeString(bstrAttributeName);
bstrAttributeName = NULL;
}
CHECK_AND_RELEASE(pIXMLDOMElement);
DisplayErrorToUser();
}
// Release pIXMLDOMDocument when finished with it.
Output (in a message box)
Year 2000
---
And Please Don't refer me BY SIR,as i don't deserve it yet,may be after 10 or 20 years
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
hello friends
i have to make project on ids. so how shld i start
using vc++. plz guide me soon.
thanx
bye
|
|
|
|
|
good for you ...
this should help you start ...
int id;
but more seriously, HUH ? what IDs, and in which context ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
IDS means "intrusion detection system"
|
|
|
|
|
like in alarm systems ?
2 other people asked you the same question, you should rephrase your original question to include as much information as possible so that we can help yip ( if possible ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
What do you mean by ids ?
suhredayan There is no spoon.
|
|
|
|
|
IDS means "intrusion detection system"
|
|
|
|
|
r u talking about Some type of Identification systems here Ms Smriti
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
no IDS means "intrusion detection system"
|
|
|
|
|