|
|
well, you asked the question in the correct spot - on that article
Asking it here (again) is superfluous - if you dont get a response from hackzai you may have to narrow the issue down to a piece of code, and then post a specific question here with that code, rather than such an open question
'g'
|
|
|
|
|
Please do not keep repeating the same question. Also, as this is in reference to a CodeProject article you should post in the forum at the end of the article so the author can help you.
Veni, vidi, abiit domum
|
|
|
|
|
This image implies that you can simply import a binary ".exe" resource: http://i.stack.imgur.com/ITdYs.jpg
But how to do this in VS2012 c++? It does not allow me to import an .exe: http://i.stack.imgur.com/zdzbV.png
I'm trying this tutorial:
http://www.codeproject.com/Articles/4221/Adding-and-extracting-binary-resources
modified 13-Oct-13 20:58pm.
|
|
|
|
|
If you have a question about a particular article, you should post it at the end of the article.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Do you know how to solve this problem or not???
|
|
|
|
|
I would like to build a self extracting .exe in Visual Studios c++ 2012.
Does anyone have a working solution for VS2012?
I checked projects like LZMA (7-zip SDK), but it doesn't seem to mention self extracting '.exe' anywhere.
http://ck.kolivas.org/apps/lrzip/lrzip-0.615/lzma/lzma.txt
I check NSIS and inno-setup, but those product don't seem to offer 1 click install.
I checked 'Chilkat v9.4.0' but that is not free!
http://www.chilkatforum.com/questions/2354/how-to-write-a-self-extractor-for-the-windows-os
Those codeproject.com files are so outdated that they give me a lot of errors in VS2012:
http://codeproject.com/Articles/4221/Adding-and-extracting-binary-resources
http://codeproject.com/Articles/7053/Pure-WIN32-Self-Extract-EXE-Builder
|
|
|
|
|
I have found a very interesting incident of memory leak in my code. Although I have not been able to find the root cause of the leak still thought to share with you all. I will really appreciate any help on this. I am rather curious to know how come a memory leak can be seen in use of CString in such a simple way.
Code:
We have a thread function:
UINT __cdecl LogWriteThread(void *pParam)
{
CLog* pLog = (CLog*)pParam;
UNUSED_ALWAYS(pParam);
try
{
pLog->LogWriteFunc();
}
.................
.................
return 0;
}
UINT __cdecl CLog::LogWriteFunc(void *pParam)
{
..........
CString cstrLogDataBuffer = m_cstrLogLine;
m_cstrLogLine = _T("");
CopyLogToFileByThread(cstrLogDataBuffer);
}
void CMpmLog::CopyLogToFileByThread(const CString& cstrLogDataBuffer)
{
....................
const long iLength = cstrLogDataBuffer.GetLength();
char *pBuffer = new char[iLength + 1];
for (long iIndex = 0;iIndex < iLength; iIndex++)
{
pBuffer[iIndex] = (char)cstrLogDataBuffer.GetAt(iIndex);
}
pBuffer[iLength] = '\0';
const unsigned int uiWriteLen = fwrite((const void *)pBuffer, sizeof(char),iLength, m_pofLogStream);
delete[] pBuffer;
....................
}
========================
If I commment call for "CopyLogToFileByThread" in function LogWriteFunc then memory leak goes away. But thats not the solution.
Manoj
Never Gives up
|
|
|
|
|
The shown code part of CopyLogToFileByThread() does not change a CString object. So this can't be the source of the leak it is from a CString object.
It seems that you are accessing the m_strLogLine CString object by multiple threads. When doing so, you must use locking. To do so, you may add a CCriticalSection member to your class and use this for locking:
CSingleLock singleLock(&m_CritSection);
singleLock.Lock();
CString cstrLogDataBuffer = m_cstrLogLine;
m_cstrLogLine = _T("");
singleLock.Lock();
Use similar code when changing or reading m_strLogLine anywhere.
One more note:
Instead of converting a TCHAR string to char by casting each char, you may use WideCharToMultiByte() or the conversion provided by CString :
CStringA strLineA(cstrLogDataBuffer.GetString());
fwrite(strLineA.GetString(), sizeof(char), strLineA.GetLength(), m_pofLogStream);
|
|
|
|
|
Thanks Jochen for your inputs.
1. I have used CriticalSection while accessing m_cstrLogLine but have omitted those additional lines to focus on actual business logic.
2. I agree that WideCharToMultiByte() could have been a better option to convert string but I have changed code to rule out any leak during conversion itself.
3. The CopyLogToFileByThread() is not modifying string and thats why its surprising to have memory leak from that function.
4. One more point i will like to mention here is thhat this application has been built for WinCE 6.0.
I am trying to replicate the same issue with a test application and if possible for XP.
Manoj
Never Gives up
|
|
|
|
|
Manoj Kumar Rai wrote: I have found a very interesting incident of memory leak in my code. How are you verifying this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
POINT Point;
::GetCursorPos(&Point);
HWND hWnd = ::WindowFromPoint(Point);
::PostMessage(hWnd, WM_KEYDOWN, 'a', NULL);
I sent a message WM_KEYDOWN to hWnd.
It is activate on Windows Notepad..
but on games like need for speed, it isn't activate..
how do i do?
|
|
|
|
|
Thats because it probably doesn't use the windows message pump for keyboard and mouse interaction.
|
|
|
|
|
Games like need for speed doesn't use the usual windows messages system. Your application responds when your window gets the message through WindProc and the message loop . The way which is used in games is entirely different.
A cool video :- http://www.youtube.com/watch?v=XLCe-hQ8lgE[^]
"If A is a success in life, then A=x+y+z. (Work is x; y is play; and z is keeping your mouth shut.)"
|
|
|
|
|
Hello!
I had an error in my project created with QT and C++
I created Server which gets data from AudioInput and gives it to UDP Socket, there is no problem, but in Client's project I had a problem, when I tried to write data to AudioOutput device after UDP Socket gets this data from net
in my project error was in this line "int l = audioSource->read(audioBuffer,input);" in
"qaudiooutput_win32_p.cpp"
and this is Call Stack at time debugging which shows this
QtMultimediad4.dll!QAudioOutputPrivate::deviceReady() Line 579 + 0x1c bytes C++
QtMultimediad4.dll!QAudioOutputPrivate::qt_static_metacall(QObject * _o=0x00b53308, QMetaObject::Call _c=InvokeMetaMethod, int _id=1, void * * _a=0x00b51d20) Line 52 + 0x8 bytes C++
what I did wrong
PLEASE HELP!!!!!
|
|
|
|
|
Mkhitar Sargsyan wrote: what I did wrong You forgot to tell us what the error was.
And please use <pre> tags around your code so it is readable, like so:
int l = audioSource->read(audioBuffer,input);
Veni, vidi, abiit domum
|
|
|
|
|
I wrote this code.
QByteArray getdata;
getdata.resize(socket->pendingDatagramSize());
socket->readDatagram(getdata.data(),getdata.size(),&senderaddres,&senderport);
then
qbufferout.open(QIODevice::ReadWrite);
audioOutput->start(ioDeviceout);
qbufferout.write(getdata);
qbufferout.close();
but I have got error at time this function "qbufferout.write(getdata);" and error goes to this line
"int l = audioSource->read(audioBuffer,input);" this line is in the "qaudiooutput_win32_p.cpp"
|
|
|
|
|
Well you still have not used <pre> tags round your code. And you still have not told us what the error is.
Veni, vidi, abiit domum
|
|
|
|
|
I don't know how use this
tags
|
|
|
|
|
Select your code and click on the code button above the edit box.
Veni, vidi, abiit domum
|
|
|
|
|
how can I post here picture???????????
|
|
|
|
|
You can't; just post the lines of code, indicate the line where the error occurs, and show the complete error message. It's only a simple matter of copy and paste.
Veni, vidi, abiit domum
|
|
|
|
|
void networking::Resive()
{
QByteArray getdata;
getdata.resize(socket->pendingDatagramSize());
socket->readDatagram(getdata.data(),getdata.size(),&senderaddres,&senderport);
qbufferout.open(QIODevice::ReadWrite);
audioOutput->start(ioDeviceout);
qbufferout.write(getdata);
//after this line it hase got error and goes to this one "int l = audioSource->read(audioBuffer,input)" //this isn't my code. it is code of QT
qbufferout.close();
}
and error message is it:
"First-chance exception at 0x586d997a in networking.exe: 0xC0000005: Access violation reading location 0xab216d6b."
and call stack shows this:
"QtMultimediad4.dll!QAudioOutputPrivate::deviceReady() Line 579 + 0x1c bytes "
|
|
|
|
|
Access violation means that it is trying to read a memory location that is not part of the application's address space. The only way to diagnose such an error is to step through the code with your debugger and see where the bad address is getting set, or where a good address is getting overwritten.
Veni, vidi, abiit domum
|
|
|
|
|
I have a simple project that compiles in VS2005. When I compile it in VS10, I get assertion errors in the file bcmenu.cpp. bcmenu.cpp was taken from this project
http://www.codeproject.com/Articles/22/Cool-Owner-Drawn-Menus-with-Bitmaps-Version-3-03
The first few comments on that link talk about the project not working for Windows XP if compiled in VS10. Any chance, anyone else has come across this and has a solution? I see the comments but my project compiles in VS10, runs fine on Vista, 7, & 8 but crashes on XP and I cant figure out from the comments what Im doing wrong.
Please let me know. If you have a revised bcmenu.cpp file that you can email me, that would be great.
|
|
|
|