|
If you look at the implementation of GetLine() of a similar function, you'll notice that it reads from the file character by character until EOF or '\n' is encountered! So what you can do is write your own getline .
Tip, one of the parameteres should be the length of the buffer you are putting the characters in, this helps avoiding problems.
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
|
You could also try using fscanf, which includes a format parameter, and you can specify that the scan reads up to but not including a set of characters. (From memory, check the docs) ...
fscanf (fileptr, "%^['\n']s, &buf);
The format specifier is essentially %s, but in between the % and the s is the "up to but not including this list of chars ... the newline."
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi
I've write some strings into the registry by using 'WriteProfileString()'.
Like this (in the registry):
MYPROGRAM
|
|-- EMPLOYEE
|
|
Name: Jens
Salary: 3Million Euro
Birthdate: .....
etc
Now i want to delete the entire section ("employee"). How can i achieve this?
Greetings
Jens
|
|
|
|
|
Search MSDN for RegDeleteKey
MS
|
|
|
|
|
I have recently had to work with the registry too, and I found that CodeProject has an entire section of articles about the registry. Using the list on the left, follow links through General/System/Registry.
I found that one of the easiest to do "simple" things was from Joseph Newcomer (http://www.codeproject.com/system/registry_class.asp[^]).
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Use CWinApp::DelRegTree. It will delete the key and all subkeys. Stay away from the roll-your-own registry solutions. CWinApp's have methods Get/Write for profile data and it can either be the registry or an .INI file.
|
|
|
|
|
Hi!
I am creating an application which connects to a ftp server and put a file on the server. When I press the send button it sends the file without problem but it seems to me like my application is freezed until the send operation is done! When I click on something on my program before the send operation is terminated my program just crashes down! This is the code I use:
--------------------
CInternetSession InternetSession;
CFtpConnection *m_pFtpConnection;
try
{
m_pFtpConnection = InternetSession.GetFtpConnection(m_serv, m_user, m_pass, INTERNET_INVALID_PORT_NUMBER, m_passsive);
}
catch ( CInternetException *pEx )
{
TCHAR szError [1024];
if ( pEx -> GetErrorMessage ( szError, 1024 ) )
AfxMessageBox ( szError );
else
AfxMessageBox ( "There was an exception." );
pEx -> Delete ();
m_pFtpConnection = NULL;
}
m_pFtpConnection->PutFile("...............", "............." );
if ( m_pFtpConnection != NULL )
{
m_pFtpConnection->Close ();
delete m_pFtpConnection;
}
---------------------------------------
How can I fix this?
Thank you for your future answers!
Well... I am a beginner ...
|
|
|
|
|
Scolinks wrote:
...my application is freezed until the send operation is done!
This is normal behavior. If you want your application to do other things while the file is being transaferred, but this code in a separate thread. Or you could use CFtpConnection::OpenFile() and CInternetFile::Write() to write the file in chunks, updating your UI in between.
|
|
|
|
|
Does anyone know how to implement the OnAfterPrint event in HTML? I'm using CHtmlView but can't see how to slot this in. Any help appreciated!
|
|
|
|
|
I'm working with ODBC and using *.mdb tables.
I wanna show one of tables on a dialog.
How can I do this?
emroz
|
|
|
|
|
What you mean "show the table"
I assume you wanna show the data of the table?
You need EditBox, StaticBox, (may be ComboBox) for the data to be shown on the dialog box.
|
|
|
|
|
I wanna see all of records.
I used dataGrid in visual basic.
You can see the table on the form with it.
How can can I do it in visual C++
emroz
|
|
|
|
|
Hi,
You can use ListCtrl to do this. But you must write an sql query and insert data yourself. Property 'Datasource' don't exists in listrcl
cheickna
|
|
|
|
|
The simple way to incorporate ADO into your application is through the use of ActiveX controls. You can add the ADO data control to your Visual C++ project, just like any other ActiveX control. Once you add the ADO control to your project, and place it on a window, you’ll need to
specify the data connection in the control properties. You’ll also need to specify the source for the records that will be retrieved by the control.
To use the ADO control efficiently, you’ll also want to use data-bound controls that are ADO-enabled, such as the Microsoft DataGrid control. When you add these controls to
the window with the ADO control, you’ll specify the ADO control as the data source for the control. If the control is designed to only provide access to a single field in a record set, you’ll also need to specify which field is to be used for the control. Once you add all these controls to the window and configure them, you can run your
application and have full database access through ADO without having written a single line of code.
If you cannot follow all the steps then you should try to read something about ActiveX controls (how to add them to your application).
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
How to highlighted the cell's frame when I have 'copy' the cell,like Excel?
|
|
|
|
|
Hi,
I created one dialog based application.
When i draw listbox on dialog box and then any activeX
partially overlapping the listbox.
As at build time AcitiveX control is behind the Listbox
control. But after running, AcitiveX comes to the front.
I need to have ActiveX behind the listbox at runtime also.
Or AcitveX contorl' position should be consistence in both
run and build mode.
I need to solve it very
urgently, Please suggest some ideas.
Harinath Reddy
Bangalore,
India-560076
|
|
|
|
|
Bring your listbox to top using BringWindowToTop member function in your OnInitDialog. So, your listbox will always be on your ActiveX.
Hope this helps
|
|
|
|
|
Thanks for the suggestion.
But My problem is not only with a particular control or a specific order.
I will tell the problem again..
If u create Just a MFC AppWizard "dialog based" application.
Now if u draw any controls like: Listbox, edit control,combobox but not button and then ActiveX control overlapping with above control.
Runtime appearence of ActiveX will be different ie activeX will come to the front.
This behavior is just with MFC code.
I want the consistence behabior of ActiveX with Other controls.
I expect some idea from u.
Once again thanks
-Harinath
Harinath Reddy
HOneywell Technology Solutions Lab,
Bangalore,
India-560076
|
|
|
|
|
This problem I had asked previously . I used the solution given as follows.
m_imageList.Create(16, 16, 0, 1, 1);
hIcon = AfxGetApp()->LoadIcon(IDI_ADDUSER);
m_imageList.Add(hIcon);
pList->SetImageList(&m_imageList, LVSIL_SMALL);
pList->InsertColumn(0, "Users", LVCFMT_LEFT, 150);
But still image is not getting set . Icon used is of size 16 * 16
|
|
|
|
|
LoadIcon() only loads 32x32 icons, use LoadImage() instead.
Are you inserting any items? When you do, are you using index 0 as the image to show with the item?
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
I used LoadImage as follows . But still image is not displayed . I checked the values returned by functions used
All functions return successful values. Do we need to set any properties of the list control?
m_imageList.Create(32, 32, 0, 1, 1);
HANDLE hIcon1 ;
hIcon1 = LoadImage( AfxGetInstanceHandle() , LPCTSTR ("IDR_MAINFRAME"), IMAGE_ICON , 32, 32,LR_DEFAULTSIZE);
m_imageList.Add((HICON)hIcon1);
pList->SetImageList(&m_imageList, LVSIL_NORMAL);
|
|
|
|
|
I checked handle returned by loadimage . It returns NULL. I tried using GetLastError BUt it is returning zero .How to use LoadImage?
|
|
|
|
|
Here 's the code I use to set an ImageList to a CTreeCtrl, it works similar
as with an CTreeCtrl. I use a bitmap and a derived CTreeCtrl class though.
void C3StateTree::PreSubclassWindow()
{
<pre>
m_ImageList.Create(16, 16, ILC_COLOR4, 24, 0);
CBitmap nBitmap;
nBitmap.LoadBitmap(IDB_TREESTATES);
m_ImageList.Add(&nBitmap, RGB(255, 0, 255));
SetImageList(&m_ImageList, TVSIL_NORMAL);
ModifyStyle(0, TVS_CHECKBOXES);
ModifyStyleEx(TVS_FULLROWSELECT, 0);
m_Font.CreatePointFont(110, "Courier New");
SetFont(&m_Font);
m_hInsertAllowed = LoadCursor(AfxGetResourceHandle(), MAKEINTRESOURCE(IDC_ADD));
m_hArrow = LoadCursor(NULL, IDC_ARROW);
m_hNo = LoadCursor(NULL, IDC_NO);
CTreeCtrl::PreSubclassWindow();
}
Arjan.
|
|
|
|
|
www.lcdstudio.com is a driver for REAL LCD Displays...??!
what want you to do? I have no idea how to handle a real LCD, but I habe a control for moving around boxes with the mouse.
|
|
|
|