|
Hi !
Try this:
DWORD fileLength = workFile.GetLength(); //line 1
//char fileBuf[fileLength]; //line 2
char * fileBuf = new char[fileLength];
workFile.Read(fileBuf, fileLength); //line 3
....
delete[] fileBuf;
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@mailru.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
thanz.. that solved part of the problem.. now the compiler says that fileBuf is undeclared (line 2)
*confused*
|
|
|
|
|
correction to my previous post ... the error lies in the line:
delete[] fileBuf;
it says identifier undeclared.
|
|
|
|
|
please ignore all my previous post.. the problem is fixed.. overlooked some areas..
thanz a lot for your help!
|
|
|
|
|
If I make the broadcast to a real nameserver it is ok. If I give INADDR_BROADCAST , no one response. Kindly help to me.
Thankyou
Anita Eugene
|
|
|
|
|
my code is below, there is no compiler error, but when i run the exe file, it says "An unknown errro occurred while accessing C:\myfile.txt"
can anybody help me?
CStdioFile workFile;
CFileException e;
CString filepath = m_tsfFilepath;
if(!workFile.Open(filepath, CFile::modeWrite | CFile::shareDenyWrite, &e ))
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
}
int pos = 0;
CString workString("");
CStringArray aRegisterList;
workFile.Seek(pos, CFile::begin); //position pointer to beginning of file
workFile.ReadString(workString); //read the first line of text
thanz in advance!
|
|
|
|
|
The thing that jumps out at me is that you are opening the file with flags set for WRITE not READ.
I'll confess I did not thoroughly step through your code simply because I noticed that right away.
I hope that's it because that's easy.
|
|
|
|
|
thanz man! how stupid of me!
|
|
|
|
|
I find that the majority of the problems I have are for just such "simple" oversights.
I'm glad it helped.
|
|
|
|
|
In my message map...
BEGIN_MESSAGE_MAP()
...
ON_WM_????
END_MESSAGE_MAP
what is the message used to tell a window to assert the OnRecieve method of a CAsyncSocket object.
|
|
|
|
|
G'day,
I'm using a CTreeCtrl with check boxes on each item in a dialog. During to call to the dialog's OnInitDialog() I set up the initial checked/unchecked status for each tree item, but these checks seem to disapear when the dialog is actually displayed.
I've poked around in my code and it seems that the checked status is actually lost for each tree item some time after OnInitDialog() returns.
I can check/uncheck tree items with the mouse after the dialog is displayed, but it just seems to lose the checks when initializing.
Can anybody point me in the right direction, please?
I'm sure this has been discussed here at CP before, but I can't find any references.
TIA,
Steve
|
|
|
|
|
Some code please - OnInitDialog handler would be best.
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
G'day Tomasz,
I won't post my actual code here (it's way too long), but the following snippet has the same effect. Note, I've set up the tree control in the dialog as having check boxes enabled.
BOOL CReportSettingsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CString strItemName;
for(int i = 0; i < 20; i++){
strItemName.Format(_T("Item%d"), i);
HTREEITEM hItem = m_Tree.InsertItem(strItemName);
ASSERT(NULL != hItem);
m_Tree.SetCheck(hItem, TRUE);
}
return TRUE;
}
When the dialog above gets drawn, the tree displays the inserted items, but none of their check boxes are checked.
TIA,
Steve
|
|
|
|
|
The solution is quite funny. Here's what I found in the "Tree View Control Window Styles" at MSDN:
"TVS_CHECKBOXES:
...
If you want to use this style, you must set the TVS_CHECKBOXES style with SetWindowLong after you create the treeview control, and before you populate the tree. Otherwise, the checkboxes might appear unchecked, depending on timing issues."
To solve the problem, you have to:
(1) clear the 'check boxes' option in the tree control properties in dialog editor
(2) programatically set the style after the window is created and before items are inserted:
m_Tree.ModifyStyle(0, TVS_CHECKBOXES);
for (...)
{
m_Tree.InsertItem(...);
m_Tree.SetCheck(...);
}
(2) is not enough (at least on my W2K box) - you can't have your tree control created with TVS_CHECKBOXES style.
Cheers,
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
G'day Tomasz,
Thanks for that. It worked a treat!
Steve
|
|
|
|
|
I have to continue to support an old MFC-based application that still uses ODBC to connect to an Access 97 database. (We're rewriting the whole thing as a web application but until it's done we have to continue to add features and support...) Anyway, the database is updated each time we release a new patch to the system (upgrade). The upgrades come down from the web, so we TRY to be kind on the size of the patch. Continuing to update an Access 97 is a major pain since pretty much everyone has moved on to 2000. However, if I convert the database to Office 2000, the database won't load through ODBC calls without installing at least MDAC 2.5. The patch is a single patch that supports Windows 95/98/ME/NT/2000 so (using InstallShield) the MDAC 2.5 object bloats the 4.5 MB patch to 13.5 MB (I suppose because of the cross-platform support).
Is there any minimal things I can do make this work without having to install the entire MDAC update?
|
|
|
|
|
My VC environment donnot show STRUCTs & Ojects member.
what can I do to Fix it.
Iman Ghasr-e-fakhri
|
|
|
|
|
Most IntelliSense problems can be fixed by closing the workspace and deleting the .NCB file. The NCB will be recreated when you open the workspace again.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Does anyone know how to get a handle to a mdi child window WITHOUT MAKING IT ACTIVE?
Take a look at this code:
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild;
CMyView *pView;
CMyDoc *doc;
CString findWindow = "My1";// this is the title of the window i want to find
while(TRUE){
pChild = (CMDIChildWnd *)pFrame->GetActiveFrame();
pView = CMyView *) pChild->GetActiveView();
doc = (CMyDoc *) pView->GetDocument();
CString str;
str = doc->GetTitle();
//if screen title is the same as node text, return.
if(findWindow.Compare(str) == 0)
return TRUE;
pFrame->MDINext();
}
This code works great, it will find the child window that has the same title as the one i pass to it.
however, it will make all the open windows active when, method MDINext() will go to next child
and will activate that child, i don't want that, i want it to search through all window without
activating them.
I used LockWindowUpdate on pFrame after calling MDINext() but it did not work,
any idea?
Thanks,
****Rukhsar
|
|
|
|
|
You try using the win32 API function EnumChildWindows().
Stephen Caldwell
Desick Information Technologies
|
|
|
|
|
What's up! I am trying to make a program that I am developing bullet
proof. What I need to do is prevent a user to use the "control-alt-delete" button
to kill a program. He needs to gracely terminate the program by using the programs
own termination buttons. Does anybody know how to accomplish this? The program
shows up in the taskmanager window. If this is not possible is there a hack to keep
a program out of the taskmanager and at the same time keep it running? This program
runs under win9x,ME and 2000. Is there also a possibility if they do get to the
program that is running and when they kill it ungracefully that I can make their
machine hang?
Thanks in advance,
Raymond
Raymond Bentoera
Cybergate Interactive
|
|
|
|
|
Well, as a user, I definitely don't like programs that can't be killed. And making somebody's machine hang after killing the process seems to be the activity of worm/virus.
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
Hi,
My problem is similar to the one replied .It is related to process hiding in the TaskManager .I have a parent process running .The child process of this parent should not be able to see it's parent process in the TaskManager !But the aprent process will be runing . I want to show the parent when the child process is killed .How can I do it ?
Thanx in advance for the help !
Y.Yamini Devi
|
|
|
|
|
As a programmer I do not like users trying to cheat programs that I have developed. That is why I need to find a way to discourage these power users from cheating the software. Ok, let's try to explore a nicer way of discouraging the user to ungracefully kill the program. The idea of the software is not to disable the user from running the software. Because the software has its own way of closing it. It has its own close button. But the problem is that there is a way of cheating the program by using 'cntrl-alt-delete'. I am implementing the software now to run a s a service in win 95, 98 and ME. But I have a problem with windows 2000. You can see all the services that are running. Also I would like to explore another way of making this program bulletproof. The program I am writing is a free Internet Dialer program where the user gets a banner window that he should not be able to close if he is surfing online using this software. Another problem might be third party software like "system properties" that will unhide programs from the taskbar. That is why I would like to explore other ways of making this program bulletproof. Do you know of anyway this program can disconnect the user if it uses 'cntrl-alt-delete' instead of closing the program using its closing button. The software uses windows dialup networking to dial. If somebody knows a way how to make this program bulletproof please send me your remarks.
Thanks in advance,
Raymond Bentoera
Cybergate Interactive
|
|
|
|
|
You can't kill the service processes from Task Manager in Win2000 - you'll get the 'Access is denied' message.
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|