|
Hi,
Change the Microsoft foundation classes in the projet settings(projectmenu->settings->general tab)to Use MFC in a static library.
Then execute the appln again .Then copy the exe file and try to run in another pc.
|
|
|
|
|
where can i find the projectmenu... is it on the tool bar ?
|
|
|
|
|
Why is it so difficult to find project menu ???
Alternatively Press Alt + F7
|
|
|
|
|
i did as u said but now its showing error...
Embedding manifest...
mt.exe : general error c101008a: Failed to save the updated manifest to the file ".\Debug\testing.exe.embed.manifest". The parameter is incorrect.
kindly help me...
|
|
|
|
|
its ok ya.. its running now.. thanks a lot u been very helpful.. thanks a lot....
|
|
|
|
|
thanks for ur idea mate... its working fine now.. thanks a lot ya...
|
|
|
|
|
Hi, can u please help.
Its a small project and involves communication with a device. The data sent by the device is Written to .DAT file (WeightValue.dat).
Following is the code:
CStdioFile fil;
fil.Open("WeightValue.dat",CFile::modeReadWrite);
fil.WriteString(LPCTSTR(value));
fil.Close();
When I try running the exe in Release / Debug Configuration, I get a debug assertion saying :
"Debugging information for ADRTest.exe cannot be found or doess not match.Binary was not built with debug information."
ADRTest.exe has triggered a breakpoint and breaks to show.
void CStdioFile::WriteString(LPCTSTR lpsz)
{
ASSERT(lpsz != NULL);
breakpoint here-> ASSERT(m_pStream != NULL);
if (lpsz == NULL)
{
AfxThrowInvalidArgException();
}
if (_fputts(lpsz, m_pStream) == _TEOF)
AfxThrowFileException(CFileException::diskFull, _doserrno, m_strFileName);
}
Awaiting your kind reply.
Thanks and Regards.
Divya.
|
|
|
|
|
It seems you are trying to run your RELEASE build in debug mode. Could it be that the output directory for your DEBUG and RELEASE targets is the same directory and you previously built a release EXE and now you are trying to run it in DEBUG mode? Even if not, a simple "clean and rebuild" can't hurt...
Aside of that, my guess would be that fil.Open("WeightValue.dat",CFile::modeReadWrite); fails, i think if it does not find the file specified it won't create it for you, so it can't open it. Check the flags for open here[^], i guess you need CFile::modeCreate | CFile::modeNoTruncate | CFile::modeWrite | CFile::typeText , maybe with the hint of a seeking to the end of the file if you wish to append to it.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Try:
CStdioFile fil;
CFileException e;
if (fil.Open("WeightValue.dat", CFile::modeReadWrite, &e) != FALSE)
{
fil.WriteString((LPCTSTR) value);
fil.Close();
} What type of variable is value ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
i m using this.
1. declare it in header file.
protected:
CBrush m_brush;
2. now on OnInitDialg()
m_brush.CreateSolidBrush(RGB(245, 245, 245));
3.now on OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
return m_brush;
but here edit contol also colored with this color.
please tell me how can i change Back ground color of dialog box and back ground color of static control.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi,
Create a class for the control, then return the brush in OnCtlColor()(in the new class).Just try it iam not sure about the result.
|
|
|
|
|
If you read here[^], you find WM_CTLCOLORDLG[^] and WM_CTLCOLORSTATIC[^], maybe try handling these messages instead of WM_CTLCOLOR, aside of that, the documentation also states this for WM_CTLCOLOR:
lParam
A handle to a child window (control).
This is the handle of the control asking for the color information, you could use that to filter out the controls you wish to change the background color.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks,
please tell how can i color the background of formview.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
hi All
I m writing a directshow application in vc++ 2005. My problem is that I m trying to merge two or more videos clips but i can't get any help from anywhere please help me how do i this.
please help me
Thanks in advance
|
|
|
|
|
What do you mean by merge?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I'm new to C++.
I try to build the Simple application in Microsoft's detours project in VS08.
Detours is used to inject dlls into API processes or into applications. You can find it at:
http://research.microsoft.com/en-us/projects/detours/
I managed to build:
detoured.dll
detours.lib
Simple.dll (That's the hook)
setdll.exe (The program that injects the hook)
sleep5.exe (The exe that uses the hooked API)
When I try to run the hook:
setdll /d:simple.dll
I get the error message:
Error: simple.dll does not export function with ordinal #1.
It's because Simple.dll doesn't export anything.
Detoured.dll does export the function detoured.
detoured.h:
#ifdef DETOURED_EXPORTS
#define DETOURED_API __declspec(dllexport)
#else
#define DETOURED_API __declspec(dllimport)
#endif
HMODULE DETOURED_API WINAPI Detoured();
detoured.cpp:
#include <windows.h>
#include "detoured.h"
static HMODULE s_hDll;
HMODULE WINAPI Detoured()
{
return s_hDll;
}
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
{
(void)reserved;
if (dwReason == DLL_PROCESS_ATTACH) {
s_hDll = hinst;
DisableThreadLibraryCalls(hinst);
}
return TRUE;
}
</windows.h>
But simple.cpp is just this in the package:
#include <stdio.h>
#include <windows.h>
#include "detours.h"
static LONG dwSlept = 0;
static VOID (WINAPI * TrueSleep)(DWORD dwMilliseconds) = Sleep;
VOID WINAPI TimedSleep(DWORD dwMilliseconds)
{
DWORD dwBeg = GetTickCount();
TrueSleep(dwMilliseconds);
DWORD dwEnd = GetTickCount();
InterlockedExchangeAdd(&dwSlept, dwEnd - dwBeg);
}
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
{
LONG error;
(void)hinst;
(void)reserved;
if (dwReason == DLL_PROCESS_ATTACH) {
printf("simple.dll: Starting.\n");
fflush(stdout);
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)TrueSleep, TimedSleep);
error = DetourTransactionCommit();
if (error == NO_ERROR) {
printf("simple.dll: Detoured Sleep().\n");
}
else {
printf("simple.dll: Error detouring Sleep(): %d\n", error);
}
}
else if (dwReason == DLL_PROCESS_DETACH) {
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)TrueSleep, TimedSleep);
error = DetourTransactionCommit();
printf("simple.dll: Removed Sleep() (result=%d), slept %d ticks.\n",
error, dwSlept);
fflush(stdout);
}
return TRUE;
}
</windows.h></stdio.h>
So I tried to make it similar to detoured.dll:
simple.h:
#ifdef SIMPLE_EXPORTS
#define SIMPLE_API __declspec(dllexport)
#else
#define SIMPLE_API __declspec(dllimport)
#endif
HMODULE SIMPLE_API WINAPI Simple();
Simple.cpp:
#include <stdio.h>
#include <windows.h>
#include "..\detours\detours.h"
#define SIMPLE_EXPORTS
static LONG dwSlept = 0;
static VOID (WINAPI * TrueSleep)(DWORD dwMilliseconds) = Sleep;
static HMODULE s1_hDll;
HMODULE WINAPI Simple()
{
return s1_hDll;
}
VOID WINAPI TimedSleep(DWORD dwMilliseconds)
{
DWORD dwBeg = GetTickCount();
TrueSleep(dwMilliseconds);
DWORD dwEnd = GetTickCount();
InterlockedExchangeAdd(&dwSlept, dwEnd - dwBeg);
}
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
{
LONG error;
(void)reserved;
if (dwReason == DLL_PROCESS_ATTACH) {
s1_hDll = hinst;
printf("simple.dll: Starting.\n");
fflush(stdout);
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)TrueSleep, TimedSleep);
error = DetourTransactionCommit();
if (error == NO_ERROR) {
printf("simple.dll: Detoured Sleep().\n");
}
else {
printf("simple.dll: Error detouring Sleep(): %d\n", error);
}
}
else if (dwReason == DLL_PROCESS_DETACH) {
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach(&(PVOID&)TrueSleep, TimedSleep);
error = DetourTransactionCommit();
printf("simple.dll: Removed Sleep() (result=%d), slept %d ticks.\n",
error, dwSlept);
fflush(stdout);
}
return TRUE;
}
</windows.h></stdio.h>
But Simple.dll still doesn't export anything, because SIMPLE_EXPORTS is undefined. How to build this project correctly?
|
|
|
|
|
Put the line
#define SIMPLE_EXPORTS
before the line
#include "simple.h"
«_Superman_»
|
|
|
|
|
Thanks, that worked. But I still don't know, why detoured.dll exported without "#define DETOURED_EXPORTS".
|
|
|
|
|
The pre-processor definitions can also be given as a project settings instead of putting it inside the code file.
Check the PreprocessorDefinitions key inside .vcproj file.
It could be there.
«_Superman_»
|
|
|
|
|
Bingo!
I copied it from an other project and I forgot about it. Man, it's so complicated!
|
|
|
|
|
Hi,
I wanted to open a media file thru 'IWMMetadataEditor' struct variable in C++. After opening this file , I am initialising the 'IWMHeaderInfo' struct variable so that I can collect the meta data of media file(audio/video) through it's properties..
Can anybody tell me how to get the file name which is being played in WMP which will be input to 'IWMMetadataEditor' (pEditor->Open(???))
Regards,
Supriya Tonape.
|
|
|
|
|
Hi all!
I'm on a ciphering Win32 project and i have the following problem:
I have created the thread and I don't use SendMessage calls inside the thread procedure. I use PostMessage with user defined messages to display progress information on the main window. But when the thread starts the whole program dead locks. Is that means that it needs a Sleep function or something else that you could suggest me?
Thanks!
|
|
|
|
|
Show code. Could be anything, you could -maybe- be flooding your GUI thread with messages, or maybe your thread is a run-away thead (it eats up all the CPU time so your GUI has no chanche to do anything), or it could be a deadlock caused by a cross-lock problem, or or or...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
The code is:
void DataCryptMain ::ProcessCrypt()
{
...
cryptthread.Start(_staticThreadProc, this)
...
}
DWORD WINAPI _staticThreadProc(LPVOID lpData)
{
DataCryptMain *dcr = reinterpret_cast<datacryptmain>(lpData);
return dcr->CryptThreadProc(NULL);
}
DWORD WINAPI DataCryptMain::CryptThreadProc(LPVOID lpData)
{
int iErrorOrInfo = INFO_PROCESS_DONE;
iErrorOrInfo = CryptoRijnDaelProcess();
Notify_Progress_GUI(NOTIFY_PROGRESS_END, NULL, iErrorOrInfo);
return 0;
}
void DataCryptMain::Notify_Progress_GUI(int iNotificationType, WPARAM wParam, LPARAM lParam)
{
if (iNotificationType == NOTIFY_PROGRESS_RUNNING)
{
PostMessage(hWnd, WM_PROGRESS_RUNNING, wParam, lParam);
}
else
{
PostMessage(hWnd, WM_PROGRESS_END, wParam, lParam);
}
}
bool _ProgressBarProc(PRBDATA *prbdata)
{
DataCryptMain *dcr = reinterpret_cast<datacryptmain>(prbdata->lpOtherData);
return dcr->ProgressBarProc(prbdata);
}
bool DataCryptMain::ProgressBarProc(PRBDATA *prbdata)
{
if (cryptthread.WaitToExit()) return TRUE;
PRBDATA *_prbdata = new PRBDATA;
memcpy(_prbdata, prbdata, sizeof(PRBDATA));
Notify_Progress_GUI(NOTIFY_PROGRESS_RUNNING, NULL, (LPARAM)_prbdata);
return FALSE;
}
int DataCryptMain::CryptoRijnDaelProcess()
{
int iErrorOrInfo = OK;
RijnDaelCrypto *rdc = new RijnDaelCrypto;
...
...
SetProgressFunc(_ProgressBarProc, (LPVOID)this);
------------------- Here this function loops through the file encryption
if (rdc->Encrypt(wcgFileNameIn, wcgFileNameOut, cryptParams.iCipherMode) < 0)
iErrorOrInfo = ERR_PROCESS_STOPPED_BY_USER;
_DELETE(rdc);
return iErrorOrInfo;
}
bool DataCryptMain::OnProgressRunning(WPARAM wParam, LPARAM lParam)
{
float fPercent[3];
char sTemp[64];
PRBDATA *prbdata = reinterpret_cast<prbdata>(lParam);
fPercent[0] = ((float)prbdata->iReadBytesIncByFuncRead / (float)prbdata->dwSize) * 100.0f;
fPercent[1] = ((float)prbdata->iBlocksIncrement / (float)prbdata->iBlocksNum) * 100.0f;
fPercent[2] = (fPercent[0] + fPercent[1]) / 2;
SendDlgItemMessage(hWnd, IDC_PROGRESSSTATUS, PBM_SETPOS, (WPARAM)fPercent[2], 0);
sprintf_s(sTemp, "%0.1f %%", fPercent[2]);
SetDlgItemText(hWnd, IDC_PERCENT1, sTemp);
sprintf_s(sTemp, "%d bytes", prbdata->dwSize);
SetDlgItemText(hWnd, IDC_FILESIZE, sTemp);
sprintf_s(sTemp, "%d bytes", prbdata->iReadBytesIncByFuncRead);
SetDlgItemText(hWnd, IDC_READBYTES, sTemp);
sprintf_s(sTemp, "%d block/s", (int)prbdata->iBlocksIncrement);
SetDlgItemText(hWnd, IDC_BLOCKSPROCESSED, sTemp);
_DELETE(prbdata);
return FALSE;
} </prbdata></datacryptmain></datacryptmain>
modified on Thursday, January 29, 2009 9:03 AM
|
|
|
|
|
At the first look i don't see any obvious errors (althorough they might be there and i am a blind mouse). Try pausing your (DEBUG build) programs's execution in VS (with the pause button on the toolbar for example) and check what your threads are doing, you might find out what your GUI thread seems to be waiting for. You could also try placing a sleep here and there to see if the situation gets any better or not, if it does then most likely it's the "run away thread" thing, or try removing the PostMessage from the thread temporarily, or make it Post a message every 100th time it is called and run your program to see if your GUI is reponsive or not, if it is, than it is likely you are flooding it with the "status-report" messages.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|