|
PJ Arends wrote:
nWrap is the maximun number of characters in the line?
Yes, nWrap is the wrap boundary, i.e. the longest length of the resulting lines.
PJ Arends wrote:
Does lines have to be CPtrArray,
Gak! I told you I was sleep deprived.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi all,
I have a server and some clients,
I wamt a good solution to send messages to this
clients together.
Best Wishes,
Thanks.
|
|
|
|
|
|
Hello friends I've search in many post of this boards and the Articles, but a can't to find how I can to make the comunications with dialogs, for example I want to manipulate controls (list, Pages,...) of a Dialog One since other dialog two.
Please I somebody know about it, Answer this question.
The Best Regards
NiponWare
|
|
|
|
|
If you have not clicked on "Search comments", please do so at this time. The basic question you are asking has been asked severial time in the passed few months.
By now, someone may have wrote an article on it or placed it in a FAQ.
Well that's the best I can do right now, Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
This is easily done by passing a pointer to DialogOne to DialogTwo , thereby allowing DialogTwo to manipulate controls in DialogOne .
That being said, it's poor programming practice to simply modify controls in another dialog at whim. It's better (imho) that DialogOne expose well defined public methods to manipulate its controls. For example, if you want to repopulate DialogOne 's list control (m_someListCtrl ) member from DialogTwo , expose a method in DialogOne like this:
void repopulateListCtrl()
When DialogTwo wants DialogOne to reload its list control, it makes the following call:
DialogOne* m_pDialogOne = ptr to a DialogOne instance;
ASSERT (m_pDialogOne != NULL);
ASSERT (m_pDialogOne->GetSafeHwnd() != NULL);
ASSERT (::IsWindow (m_pDialogOne->GetSafeHwnd());
m_pDialogOne->repopulateListCtrl();
The implementation of DialogOne::repopulateListCtrl() method should PostMessage() a command to itself which causes the dialog's list control to be populated. This allows dialog specific UI actions to be properly serviced by each dialog's message queue.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hello !
I want to know all the files that are inside a specific folder. Something similar to the CFileFind class in the MFC but WITHOUT using the MFC .
Are there some functions from the API I can use ??
Thanks
|
|
|
|
|
use _findfirst() and _findnext()
Steve
|
|
|
|
|
Wow, that was a quick response
Thanks, I will take a look at it but I think this is what I'm looking for
|
|
|
|
|
You can also use:
FindFirstFile (or FindFirstFileEx), FindNextFile, FindClose
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
hi guys
i need help on this real bad....
I have a MFC application dialog based.. has 2 dialog forms say dialog1 and dialog 2.. in dialog1 i have a picture holder (IDC_HOLDER). what i need to do is get the "Rect" value of that holder from dialog2 .. i can do that from dialog1 with
<br />
CRect rc;<br />
GetDlgItem(IDC_HOLDER)->GetWindowRect(rc);
but how to access that from dialog2....
my whole project has come to HALT by this ... please help .. someone !!!!!
thanks
zm
|
|
|
|
|
CDialog1* dlg1;
dlg1->GetDlgItem(IDC_HOLDER)->GetWindowRect(rc);
you may just create an instance of the first dialog and get a pointer to it like the above
|
|
|
|
|
should have mentioned that earlier.. i already tried that it doesnot work.. generates error.. tried to debug it and it fails right where i do
dlg1->GetDlgItem(IDC_HOLDER)->GetWindowRect(rc);
gives tis err msg.. Unhandled exception in rect.exe(MFC42D.DLL):0x..... Access Violation.
thanks for the suggestinon though....
can anyone have a solution for this ,
please . help mel...............
|
|
|
|
|
Of course it does. Code is using uninitialized pointer.
Instantiating another object is not going to help either since it will not be the same dialog that you are using.
In dialog 2 you would have to obtain pointer to existing dialog 1. once you have that pointer you can access any public member variable and function.
How to obtain this pointer depends very much where dialog 2 is created and what relationship (if any) exists between both dialogs.
Also modality plays role here.
JohnCz
|
|
|
|
|
No one knows how to do that ?? come on man there must be some GURU out there who can solve my problem ... COMEON HELP ME !!!!!!!!!!!!!!!!!!!
|
|
|
|
|
in dialog1, you need to have a pointer to dialog2 ...
in dialog1, you will do something like :
CRect rect;
CWnd* pWnd = pDialog2->GetDlgItem( IDC_HOLDER );
pWnd->GetWindowRect( rect);
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
How can I detect a CODEC(Media Coder-decoder) was installed? And detect its version? Such as "Media Player 9 Series Codec"
|
|
|
|
|
Hello,
I got some code that overloads the use of overloading functions.
What is the maximum number of overloaded functions a function can have in VC 7.1 (.NET 2003)?
void GetValue(bool &isValue, UINT keyId, UINT sectionId);
void GetValue(bool &isValue, const CString& keyName, UINT sectionId);
void GetValue(bool &isValue, UINT keyId, const CString& sectionName);
void GetValue(bool &isValue, const CString& keyName, const CString& sectionName);
...
...
void GetValue(__int64 &value, const CString& keyName, const CString& sectionName);
Intellicense of VC recognices only the first 12 overloaded signatures, when expanding with CTRL-Space.
Compilation is O.K even with a highest warning level, which does not hide the possibility that the compiler is casting the values of the last overloaded functions.
Running PC-Lint gives some warnings as only 12 overloaded signatures are present.
Any comment?
--- Rbid. (I'm not the one that loves to overload!)
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
I'm not sure about VC 7.1 but with VS6, I have a class with two methods, each overloaded several dozens of times. Twelve seems awfully skimpy.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
I've posted a question on code project, but didn't get a good reply.
Why does the following code isn't working:
// the input params are
szOperation = "diff.exe"
szParams = " "C:\1.txt" "C:\WINDOWS\FileSafe\0017CF85-0029-0000-B9ED-DF4AD816684A\olvf.fs"
szCompareResFile ="C:\WINDOWS\FileSafe\0017CF85-0029-0000-B9ED-DF4AD816684A\cfv.fs.cr.1"
The called function to operate the GNU "Diff.exe" (which is based on the RGDiff application taken from code project) is :
int CFSMgr::OperateGNUDiff(CString szOperation,CString szParams,CString szCompareResFile)
{
int iOperationLen = szOperation.GetLength();
int iParamsLen = szParams.GetLength();
CString szCmdLine(szOperation);
szCmdLine += _T(" ");
szCmdLine += szParams;
TCHAR szCmd[CMD_LINE_BUFF_LEN];
_tcsncpy(szCmd,(LPTSTR)(LPCTSTR)szCmdLine,iOperationLen + iParamsLen + 2);
CString szEcnrypted(szCompareResFile);
szEcnrypted += _T(".enc");
CString szErrFile(szCompareResFile);
szErrFile += _T(".err");
CCrypt c;
DWORD dwExitCode(0);
int iLen = szEcnrypted.GetLength();
TCHAR szKey[] = _T("FS@CORE@");
TCHAR* lpszEncrypted = NULL;
BOOL bSucc(FALSE);
try
{
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = 0;
sa.bInheritHandle = 1;
HANDLE hOutput = CreateFile(szCompareResFile,
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_WRITE | FILE_SHARE_READ,
&sa,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
0);
HANDLE hErr = CreateFile(szErrFile,
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_WRITE | FILE_SHARE_READ,
&sa,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
0);
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
::ZeroMemory(&siStartupInfo, sizeof(siStartupInfo));
::ZeroMemory(&piProcessInfo, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
siStartupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
siStartupInfo.wShowWindow = SW_HIDE;
siStartupInfo.hStdOutput = hOutput;
siStartupInfo.hStdError = hErr;
bSucc = CreateProcess(0,
szCmd,
0,
0,
FALSE,
0,
0,
0,
&siStartupInfo,
&piProcessInfo);
while (TRUE)
{
bSucc = GetExitCodeProcess(piProcessInfo.hProcess, &dwExitCode);
if (dwExitCode != STILL_ACTIVE)
break;
else
Sleep(50);
}
CloseHandle(piProcessInfo.hProcess);
CloseHandle(hOutput);
CloseHandle(hErr);
switch (dwExitCode)
{
case 0:
bSucc = DeleteFile(szCompareResFile);
return 0;
case 1:
lpszEncrypted = new TCHAR[iLen];
_tcscpy(lpszEncrypted,szEcnrypted);
c.EncryptFile((LPTSTR)(LPCTSTR)szCompareResFile,lpszEncrypted,szKey);
if (lpszEncrypted)
SAFE_DELETE(lpszEncrypted);
bSucc = MoveFile(szEcnrypted,szCompareResFile);
_ONERR(bSucc, return -1);
return 1;
case 2:
ATLASSERT(FALSE);
return 2;
default:
ATLASSERT(FALSE);
return -1;
}
return 0;
}
catch(...)
{
ATLASSERT(FALSE);
return -1;
}
}
CreateProcess returns TRUE (succeeded!) but the GetExitCodeProcess method puts 2 for dwExitCode which indicates a diff.exe failure!
I can't figure out what's wrong????
Can any1 help ?
Thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
This means that the diff.exe process ran, and returned an exit code of 2. Taking a guess, this might mean that the two files you passed to it did not compare (they didn't have the same contents).
If you've got the documentation, see what diff.exe returns for files that are identical and those that are not. You might also want to try this from the command line or a batch file, where you can test exit codes using IF ERRORLEVEL .
Software Zen: delete this;
|
|
|
|
|
thanks for the quick response.
i have based my code uppon the article "RGDiff - Visual Diff Tool" by Rob Groves, you can find it here : http://www.codeproject.com/tools/rgdiff.asp[^]
the documentation says that 2 means an error occured whilst doing the diff and the err output file which i have placed (siStartupInfo.hStdError) should write the error that occured. unfortunately the error file that was created was empty....?
I still need some guidens here...you've mentioned a batch file and testing an error code, can u give an example code?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Testing with a batch file is useful when you don't have documentation for the diff.exe program.
Given that you are constructing the command line dynamically, I would first verify that the command line you are building is correct. Set a breakpoint right before the call to CreateProcess and examine the contents of the command line. If that looks correct, I would try running diff.exe from the command line with the exact text you saw in the debugger, and see what message diff.exe is displaying. In this case, it should simply output the message to the screen.
Software Zen: delete this;
|
|
|
|
|
thanks for the reply.
I already did that, and running it from command line using the input params give 100% result! that is why i am so annoying. it works with a command line but it doesn't work using CreateProcess code....
help!?
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote:
szParams = " "C:\1.txt" "C:\WINDOWS\FileSafe\0017CF85-0029-0000-B9ED-DF4AD816684A\olvf.fs"
szCompareResFile ="C:\WINDOWS\FileSafe\0017CF85-0029-0000-B9ED-DF4AD816684A\cfv.fs.cr.1"
You must use double backslashes for string literals. Also, the szParams= statement has an odd number of quotation marks.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|